docker-devuan_paddy-hack/scripts/docker-apt-clean

21 lines
552 B
Bash

#!/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=/
CACHE=var/cache/apt/
eval $(apt-config shell DIR Dir)
eval $(apt-config shell CACHE Dir::Cache)
cache=$(readlink -f /$DIR/$CACHE)
find $cache -type f -name '*.deb' -delete
find $cache -type f -name '*.bin' -delete