aboutsummaryrefslogtreecommitdiffhomepage
path: root/mini-alpine3/prepare-pkg-list.sh
blob: 67c720d4385a2432fb9e0ad3a86f2d8053fbe6d3 (plain) (blame)
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
61
62
63
64
65
66
67
68
#!/bin/sh
#
# Prepare the list of packages to be installed/uninstalled.
#
# ENVIRONMENT VARIABLES:
#
#    - APK_LIST: APK package list;  default = "apk-list"
#    - PIP_LIST: PIP package list;  default = "pip-list"
#

echo "===> Preparing APK package list..."

if [ -z "$APK_LIST" ]; then
    APK_LIST=apk-list
fi

if [ -f "$APK_LIST" ]; then

    awk '/^#/ {next}                                 \
         { split($0,arrayA);                         \
           for (i in arrayA) {                       \
              if (arrayA[i] == "!") { continue; }    \
              print arrayA[i]                        \
           }                                         \
         }'                                          \
        $APK_LIST > ___APK_INSTALL_LIST

    awk '/^(#|!)/ {next}                                          \
         { split($0,arrayA); for (i in arrayA) print arrayA[i] }' \
        $APK_LIST  |
        awk '{ L[n++] = $0 }          \
                END { while(n--)      \
                      print L[n] }'   \
            > ___APK_UNINSTALL_LIST

fi
#cat ___APK_INSTALL_LIST
#cat ___APK_UNINSTALL_LIST


echo "===> Preparing PIP package list..."

if [ -z "$PIP_LIST" ]; then
    PIP_LIST=pip-list
fi

if [ -f "$PIP_LIST" ]; then

    awk '/^#/ {next}                                 \
         { split($0,arrayA);                         \
           for (i in arrayA) {                       \
              if (arrayA[i] == "!") { continue; }    \
              print arrayA[i]                        \
           }                                         \
         }'                                          \
        $PIP_LIST > ___PIP_INSTALL_LIST

    awk '/^(#|!)/ {next}                                          \
         { split($0,arrayA); for (i in arrayA) print arrayA[i] }' \
        $PIP_LIST  |
        awk '{ L[n++] = $0 }          \
                END { while(n--)      \
                      print L[n] }'   \
            > ___PIP_UNINSTALL_LIST

fi
#cat ___PIP_INSTALL_LIST
#cat ___PIP_UNINSTALL_LIST