X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/51c4e07f4cba0615ff269b5a8d04dfd3d1313b00..a99c3a5f51d31f72174c91643e1e04002686452a:/debian/apt.cron.daily diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily index 765dd4ae4..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) @@ -324,7 +327,7 @@ check_power(){ # 1 (false) System is not on main power # 255 (false) Power status could not be determined # Desktop systems always return 255 it seems - if which on_ac_power >/dev/null; then + if which on_ac_power >/dev/null 2>&1; then on_ac_power POWER=$? if [ $POWER -eq 1 ]; then @@ -352,7 +355,7 @@ if test -r /var/lib/apt/extended_states; then fi # check apt-config existence -if ! which apt-config >/dev/null ; then +if ! which apt-config >/dev/null 2>&1; then exit 0 fi @@ -388,7 +391,7 @@ fi check_power || exit 0 # check if we can lock the cache and if the cache is clean -if which apt-get >/dev/null && ! eval apt-get check $XAPTOPT $XSTDERR ; then +if which apt-get >/dev/null 2>&1 && ! eval apt-get check $XAPTOPT $XSTDERR ; then debug_echo "error encountered in cron job with \"apt-get check\"." exit 0 fi @@ -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 @@ -451,7 +458,7 @@ UPDATE_STAMP=/var/lib/apt/periodic/update-stamp if check_stamp $UPDATE_STAMP $UpdateInterval; then if eval apt-get $XAPTOPT -y update $XSTDERR; then debug_echo "download updated metadata (success)." - if which dbus-send >/dev/null && pidof dbus-daemon >/dev/null; then + if which dbus-send >/dev/null 2>&1 && pidof dbus-daemon >/dev/null 2>&1; then if dbus-send --system / app.apt.dbus.updated boolean:true ; then debug_echo "send dbus signal (success)" else @@ -487,7 +494,7 @@ fi # auto upgrade all upgradeable packages UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp -if which unattended-upgrade >/dev/null && check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then +if which unattended-upgrade >/dev/null 2>&1 && check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then if unattended-upgrade $XUUPOPT; then update_stamp $UPGRADE_STAMP debug_echo "unattended-upgrade (success)" @@ -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