aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/create-managed-to-proxy-map.sh
blob: ffaaa584bfd0efbb5d576884ad04d6585c5ceab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash


MYWD=`pwd`

function makeListing()
{
    LISTID=$1

    cd $MYWD/$LISTID
    find . -type f -not -wholename "*/\.*" | sort > $MYWD/$LISTID.tmp
}

function isInRepo()
{
    LISTID=$1
    FILEID=$2

    grep -q "$FILEID" $MYWD/$LISTID.tmp
    RETCODE=$?
    if [ $RETCODE -eq 0 ] ; then
        LISTID=${LISTID/proxied/}
        echo "[${LISTID:0:1}]"
    else
        echo "   "
    fi
}

makeListing "managed"
makeListing "proxied1"
makeListing "proxied2"

cd $MYWD

TS=`date`

echo "$0 - executed on $TS"
echo ""
echo "Determining location of files."
echo " Key: [m] == managed"
echo "      [1] == proxy 1 (proxied1)"
echo "      [2] == proxy 2 (proxied2)"
echo ""
echo " -m- -1- -2- | -------------------------------------------- "

FILELIST=`cat managed.tmp proxied1.tmp proxied2.tmp | sort -u`

for FF in $FILELIST
do
    INMANAGED=`isInRepo "managed" "$FF"`
    INPROXY1=`isInRepo "proxied1" "$FF"`
    INPROXY2=`isInRepo "proxied2" "$FF"`

    echo " $INMANAGED $INPROXY1 $INPROXY2 | $FF"
done

echo " --- --- --- | -------------------------------------------- "

rm -f managed.tmp proxied1.tmp proxied2.tmp