Protect against inconsistent use of / separators in APT paths

As a matter of fact, our own fallback would not even have worked :-(
The `readlink` invocations clean up duplicated and trailing slashes.
This commit is contained in:
Olaf Meeuwissen 2017-10-23 20:40:32 +09:00
parent 62eef576e0
commit 0595d723ab
4 changed files with 11 additions and 7 deletions

View File

@ -5,14 +5,14 @@
# License: GPL-3.0+
DIR=/
ETC=etc/apt
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
cfg=$(readlink -f /$DIR/$ETC/$PARTS)
cat > $cfg/docker-recommends <<EOF
APT::Install-Recommends "false";

View File

@ -14,5 +14,7 @@ CACHE=var/cache/apt/
eval $(apt-config shell DIR Dir)
eval $(apt-config shell CACHE Dir::Cache)
find $DIR$CACHE -type f -name '*.deb' -delete
find $DIR$CACHE -type f -name '*.bin' -delete
cache=$(readlink -f /$DIR/$CACHE)
find $cache -type f -name '*.deb' -delete
find $cache -type f -name '*.bin' -delete

View File

@ -14,4 +14,6 @@ STATE=var/lib/apt/
eval $(apt-config shell DIR Dir)
eval $(apt-config shell STATE Dir::State)
find $DIR$STATE -type f -name '*_dists_*' -delete
state=$(readlink -f /$DIR/$STATE)
find $state -type f -name '*_dists_*' -delete

View File

@ -5,14 +5,14 @@
# License: GPL-3.0+
DIR=/
ETC=etc/apt
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
cfg=$(readlink -f /$DIR/$ETC/$PARTS)
cmd=$(dirname $0)/docker-apt-clean
cat > $cfg/docker-clean <<EOF