summaryrefslogtreecommitdiff
path: root/debian/apt.cron.daily
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2016-01-02 21:24:47 +0100
committerMichael Vogt <mvo@ubuntu.com>2016-01-02 21:27:38 +0100
commit73d52d65816491c0dd8815f393c238f599fea21e (patch)
treec218bd6ea2a4c13ed1a324c46d40331478d065af /debian/apt.cron.daily
parentf6459e646f6fa45c34d1f13f37173ea4b92ffd5f (diff)
Add support for APT::Periodic::CleanInterval
In order to allow regular cleaning of the downloaded deb archives the new option APT::Periodic::CleanInterval is added. It will run "apt-get clean" in the given time interval. Thanks: Martin-Éric Racine
Diffstat (limited to 'debian/apt.cron.daily')
-rw-r--r--debian/apt.cron.daily22
1 files changed, 21 insertions, 1 deletions
diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily
index d3c9e04c1..7e976a087 100644
--- a/debian/apt.cron.daily
+++ b/debian/apt.cron.daily
@@ -62,6 +62,9 @@
# APT::Periodic::AutocleanInterval "0";
# - Do "apt-get autoclean" every n-days (0=disable)
#
+# APT::Periodic::CleanInterval "0";
+# - Do "apt-get clean" every n-days (0=disable)
+#
# APT::Periodic::Verbose "0";
# - Send report mail to root
# 0: no report (or null string)
@@ -411,6 +414,9 @@ eval $(apt-config shell UnattendedUpgradeInterval APT::Periodic::Unattended-Upgr
AutocleanInterval=0
eval $(apt-config shell AutocleanInterval APT::Periodic::AutocleanInterval)
+CleanInterval=0
+eval $(apt-config shell CleanInterval APT::Periodic::CleanInterval)
+
BackupArchiveInterval=0
eval $(apt-config shell BackupArchiveInterval APT::Periodic::BackupArchiveInterval)
@@ -422,7 +428,8 @@ if [ $UpdateInterval -eq 0 ] &&
[ $DownloadUpgradeableInterval -eq 0 ] &&
[ $UnattendedUpgradeInterval -eq 0 ] &&
[ $BackupArchiveInterval -eq 0 ] &&
- [ $AutocleanInterval -eq 0 ]; then
+ [ $AutocleanInterval -eq 0 ] &&
+ [ $CleanInterval -eq 0 ]; then
# check cache size
check_size_constraints
@@ -498,6 +505,19 @@ else
debug_echo "unattended-upgrade (not run)"
fi
+# clean package archive
+CLEAN_STAMP=/var/lib/apt/periodic/clean-stamp
+if check_stamp $CLEAN_STAMP $CleanInterval; then
+ if eval apt-get $XAPTOPT -y clean $XSTDERR; then
+ debug_echo "clean (success)."
+ update_stamp $CLEAN_STAMP
+ else
+ debug_echo "clean (error)"
+ fi
+else
+ debug_echo "clean (not run)"
+fi
+
# autoclean package archive
AUTOCLEAN_STAMP=/var/lib/apt/periodic/autoclean-stamp
if check_stamp $AUTOCLEAN_STAMP $AutocleanInterval; then