summaryrefslogtreecommitdiff
path: root/debian/apt.systemd.daily
diff options
context:
space:
mode:
Diffstat (limited to 'debian/apt.systemd.daily')
-rwxr-xr-xdebian/apt.systemd.daily45
1 files changed, 36 insertions, 9 deletions
diff --git a/debian/apt.systemd.daily b/debian/apt.systemd.daily
index 49af931bd..40b6692ec 100755
--- a/debian/apt.systemd.daily
+++ b/debian/apt.systemd.daily
@@ -78,6 +78,12 @@ check_stamp()
stamp="$1"
interval="$2"
+ if [ $interval = always ]; then
+ debug_echo "check_stamp: ignoring time stamp file, interval set to always"
+ # treat as enough time has passed
+ return 0
+ fi
+
if [ $interval -eq 0 ]; then
debug_echo "check_stamp: interval=0"
# treat as no time has passed
@@ -112,8 +118,20 @@ check_stamp()
delta=$(($now-$stamp))
- # interval is in days, convert to sec.
- interval=$(($interval*60*60*24))
+ # Calculate the interval in seconds depending on the unit specified
+ if [ "${interval%s}" != "$interval" ] ; then
+ interval="${interval%s}"
+ elif [ "${interval%m}" != "$interval" ] ; then
+ interval="${interval%m}"
+ interval=$((interval*60))
+ elif [ "${interval%h}" != "$interval" ] ; then
+ interval="${interval%h}"
+ interval=$((interval*60*60))
+ else
+ interval="${interval%d}"
+ interval=$((interval*60*60*24))
+ fi
+
debug_echo "check_stamp: interval=$interval, now=$now, stamp=$stamp, delta=$delta (sec)"
# remove timestamps a day (or more) in the future and force re-check
@@ -217,7 +235,9 @@ check_size_constraints()
do_cache_backup()
{
BackupArchiveInterval="$1"
- if [ $BackupArchiveInterval -eq 0 ]; then
+ if [ $BackupArchiveInterval = always ]; then
+ :
+ elif [ $BackupArchiveInterval -eq 0 ]; then
return
fi
@@ -388,12 +408,19 @@ Debdelta=1
eval $(apt-config shell Debdelta APT::Periodic::Download-Upgradeable-Packages-Debdelta)
# check if we actually have to do anything that requires locking the cache
-if [ $UpdateInterval -eq 0 ] &&
- [ $DownloadUpgradeableInterval -eq 0 ] &&
- [ $UnattendedUpgradeInterval -eq 0 ] &&
- [ $BackupArchiveInterval -eq 0 ] &&
- [ $AutocleanInterval -eq 0 ] &&
- [ $CleanInterval -eq 0 ]; then
+if [ $UpdateInterval = always ] ||
+ [ $DownloadUpgradeableInterval = always ] ||
+ [ $UnattendedUpgradeInterval = always ] ||
+ [ $BackupArchiveInterval = always ] ||
+ [ $AutocleanInterval = always ] ||
+ [ $CleanInterval = always ] ; then
+ :
+elif [ $UpdateInterval -eq 0 ] &&
+ [ $DownloadUpgradeableInterval -eq 0 ] &&
+ [ $UnattendedUpgradeInterval -eq 0 ] &&
+ [ $BackupArchiveInterval -eq 0 ] &&
+ [ $AutocleanInterval -eq 0 ] &&
+ [ $CleanInterval -eq 0 ] ; then
# check cache size
check_size_constraints