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

21 lines
558 B
Bash
Executable File

#!/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