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:
parent
62eef576e0
commit
0595d723ab
|
|
@ -5,14 +5,14 @@
|
||||||
# License: GPL-3.0+
|
# License: GPL-3.0+
|
||||||
|
|
||||||
DIR=/
|
DIR=/
|
||||||
ETC=etc/apt
|
ETC=etc/apt/
|
||||||
PARTS=apt.conf.d
|
PARTS=apt.conf.d
|
||||||
|
|
||||||
eval $(apt-config shell DIR Dir)
|
eval $(apt-config shell DIR Dir)
|
||||||
eval $(apt-config shell ETC Dir::Etc)
|
eval $(apt-config shell ETC Dir::Etc)
|
||||||
eval $(apt-config shell PARTS Dir::Etc::Parts)
|
eval $(apt-config shell PARTS Dir::Etc::Parts)
|
||||||
|
|
||||||
cfg=$DIR$ETC$PARTS
|
cfg=$(readlink -f /$DIR/$ETC/$PARTS)
|
||||||
|
|
||||||
cat > $cfg/docker-recommends <<EOF
|
cat > $cfg/docker-recommends <<EOF
|
||||||
APT::Install-Recommends "false";
|
APT::Install-Recommends "false";
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,7 @@ CACHE=var/cache/apt/
|
||||||
eval $(apt-config shell DIR Dir)
|
eval $(apt-config shell DIR Dir)
|
||||||
eval $(apt-config shell CACHE Dir::Cache)
|
eval $(apt-config shell CACHE Dir::Cache)
|
||||||
|
|
||||||
find $DIR$CACHE -type f -name '*.deb' -delete
|
cache=$(readlink -f /$DIR/$CACHE)
|
||||||
find $DIR$CACHE -type f -name '*.bin' -delete
|
|
||||||
|
find $cache -type f -name '*.deb' -delete
|
||||||
|
find $cache -type f -name '*.bin' -delete
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,6 @@ STATE=var/lib/apt/
|
||||||
eval $(apt-config shell DIR Dir)
|
eval $(apt-config shell DIR Dir)
|
||||||
eval $(apt-config shell STATE Dir::State)
|
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
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,14 @@
|
||||||
# License: GPL-3.0+
|
# License: GPL-3.0+
|
||||||
|
|
||||||
DIR=/
|
DIR=/
|
||||||
ETC=etc/apt
|
ETC=etc/apt/
|
||||||
PARTS=apt.conf.d
|
PARTS=apt.conf.d
|
||||||
|
|
||||||
eval $(apt-config shell DIR Dir)
|
eval $(apt-config shell DIR Dir)
|
||||||
eval $(apt-config shell ETC Dir::Etc)
|
eval $(apt-config shell ETC Dir::Etc)
|
||||||
eval $(apt-config shell PARTS Dir::Etc::Parts)
|
eval $(apt-config shell PARTS Dir::Etc::Parts)
|
||||||
|
|
||||||
cfg=$DIR$ETC$PARTS
|
cfg=$(readlink -f /$DIR/$ETC/$PARTS)
|
||||||
|
|
||||||
cmd=$(dirname $0)/docker-apt-clean
|
cmd=$(dirname $0)/docker-apt-clean
|
||||||
cat > $cfg/docker-clean <<EOF
|
cat > $cfg/docker-clean <<EOF
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue