summaryrefslogtreecommitdiff
path: root/debootstrap.sh
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2017-08-30 02:49:10 -0400
committerAndrew Cady <d@jerkface.net>2017-08-30 02:49:10 -0400
commitd2e4d3fb467b332fe0f972ccab2c5c37ccdd5fd5 (patch)
treefe297297c96e8fb4640e65adc1eeae3593f08403 /debootstrap.sh
parentbf6a545b4eefd65e5c55a43087c6021b19a5ce0d (diff)
deboostrap.sh: new commands: unpackaged, unpackaged-du
Diffstat (limited to 'debootstrap.sh')
-rwxr-xr-xdebootstrap.sh34
1 files changed, 33 insertions, 1 deletions
diff --git a/debootstrap.sh b/debootstrap.sh
index d76db93..0b62694 100755
--- a/debootstrap.sh
+++ b/debootstrap.sh
@@ -13,6 +13,8 @@ Usage:
13 $0 clone <suite> <source-name> <new-name> 13 $0 clone <suite> <source-name> <new-name>
14 $0 chroot <suite> <name> 14 $0 chroot <suite> <name>
15 $0 list 15 $0 list
16 $0 show unpackaged <suite> <name>
17 $0 show unpackaged-du <suite> <name>
16 18
17EOF 19EOF
18 list 20 list
@@ -103,6 +105,27 @@ suite_name_to_imagename()
103 printf '%s/%s-%s-%s.%s.btrfs\n' "$imgdir" "$suite" "$variant" "$arch" "$name" 105 printf '%s/%s-%s-%s.%s.btrfs\n' "$imgdir" "$suite" "$variant" "$arch" "$name"
104} 106}
105 107
108show_unpackaged()
109{
110 suite=$1
111 name=$2
112 imagename=$(suite_name_to_imagename "$suite" "$name")
113
114 sh_image "$suite" "$name" find -type f | sed 's?^\./??' | sort > ${imagename}.find.txt
115 sh_image "$suite" "$name" sh -c 'sort -u var/lib/dpkg/info/*.list' | sed -e 's?^/??' -e 's?^\.$/??' > ${imagename}.dpkg-list.txt
116 comm -23 ${imagename}.find.txt ${imagename}.dpkg-list.txt | tee ${imagename}.unpackaged.txt
117}
118
119show_unpackaged_du()
120{
121 if [ "$3" = filtered ]; then
122 filter='var/lib/dpkg/|var/lib/apt/|var/log/'
123 show_unpackaged "$@" | egrep -v "^($filter)" | sh_image "$1" "$2" xargs du -csh
124 else
125 show_unpackaged "$@" | sh_image "$1" "$2" xargs du -csh
126 fi
127}
128
106sh_image() 129sh_image()
107{ 130{
108 suite=$1 131 suite=$1
@@ -216,8 +239,17 @@ debootstrap_efficiently()
216 debootstrap "$@" || die "debootstrap failed" 239 debootstrap "$@" || die "debootstrap failed"
217} 240}
218 241
242show()
243{
244 case "$1" in
245 unpackaged) shift; show_unpackaged "$@" ;;
246 unpackaged-du) shift; show_unpackaged_du "$@" ;;
247 *) usage ;;
248 esac
249}
250
219case "$1" in 251case "$1" in
220 init|new|clone|list) cmd=$1; shift; $cmd "$@" ;; 252 init|new|clone|list|show) cmd=$1; shift; $cmd "$@" ;;
221 chroot|sh) cmd=${1}_image; shift; $cmd "$@" ;; 253 chroot|sh) cmd=${1}_image; shift; $cmd "$@" ;;
222 *) usage ;; 254 *) usage ;;
223esac 255esac