summaryrefslogtreecommitdiffstats
path: root/encap/src/encap-profiles/ep2target
blob: 1fc8dc8166325899732d71900c9df960c6f4a21e (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
#!/bin/sh

SED="sed"
#SED="/opt/csw/bin/gsed"

chomp() {
    printf "$1" | ${SED} 's:^\ ::g' | ${SED} 's:\ $::g'
}

cname() {
    unset CTMP1 CTMP2
    for PART in `printf "$1" | ${SED} 's:-:\ :g'`; do 
        if [ ! "`printf $PART | cut -c1 | ${SED} 's:[0-9]:0:g'`x" = "0x" ]; then
        CTMP1="${CTMP1} ${PART}"
        fi
    done
    CTMP2="`chomp "$CTMP1" | ${SED} 's:\ :_:g' | ${SED} 's:\+:X:g' | tr [a-z] [A-Z]`"
    printf "\$(%s)%s" "`basename "$CTMP2"`" "$2"
}

builddeps() {
    unset DEPSTMP
    for LINE in `grep "<prereq package=\"" $1 \
                 | ${SED} 's/\ //g' \
                 | awk -F\" '{print $2}'`; do 
                 DEPSTMP="${DEPSTMP} `cname $LINE $2`"
    done
    chomp "$DEPSTMP"
}

installdeps() {
    unset DEPSTMP
    for LINE in `grep "prereq pkgspec" $1 \
                 | awk '{print $4}'`; do 
                 DEPSTMP="${DEPSTMP} `cname $LINE $2`"
    done
    chomp "$DEPSTMP"
}

printf "%s : %s\n" "`cname $1 .installed`" "`builddeps $1 .installed`"
printf "%s : %s\n" "`cname $1 .packaged`" "`installdeps $1 .packaged`"

exit 0