[26947] in Source-Commits

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

/svn/athena r25845 - trunk/debathena/debathena/thirdparty/debian

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Fri Mar 8 11:44:28 2013

Date: Fri, 8 Mar 2013 11:44:21 -0500
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201303081644.r28GiLGQ013720@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2013-03-08 11:44:21 -0500 (Fri, 08 Mar 2013)
New Revision: 25845

Modified:
   trunk/debathena/debathena/thirdparty/debian/thirdparty
Log:
* Whitespace cleanup
* Make nologin file a variable
* Clearer error messages for the log
* Identify the case where the simulation succeeds, but the transaction
  fails, which indicates a more serious problem.


Modified: trunk/debathena/debathena/thirdparty/debian/thirdparty
===================================================================
--- trunk/debathena/debathena/thirdparty/debian/thirdparty	2013-03-07 22:59:53 UTC (rev 25844)
+++ trunk/debathena/debathena/thirdparty/debian/thirdparty	2013-03-08 16:44:21 UTC (rev 25845)
@@ -1,11 +1,14 @@
 #!/bin/sh
 #
-# debathena-thirdparty-installer 
+# debathena-thirdparty "installer"
+#
+# Consider "set -e" at some point
 
 LISTDIR=/var/lib/debathena-thirdparty
 LOG=/var/log/athena-thirdparty
 STATFILE=/var/lib/debathena-thirdparty/status
 FLAGFILE=/var/lib/debathena-thirdparty/update_required
+NOLOGIN=/var/run/athena-nologin
 
 status=ok
 statusmsg="Nothing to do"
@@ -21,7 +24,7 @@
 }
 	
 save_state() {
-    rm -f $statfile
+    rm -f $STATFILE
     echo "$status|$statusmsg" > $STATFILE
 }  
 
@@ -34,7 +37,7 @@
     echo "*Ending thirdparty installation at $(date)"
     echo "-----"
     echo
-    rm -f /var/run/athena-nologin
+    rm -f $NOLOGIN
     save_state
     exit
 }
@@ -47,16 +50,13 @@
 	return 0
     fi
 }
-	
 
-
-
 install() {
-    if [ 0 != "$(id -u)" ]; then
+    if [ "0" != "$(id -u)" ]; then
 	echo "Root privileges required for installation." >&2
 	exit 1
     fi
-    touch /var/run/athena-nologin
+    touch $NOLOGIN
     exec 3>&1
     exec >> $LOG 2>&1
     trap finish EXIT
@@ -65,16 +65,21 @@
     echo "** Required package list:"
     cat "${LISTDIR}/dependencies"
     echo "** Trying monolithic transaction..."
-    if should_install $(cat ${LISTDIR}/dependencies) &&
-	apt-get -y install $(cat ${LISTDIR}/dependencies); then
-	echo "**Monolithic transaction succeeded"
+    if should_install $(cat ${LISTDIR}/dependencies); then
+	echo "** Simulation successful, continuing..."
+	if apt-get -y install $(cat ${LISTDIR}/dependencies); then
+	    echo "** Monolithic transaction succeeded."
+	else
+	    echo "** Monolitic transaction failed (shouldn't happen)"
+	fi
     else
+	echo "** Simulation unsuccessful (would remove debathena packages)"
 	echo "** Installing required packages one by one..."
 	for pkg in $(cat "${LISTDIR}/dependencies"); do
 	    echo "** Installing $pkg..."
 	    if ! should_install $pkg; then
 		echo "** Installation of $pkg is IMPOSSIBLE"
-		complain "Some required packages failed to install"
+		complain "Some required packages are impossible to install"
 	    else
 		apt-get -y install $pkg
 		if [ $? != 0 ]; then
@@ -91,7 +96,7 @@
 	echo "** Installing $pkg..."
 	if ! should_install $pkg; then
 	    echo "** Installation of $pkg is IMPOSSIBLE"
-	    whine "Some optional packages failed to install"
+	    whine "Some optional packages are impossible to install"
 	else
 	    apt-get -y install $pkg
 	    if [ $? != 0 ]; then


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