summaryrefslogtreecommitdiff
path: root/debian/apt.cron.daily
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-05-02 09:40:26 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-05-02 09:40:26 +0200
commitf4fd0a1c34babf8fbac71bc3471b41b411e414b2 (patch)
tree505cc791de97dbfd8d1f979c651bb3336f69028a /debian/apt.cron.daily
parentecc8d43394155ea99960f66ed35713c701801c3f (diff)
parenta63bbd7e93ec5e231d5d9b0b33cffec5cf6192d0 (diff)
* merged from the debian-sid bzr branch
* apt-pkg/depcache.cc: - Really release action groups only once (Closes: #622744) - Make purge work again for config-files (LP: #244598) (Closes: #150831) * debian/apt.cron.daily: - Check power after wait, patch by manuel-soto (LP: #705269) * debian/control: - Move ${shlibs:Depends} to Pre-Depends, as we do not want APT unpacked if a library is too old and thus break upgrades * doc/apt-key.8.xml: - Document apt-key net-update (LP: #192810) * apt-pkg/acquire-item.cc: - Only try to rename existing Release files (Closes: #622912) * apt-pkg/indexcopy.cc: - Use RealFileExists() instead of FileExists(), allows amongst other things a directory named Sources to exist on a CD-ROM (LP: #750694). * apt-pkg/acquire-item.cc: - Use Release files even if they cannot be verified (LP: #704595) * cmdline/apt-get.cc: - Do not install recommends for build-dep (Closes: #454479) (LP: #245273) * apt-pkg/deb/deblistparser.cc: - Handle no space before "[" in build-dependencies (LP: #72344) * apt-pkg/policy.cc: - Allow pinning by glob() expressions, and regular expressions surrounded by slashes (the "/" character) (LP: #399474) (Closes: #121132) * debian/control: - Set Standards-Version to 3.9.2 * mirror method: - do not crash if the mirror file fails to download * apt-pkg/aptconfiguration.cc: - fix comparing for a empty string * debian/apt.cron.daily: - run unattended-upgrades even if there was a error during the apt-get update (LP: #676295) * apt-pkg/pkgcache.cc: - use the native Architecture stored in the cache header instead of loading it from configuration as suggested by Julian Andres Klode
Diffstat (limited to 'debian/apt.cron.daily')
-rw-r--r--debian/apt.cron.daily38
1 files changed, 22 insertions, 16 deletions
diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily
index 9048ca7fe..1dfaa04a3 100644
--- a/debian/apt.cron.daily
+++ b/debian/apt.cron.daily
@@ -305,6 +305,26 @@ debug_echo()
fi
}
+check_power(){
+ # laptop check, on_ac_power returns:
+ # 0 (true) System is on main 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
+ on_ac_power
+ POWER=$?
+ if [ $POWER -eq 1 ]; then
+ debug_echo "exit: system NOT on main power"
+ return 1
+ elif [ $POWER -ne 0 ]; then
+ debug_echo "power status ($POWER) undetermined, continuing"
+ fi
+ debug_echo "system is on main power."
+ fi
+ return 0
+}
+
# ------------------------ main ----------------------------
# Backup the 7 last versions of APT's extended_states file
@@ -350,22 +370,7 @@ if [ "$VERBOSE" -ge 3 ]; then
set -x
fi
-# laptop check, on_ac_power returns:
-# 0 (true) System is on main 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
- on_ac_power
- POWER=$?
- if [ $POWER -eq 1 ]; then
- debug_echo "exit: system NOT on main power"
- exit 0
- elif [ $POWER -ne 0 ]; then
- debug_echo "power status ($POWER) undetermined, continuing"
- fi
- debug_echo "system is on main power."
-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 -f $XAPTOPT $XSTDERR ; then
@@ -416,6 +421,7 @@ do_cache_backup $BackupArchiveInterval
# sleep random amount of time to avoid hitting the
# mirrors at the same time
random_sleep
+check_power || exit 0
# include default system language so that "apt-get update" will
# fetch the right translated package descriptions