1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#!/bin/sh
#
# script to handle trimming of the polipo cache
set -e
# set reasonable defaults
POLIPO_TRIM=0
POLIPO_TARGET_SIZE=256M
diskCacheRoot=/var/cache/polipo
# read configuration values
[ -r /etc/polipo/trim ] || exit 0
. /etc/polipo/trim
# source'ing the polipo config file is a bit more involved
# since it might contain spaces. Read $diskCacheRoot variable
eval "$(sed s/\ //g < /etc/polipo/config)"
# stop if the package was removed but not purged
[ -x /usr/lib/polipo/polipo_trimcache ] || exit 0
# now do the trimming if requested
[ $POLIPO_TRIM = 1 ] && python /usr/lib/polipo/polipo_trimcache $diskCacheRoot $POLIPO_TARGET_SIZE
exit 0
|