aboutsummaryrefslogtreecommitdiffhomepage
path: root/mini-debian9/prepare-pkg-list.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mini-debian9/prepare-pkg-list.sh')
-rwxr-xr-xmini-debian9/prepare-pkg-list.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/mini-debian9/prepare-pkg-list.sh b/mini-debian9/prepare-pkg-list.sh
new file mode 100755
index 0000000..ce2195d
--- /dev/null
+++ b/mini-debian9/prepare-pkg-list.sh
@@ -0,0 +1,37 @@
1#!/bin/sh
2#
3# Prepare the list of packages to be installed/uninstalled.
4#
5# ENVIRONMENT VARIABLES:
6#
7# - APT_LIST: APT package list; default = "apt-list"
8#
9
10echo "===> Preparing APT package list..."
11
12if [ -z "$APT_LIST" ]; then
13 APT_LIST=apt-list
14fi
15
16if [ -f "$APT_LIST" ]; then
17
18 awk '/^#/ {next} \
19 { split($0,arrayA); \
20 for (i in arrayA) { \
21 if (arrayA[i] == "!") { continue; } \
22 print arrayA[i] \
23 } \
24 }' \
25 $APT_LIST > ___APT_INSTALL_LIST
26
27 awk '/^(#|!)/ {next} \
28 { split($0,arrayA); for (i in arrayA) print arrayA[i] }' \
29 $APT_LIST |
30 awk '{ L[n++] = $0 } \
31 END { while(n--) \
32 print L[n] }' \
33 > ___APT_UNINSTALL_LIST
34
35fi
36#cat ___APT_INSTALL_LIST
37#cat ___APT_UNINSTALL_LIST