Fix overly zealous removal of APT state and cache files
Removal of the package index files, aka lists, is something that needs to be done explicitly. Doing so at `APT::Update::Post-Invoke` defeats the purpose of running `apt-get update` in the first place.
This commit is contained in:
parent
280e7f4f56
commit
6595d68dd1
|
|
@ -9,12 +9,10 @@
|
||||||
# effect as running `apt-get clean` but circumvents the deadlock.
|
# effect as running `apt-get clean` but circumvents the deadlock.
|
||||||
|
|
||||||
DIR=/
|
DIR=/
|
||||||
STATE=var/lib/apt/
|
|
||||||
CACHE=var/cache/apt/
|
CACHE=var/cache/apt/
|
||||||
|
|
||||||
eval $(apt-config shell DIR Dir)
|
eval $(apt-config shell DIR Dir)
|
||||||
eval $(apt-config shell STATE Dir::State)
|
|
||||||
eval $(apt-config shell CACHE Dir::Cache)
|
eval $(apt-config shell CACHE Dir::Cache)
|
||||||
|
|
||||||
find $DIR$STATE -type f -delete
|
find $DIR$CACHE -type f -name '*.deb' -delete
|
||||||
find $DIR$CACHE -type f -delete
|
find $DIR$CACHE -type f -name '*.bin' -delete
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# remove-apt-lists -- to keep Docker image size small
|
||||||
|
# Copyright (C) 2017 Olaf Meeuwissen
|
||||||
|
#
|
||||||
|
# License: GPL-3.0+
|
||||||
|
|
||||||
|
# There is no convenient Post-Invoke hook anywhere to hang this onto
|
||||||
|
# but it is nice to be able to clean up the package index files when
|
||||||
|
# you want to save space.
|
||||||
|
|
||||||
|
DIR=/
|
||||||
|
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
|
||||||
Loading…
Reference in New Issue