* debian/apt.cron.daily:
authorMichael Vogt <michael.vogt@ubuntu.com>
Mon, 25 Feb 2008 18:10:54 +0000 (18:10 +0000)
committerMichael Vogt <michael.vogt@ubuntu.com>
Mon, 25 Feb 2008 18:10:54 +0000 (18:10 +0000)
  - show update-notifier notification on authentication failure

debian/apt.cron.daily
debian/changelog

index 1b54cdf..b0164a5 100644 (file)
@@ -147,6 +147,25 @@ check_size_constraints()
     fi
 }
 
+# sleep for a random intervall of time (default 30min)
+# (some code taken from cron-apt, thanks)
+random_sleep()
+{
+    RandomSleep=1800
+    eval $(apt-config shell RandomSleep APT::Periodic::RandomSleep)
+    if [ $RandomSleep -eq 0 ]; then
+       return
+    fi
+    if [ -z "$RANDOM" ] ; then
+        # A fix for shells that do not have this bash feature.
+       RANDOM=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c"1-5")
+    fi
+    TIME=$(($RANDOM % $RandomSleep))
+    sleep $TIME
+}
+
+# main
+
 if ! which apt-config >/dev/null; then
        exit 0
 fi
@@ -190,6 +209,14 @@ if [ -n "$admin_user" ] && [ -x /usr/bin/sudo ] && [ -z "$http_proxy" ]; then
        fi
 fi
 
+# sleep random amount of time
+random_sleep
+
+# check again if we can access the cache
+if ! apt-get check -q -q 2>/dev/null; then
+    exit 1
+fi
+
 UPDATE_STAMP=/var/lib/apt/periodic/update-stamp
 if check_stamp $UPDATE_STAMP $UpdateInterval; then
     # check for a new archive signing key (against the master keyring)
index dfde468..cb77555 100644 (file)
@@ -4,6 +4,8 @@ apt (0.7.9ubuntu12) hardy; urgency=low
     - use admin user proxy settings
   * cmdline/apt-get.cc:
     - fix task installation (thanks to Colin Watson)
+  * debian/apt.cron.daily:
+    - show update-notifier notification on authentication failure
 
  --