[27114] in Source-Commits

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

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

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Fri Apr 26 12:26:27 2013

Date: Fri, 26 Apr 2013 12:26:02 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201304261626.r3QGQ285025902@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2013-04-26 12:26:02 -0400 (Fri, 26 Apr 2013)
New Revision: 25955

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:
  * Provide a mechanism for reinstallation (Trac: #1305) and document it


Modified: trunk/debathena/config/auto-update/debian/athena-auto-upgrade
===================================================================
--- trunk/debathena/config/auto-update/debian/athena-auto-upgrade	2013-04-26 15:50:50 UTC (rev 25954)
+++ trunk/debathena/config/auto-update/debian/athena-auto-upgrade	2013-04-26 16:26:02 UTC (rev 25955)
@@ -158,6 +158,7 @@
 export CLUSTERINFO=$(getcluster -b $(lsb_release -sr))
 [ $? != 0 ] && complain "Failed to get clusterinfo" && exit 1
 eval $CLUSTERINFO
+REINSTALL=no
 if [ ! -z "$NEW_PRODUCTION_RELEASE" ]; then
     debug "Taking new production release: $NEW_PRODUCTION_RELEASE"
     NEWCLUSTER=`getcluster -b $NEW_PRODUCTION_RELEASE`
@@ -169,6 +170,19 @@
     NEWCLUSTER=`getcluster -b $NEW_TESTING_RELEASE`
     [ $? != 0 ] && complain "Failed to get clusterinfo" && exit 1
     eval $NEWCLUSTER
+elif [ ! -z "$REINSTALL_AT" ] && echo $REINSTALL_AT | grep -qx '[0-9]*'; then
+    debug "Found REINSTALL_AT = $REINSTALL_AT ..."
+    installtime=$(stat -c "%Y" /var/log/athena-install.log 2>/dev/null)
+    debug "Machine was last installed at $installtime"
+    if [ -z "$installtime" ]; then
+	echo "W: Could not stat /var/log/athena-install.log, forcing reinstall."
+	installtime=0
+    fi
+    if [ $installtime -lt $REINSTALL_AT ]; then
+	debug "$installtime less than $REINSTALL_AT, so reinstalling"
+	REINSTALL=yes
+	UBUNTU_RELEASE="$(lsb_release -sc)"
+    fi
 else
     if [[ ! -z "$DEBUG_RELEASE" ]]; then
         UBUNTU_RELEASE=$DEBUG_RELEASE
@@ -178,8 +192,10 @@
     fi
 fi
 if [ "$(lsb_release -sc)" = "$UBUNTU_RELEASE" ]; then
-    complain "Tried to upgrade to already running release; shouldn't happen"
-    exit 1
+    if [ "$REINSTALL" = "no" ]; then
+	complain "Tried to upgrade to already running release; shouldn't happen"
+	exit 1
+    fi
 fi
 echo "Found $UBUNTU_RELEASE, starting upgrade"
 

Modified: trunk/debathena/config/auto-update/debian/athena-auto-upgrade.8
===================================================================
--- trunk/debathena/config/auto-update/debian/athena-auto-upgrade.8	2013-04-26 15:50:50 UTC (rev 25954)
+++ trunk/debathena/config/auto-update/debian/athena-auto-upgrade.8	2013-04-26 16:26:02 UTC (rev 25955)
@@ -12,6 +12,11 @@
 for that version. If the upgrade fails prior to kexec, a message will
 be sent to the \fIuser\fP syslog facility, with priority \fInotice\fP.
 
+It will also reinstall the machine at the current version if the
+\fIreinstall_at\fP clusterinfo tag exists and its value is greater than
+the last mod time of /var/log/athena-install.log (in seconds since the
+epoch).
+
 You really don't want to run this by hand.
 
 .SH FEATURES

Modified: trunk/debathena/config/auto-update/debian/changelog
===================================================================
--- trunk/debathena/config/auto-update/debian/changelog	2013-04-26 15:50:50 UTC (rev 25954)
+++ trunk/debathena/config/auto-update/debian/changelog	2013-04-26 16:26:02 UTC (rev 25955)
@@ -1,8 +1,9 @@
 debathena-auto-update (1.43) unstable; urgency=low
 
   * Desupport auto-upgrades to anything older than precise
+  * Provide a mechanism for reinstallation (Trac: #1305) and document it
 
- -- Jonathan Reed <jdreed@mit.edu>  Mon, 01 Apr 2013 16:27:24 -0400
+ -- Jonathan Reed <jdreed@mit.edu>  Fri, 26 Apr 2013 12:21:10 -0400
 
 debathena-auto-update (1.42.2) unstable; urgency=low
 


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