[28456] in Source-Commits

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

installer commit: Convert debathena-loader.sh to debconf

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Sep 29 11:14:23 2014

Date: Mon, 29 Sep 2014 11:14:15 -0400
From: Jonathan D Reed <jdreed@mit.edu>
Message-Id: <201409291514.s8TFEF93010526@drugstore.mit.edu>
To: source-commits@mit.edu

https://github.com/mit-athena/installer/commit/b550b48a0b467d7e4360225ea32cf8be567489ce
commit b550b48a0b467d7e4360225ea32cf8be567489ce
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Fri Sep 26 17:29:52 2014 -0400

    Convert debathena-loader.sh to debconf
    
    Avoid switching to VT5 just to display an error message,
    instead write out our own template file and use debconf.

 pxe/stage1/debathena-loader.sh |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/pxe/stage1/debathena-loader.sh b/pxe/stage1/debathena-loader.sh
index 7d05a78..9c8f5e9 100644
--- a/pxe/stage1/debathena-loader.sh
+++ b/pxe/stage1/debathena-loader.sh
@@ -5,27 +5,41 @@
 # This will break if the .preseed and tarball are not in the same
 # location.  "Don't do that."
 
+# "Because debconf"
+chmod 755 $0
+
+. /usr/share/debconf/confmodule
+
 URI="$(debconf-get preseed/url | sed -e 's/debathena\.preseed$/debathena.tar.gz/')"
+LOGFILE="/var/log/debathena-loader.log"
 
 if [ -n "$URI" ]; then
     cd /
-    wget "$URI" > /dev/tty5 2>&1
-    tar xzf debathena.tar.gz > /dev/tty5 2>&1
+    echo "Retrieving $URI" >> "$LOGFILE"
+    wget "$URI" >> "$LOGFILE" 2>&1
+    echo "Extracting tarball" >> "$LOGFILE"
+    [ -f debathena.tar.gz ] && tar xzf debathena.tar.gz >> "$LOGFILE" 2>&1
+    echo "Executing installer.sh" >> "$LOGFILE"
     [ -x /debathena/installer.sh ] && exec /debathena/installer.sh
+    echo "Could not execute /debathena/installer.sh" >> $LOGFILE
 else
-    echo "Error: failed to retrieve preseed/url from debconf" > /dev/tty5
+    echo "Error: failed to retrieve preseed/url from debconf" >> $LOGFILE
 fi
-chvt 5
-cat <<EOF > /dev/tty5
-************************************************************************
-* If you are seeing this message, something went wrong.
-* Contact release-team@mit.edu and report this error message, as well as
-* any error messages you may see above this line.
 
-* You can reboot your computer now.  No changes were made to your
-* computer.
-************************************************************************
+cat <<EOF > /debathena-loader.templates
+Template: debathena-loader/ohnoes
+Type: note
+Description: Installation Aborted
+ Fatal error: debathena-loader.sh did not complete.
+ .
+ Log files can be found in $LOGFILE
+ .
+ This may indicate a network issue.  Please try again.
+ If the problem persists, please contact release-team@mit.edu.
 EOF
+db_x_loadtemplatefile /debathena-loader.templates debathena-loader
 while true; do
-    sh < /dev/tty5 > /dev/tty5 2>&1
+  db_title "Fatal Error"
+  db_input critical debathena-loader/ohnoes
+  db_go
 done

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