summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2017-04-26 19:58:56 +0200
committerJulian Andres Klode <jak@debian.org>2017-04-26 20:45:38 +0200
commit007b22ee6fd33d9b03637577f8401a43c5e7c90c (patch)
tree91e0f49a1b685683b6fa16507dea8d6c698cf68c
parent7f18715769a93da7a99438f6de4e2533ac8c7ed8 (diff)
Allow the daily script to be run in two phases
This adds an argument to the script which may be update, install, or empty. In the update cases, downloads are performed. In the install case, installs are performed. If empty, both are run. Gbp-Dch: ignore
-rwxr-xr-xdebian/apt.systemd.daily146
1 files changed, 75 insertions, 71 deletions
diff --git a/debian/apt.systemd.daily b/debian/apt.systemd.daily
index 03d41bae5..54a8871ea 100755
--- a/debian/apt.systemd.daily
+++ b/debian/apt.systemd.daily
@@ -384,97 +384,101 @@ if [ $UpdateInterval -eq 0 ] &&
exit 0
fi
-# deal with BackupArchiveInterval
-do_cache_backup $BackupArchiveInterval
-
-# include default system language so that "apt-get update" will
-# fetch the right translated package descriptions
-if [ -r /etc/default/locale ]; then
- . /etc/default/locale
- export LANG LANGUAGE LC_MESSAGES LC_ALL
-fi
+if [ "$1" = "update" -o -z "$1" ] ; then
+ # deal with BackupArchiveInterval
+ do_cache_backup $BackupArchiveInterval
+
+ # include default system language so that "apt-get update" will
+ # fetch the right translated package descriptions
+ if [ -r /etc/default/locale ]; then
+ . /etc/default/locale
+ export LANG LANGUAGE LC_MESSAGES LC_ALL
+ fi
-# update package lists
-UPDATED=0
-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 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)"
+ # update package lists
+ UPDATED=0
+ 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 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
+ debug_echo "send dbus signal (error)"
+ fi
else
- debug_echo "send dbus signal (error)"
+ debug_echo "dbus signal not send (command not available)"
fi
+ update_stamp $UPDATE_STAMP
+ UPDATED=1
else
- debug_echo "dbus signal not send (command not available)"
+ debug_echo "download updated metadata (error)"
fi
- update_stamp $UPDATE_STAMP
- UPDATED=1
else
- debug_echo "download updated metadata (error)"
- fi
-else
- debug_echo "download updated metadata (not run)."
-fi
-
-# download all upgradeable packages (if it is requested)
-DOWNLOAD_UPGRADEABLE_STAMP=/var/lib/apt/periodic/download-upgradeable-stamp
-if [ $UPDATED -eq 1 ] && check_stamp $DOWNLOAD_UPGRADEABLE_STAMP $DownloadUpgradeableInterval; then
- if [ $Debdelta -eq 1 ]; then
- debdelta-upgrade >/dev/null 2>&1 || true
+ debug_echo "download updated metadata (not run)."
fi
- if eval apt-get $XAPTOPT -y -d dist-upgrade $XSTDERR; then
- update_stamp $DOWNLOAD_UPGRADEABLE_STAMP
- debug_echo "download upgradable (success)"
+
+ # download all upgradeable packages (if it is requested)
+ DOWNLOAD_UPGRADEABLE_STAMP=/var/lib/apt/periodic/download-upgradeable-stamp
+ if [ $UPDATED -eq 1 ] && check_stamp $DOWNLOAD_UPGRADEABLE_STAMP $DownloadUpgradeableInterval; then
+ if [ $Debdelta -eq 1 ]; then
+ debdelta-upgrade >/dev/null 2>&1 || true
+ fi
+ if eval apt-get $XAPTOPT -y -d dist-upgrade $XSTDERR; then
+ update_stamp $DOWNLOAD_UPGRADEABLE_STAMP
+ debug_echo "download upgradable (success)"
+ else
+ debug_echo "download upgradable (error)"
+ fi
else
- debug_echo "download upgradable (error)"
+ debug_echo "download upgradable (not run)"
fi
-else
- debug_echo "download upgradable (not run)"
fi
-# auto upgrade all upgradeable packages
-UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp
-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)"
+if [ "$1" = "install" -o -z "$1" ] ; then
+ # auto upgrade all upgradeable packages
+ UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp
+ 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)"
+ else
+ debug_echo "unattended-upgrade (error)"
+ fi
else
- debug_echo "unattended-upgrade (error)"
+ debug_echo "unattended-upgrade (not run)"
fi
-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
+ # 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 (error)"
+ debug_echo "clean (not run)"
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
- if eval apt-get $XAPTOPT -y autoclean $XSTDERR; then
- debug_echo "autoclean (success)."
- update_stamp $AUTOCLEAN_STAMP
+ # autoclean package archive
+ AUTOCLEAN_STAMP=/var/lib/apt/periodic/autoclean-stamp
+ if check_stamp $AUTOCLEAN_STAMP $AutocleanInterval; then
+ if eval apt-get $XAPTOPT -y autoclean $XSTDERR; then
+ debug_echo "autoclean (success)."
+ update_stamp $AUTOCLEAN_STAMP
+ else
+ debug_echo "autoclean (error)"
+ fi
else
- debug_echo "autoclean (error)"
+ debug_echo "autoclean (not run)"
fi
-else
- debug_echo "autoclean (not run)"
-fi
-# check cache size
-check_size_constraints
+ # check cache size
+ check_size_constraints
+fi
#
# vim: set sts=4 ai :