[23503] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r23148 - trunk/debathena/config/auto-update/debian

daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Sat Aug 16 19:29:16 2008

Date: Sat, 16 Aug 2008 19:28:45 -0400 (EDT)
From: ghudson@MIT.EDU
Message-Id: <200808162328.TAA01085@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: ghudson
Date: 2008-08-16 19:28:43 -0400 (Sat, 16 Aug 2008)
New Revision: 23148

Modified:
   trunk/debathena/config/auto-update/debian/athena-auto-update
   trunk/debathena/config/auto-update/debian/changelog
   trunk/debathena/config/auto-update/debian/debathena-auto-update.cron.d
Log:
In auto-update:
  * Improve diagnostic output for the log.
  * Remove the pid file when we are done.
  * Stop if aptitude update fails.
  * Set a path in the cron.d file so that it runs.


Modified: trunk/debathena/config/auto-update/debian/athena-auto-update
===================================================================
--- trunk/debathena/config/auto-update/debian/athena-auto-update	2008-08-16 06:27:25 UTC (rev 23147)
+++ trunk/debathena/config/auto-update/debian/athena-auto-update	2008-08-16 23:28:43 UTC (rev 23148)
@@ -15,7 +15,7 @@
 # Avoid confusing the system by running two updates at once.
 pidfile=/var/run/athena-update.pid
 if [ -e $pidfile ]; then
-  if ! kill -0 "$(cat $pidfile)"; then
+  if ! kill -0 "$(cat $pidfile)" 2>/dev/null; then
     rm -f $pidfile
   fi
 fi
@@ -26,16 +26,16 @@
 exec </dev/null >>/var/log/athena-update 2>&1
 
 echo "-----"
-echo "Beginning Athena auto-update at $(date)"
-echo
+echo "** Beginning Athena auto-update at $(date)"
 
-# Set up an exit handler to close out the log and remove any
-# /etc/nologin we might have written.
+# Set up an exit handler to close out the log, delete the pid file,
+# and remove any /etc/nologin we might have written.
 wrote_nologin=false
 finish() {
-    echo "Ending Athena auto-update at $(date)"
+    echo "** Ending Athena auto-update at $(date)"
     echo "-----"
     echo
+    rm -f $pidfile
     [ true = "$wrote_nologin" ] && rm -f /etc/nologin
     exit
 }
@@ -45,14 +45,19 @@
   logger -t "$(gethostname --fqdn)" -p user.notice "update: $1"
 }
 
+v() {
+  echo "** Running:" "$@"
+  "$@"
+}
+
 if [ cron = "$invoker" ]; then
-  files=$(ls /var/lib/gdm/*.Xservers >/dev/null)
+  files=$(ls /var/lib/gdm/*.Xservers 2>/dev/null)
   if [ -n "$files" ]; then
     # We don't want to perform auto-updates during a graphical login.
     # But we can download the packages to save time during the update.
-    echo "gdm login active, only downloading packages"
-    aptitude update
-    aptitude --download-only full-upgrade
+    echo "** gdm login active, only downloading packages"
+    v aptitude update || exit
+    v aptitude --download-only full-upgrade
     exit
   fi
 fi
@@ -73,26 +78,26 @@
   esac
 done
 if [ -z "$metapackage" ]; then
-  echo "Can't find an installed Debathena metapackage, exiting."
+  echo "** Can't find an installed Debathena metapackage, exiting."
   complain "no metapackage found"
   exit
 fi
-echo "Found metapackage $metapackage"
+echo "** Found metapackage $metapackage"
 
 # Perform the update.  In some corner cases, aptitude might decide
 # that the best course of action is to remove the Debathena
 # metapackage, so be paranoid about that.
-aptitude update
-aptitude keep-all
-aptitude --schedule-only --assume-yes dist-upgrade
-aptitude --schedule-only --assume-yes install "$metapackage"
+v aptitude update || exit
+v aptitude keep-all
+v aptitude --schedule-only --assume-yes dist-upgrade
+v aptitude --schedule-only --assume-yes install "$metapackage"
 result=$(aptitude search "~S~VTARGET~n^$metapackage\$")
 if [ -z "$result" ]; then
-  echo "$metapackage would be removed by the update, aborting"
-  aptitude keep-all
+  echo "** $metapackage would be removed by the update, aborting"
+  v aptitude keep-all
   complain "$metapackage would be removed by update"
   exit
 fi
-aptitude --assume-yes install
+v aptitude --assume-yes install
 
 exit

Modified: trunk/debathena/config/auto-update/debian/changelog
===================================================================
--- trunk/debathena/config/auto-update/debian/changelog	2008-08-16 06:27:25 UTC (rev 23147)
+++ trunk/debathena/config/auto-update/debian/changelog	2008-08-16 23:28:43 UTC (rev 23148)
@@ -1,3 +1,12 @@
+debathena-auto-update (1.1) unstable; urgency=low
+
+  * Improve diagnostic output for the log.
+  * Remove the pid file when we are done.
+  * Stop if aptitude update fails.
+  * Set a path in the cron.d file so that it runs.
+
+ -- Greg Hudson <ghudson@mit.edu>  Sat, 16 Aug 2008 19:28:38 -0400
+
 debathena-auto-update (1.0) unstable; urgency=low
 
   * Initial release.

Modified: trunk/debathena/config/auto-update/debian/debathena-auto-update.cron.d
===================================================================
--- trunk/debathena/config/auto-update/debian/debathena-auto-update.cron.d	2008-08-16 06:27:25 UTC (rev 23147)
+++ trunk/debathena/config/auto-update/debian/debathena-auto-update.cron.d	2008-08-16 23:28:43 UTC (rev 23148)
@@ -1,2 +1,5 @@
+SHELL=/bin/sh
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
 #min  hour  mday  mon  wday  user  command
 0,30  *     *     *    *     root  desync 1800; athena-auto-update cron


home help back first fref pref prev next nref lref last post