Keep "flab" out of the image
This integrates a custom script into the APT configuration. That same
script is also run during the bootstrap. A second custom script takes
care of the integration and removes itself when done.
Complements 13f84159.
This commit is contained in:
parent
5aa1da98dd
commit
0fa8b8505b
|
|
@ -14,5 +14,9 @@ rootfs=/devuan/rootfs
|
||||||
|
|
||||||
debootstrap --variant=minbase jessie $rootfs
|
debootstrap --variant=minbase jessie $rootfs
|
||||||
|
|
||||||
find $rootfs/var/cache/apt/ -type f -delete
|
bindir=usr/local/bin
|
||||||
find $rootfs/var/lib/apt/ -type f -delete
|
cp -a scripts/* $rootfs/$bindir
|
||||||
|
|
||||||
|
for script in $(ls $rootfs/$bindir); do
|
||||||
|
chroot $rootfs /$bindir/$script
|
||||||
|
done
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# docker-apt-clean -- to keep Docker image size small
|
||||||
|
# Copyright (C) 2017 Olaf Meeuwissen
|
||||||
|
#
|
||||||
|
# License: GPL-3.0+
|
||||||
|
|
||||||
|
# Running `apt-get clean` from within apt-get causes deadlock due to
|
||||||
|
# the locking mechanism used by apt-get. This script has a similar
|
||||||
|
# effect as running `apt-get clean` but circumvents the deadlock.
|
||||||
|
|
||||||
|
DIR=/
|
||||||
|
STATE=var/lib/apt/
|
||||||
|
CACHE=var/cache/apt/
|
||||||
|
|
||||||
|
eval $(apt-config shell DIR Dir)
|
||||||
|
eval $(apt-config shell STATE Dir::State)
|
||||||
|
eval $(apt-config shell CACHE Dir::Cache)
|
||||||
|
|
||||||
|
find $DIR$STATE -type f -delete
|
||||||
|
find $DIR$CACHE -type f -delete
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh -eu
|
||||||
|
# tweak-apt-config -- for use in a Docker image
|
||||||
|
# Copyright (C) 2017 Olaf Meeuwissen
|
||||||
|
#
|
||||||
|
# License: GPL-3.0+
|
||||||
|
|
||||||
|
DIR=/
|
||||||
|
ETC=etc/apt
|
||||||
|
PARTS=apt.conf.d
|
||||||
|
|
||||||
|
eval $(apt-config shell DIR Dir)
|
||||||
|
eval $(apt-config shell ETC Dir::Etc)
|
||||||
|
eval $(apt-config shell PARTS Dir::Etc::Parts)
|
||||||
|
|
||||||
|
cfg=$DIR$ETC$PARTS
|
||||||
|
|
||||||
|
cmd=$(dirname $0)/docker-apt-clean
|
||||||
|
cat > $cfg/docker-clean <<- EOF
|
||||||
|
DPkg::Post-Invoke { "if test -x $cmd; then $cmd; fi"; };
|
||||||
|
APT::Update::Post-Invoke { "if test -x $cmd; then $cmd; fi"; };
|
||||||
|
EOF
|
||||||
|
chmod 0644 $cfg/docker-clean
|
||||||
|
|
||||||
|
rm $0
|
||||||
Loading…
Reference in New Issue