[25965] in Source-Commits

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

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

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Fri Jul 29 20:43:59 2011

Date: Fri, 29 Jul 2011 20:43:53 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201107300043.p6U0hrjI016754@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2011-07-29 20:43:53 -0400 (Fri, 29 Jul 2011)
New Revision: 25326

Modified:
   trunk/debathena/config/auto-update/debian/athena-auto-upgrade
   trunk/debathena/config/auto-update/debian/athena-auto-upgrade.8
   trunk/debathena/config/auto-update/debian/changelog
Log:
In auto-update:
  * Add some debugging and options to athena-auto-upgrade


Modified: trunk/debathena/config/auto-update/debian/athena-auto-upgrade
===================================================================
--- trunk/debathena/config/auto-update/debian/athena-auto-upgrade	2011-07-30 00:27:55 UTC (rev 25325)
+++ trunk/debathena/config/auto-update/debian/athena-auto-upgrade	2011-07-30 00:43:53 UTC (rev 25326)
@@ -14,12 +14,52 @@
     fi
 }
 
+maybe_quit() {
+    if [ $FORCE -eq 1 ]; then
+        echo "Would normally quit here, but you passed -f, so we keep going..."
+    else
+        exit 0
+    fi
+}
+
 DEBUG=0
 MAYBE=""
-if [ "$1" = "--debug" ]; then
-    DEBUG=1
-    MAYBE=echo
-else
+FORCE=0
+
+UPGRADE_TO_TESTING=no
+UPGRADE_ANYWAY=no
+[ -f /etc/default/debathena-auto-update ] && . /etc/default/debathena-auto-update
+
+while getopts "fdta" opt; do
+    case "$opt" in
+        d) 
+            DEBUG=1
+            MAYBE=echo
+	    UPGRADE_ANYWAY=yes
+            ;;
+        f) 
+            FORCE=1
+	    ;;
+        t)
+	    UPGRADE_TO_TESTING=yes
+	    ;;
+        \?)
+            echo "Usage: $0 [-d] [-t] [-f]"
+	    ;;
+    esac
+done
+
+if [ $DEBUG -eq 1 ] && [ $FORCE -eq 1 ]; then
+    echo "ERROR: -d and -f are mutually exclusive."
+    exit 2
+fi
+if [ $FORCE -eq 1 ]; then
+    echo "Using -f is a terrible idea.  Press Ctrl-C to reconsider and"
+    echo "save your machine, or Enter to continue."
+    read r
+fi
+
+if [ $DEBUG -ne 1 ]; then
     # Redirect output to a log file
     # Unless we're in debug mode
     exec >>/var/log/athena-upgrade 2>&1
@@ -27,16 +67,6 @@
 
 echo "Starting upgrade at $(date)"
 
-
-UPGRADE_TO_TESTING=no
-UPGRADE_ANYWAY=no
-[ -f /etc/default/debathena-auto-update ] && . /etc/default/debathena-auto-update
-
-if [ $DEBUG -eq 1 ]; then
-    UPGRADE_TO_TESTING=yes
-    UPGRADE_ANYWAY=yes
-fi
-
 # Not supported on Debian
 if [ "$(lsb_release -si)" != "Ubuntu" ]; then
     debug "Only supported on Ubuntu.".
@@ -60,13 +90,13 @@
 	if [ -n "$pids" ]; then
 	    debug "Users logged in, won't continue."
 	    debug "PIDs: $pids"
-            exit 0
+	    maybe_quit
 	fi
     done
     # screen processes count as logins.
     if pgrep '^screen' > /dev/null; then
 	debug "Screen processes found, won't continue."
-	exit 0
+	maybe_quit
     fi
 fi
 

Modified: trunk/debathena/config/auto-update/debian/athena-auto-upgrade.8
===================================================================
--- trunk/debathena/config/auto-update/debian/athena-auto-upgrade.8	2011-07-30 00:27:55 UTC (rev 25325)
+++ trunk/debathena/config/auto-update/debian/athena-auto-upgrade.8	2011-07-30 00:43:53 UTC (rev 25326)
@@ -3,7 +3,7 @@
 athena-auto-upgrade \- Attempt to automatically upgrade to a newer release of Ubuntu
 .SH SYNOPSIS
 .nf
-.B athena-auto-upgrade
+.B athena-auto-upgrade [ -f | -d ] [ -t ]
 .sp
 .SH DESCRIPTION
 .BR athena-auto-upgrade
@@ -17,9 +17,19 @@
 .SH FEATURES
 Here be dragons.
 
+.SH OPTIONS
+.IP -f
+Forces athena-auto-upgrade to reboot even if someone is logged in.
+Don't use this.
+.IP -t
+Causes athena-auto-upgrade to upgrade to a 'testing' release.  Don't
+use this.
+.IP -d
+Debug mode.  Will also force it to simulate an upgrade, even on
+non-cluster machines.
+
 .SH SEE ALSO
 getcluster(1), kexec(8)
 
 .SH AUTHOR
 SIPB Debathena Project (http://debathena.mit.edu)
-

Modified: trunk/debathena/config/auto-update/debian/changelog
===================================================================
--- trunk/debathena/config/auto-update/debian/changelog	2011-07-30 00:27:55 UTC (rev 25325)
+++ trunk/debathena/config/auto-update/debian/changelog	2011-07-30 00:43:53 UTC (rev 25326)
@@ -1,3 +1,9 @@
+debathena-auto-update (1.26) unstable; urgency=low
+
+  * Add some debugging and options to athena-auto-upgrade
+  
+ -- Jonathan Reed <jdreed@mit.edu>  Fri, 29 Jul 2011 20:43:47 -0400
+
 debathena-auto-update (1.25) unstable; urgency=low
 
   * Use the aptitude search predicate for removed packages, instead of


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