[28452] in Source-Commits

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

installer commit: Don't hardcode IP/URL in debathena-loader.sh

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

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

https://github.com/mit-athena/installer/commit/91007fc5d41e4592fdedc948240bc53d0371c6e6
commit 91007fc5d41e4592fdedc948240bc53d0371c6e6
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Fri Sep 26 17:33:22 2014 -0400

    Don't hardcode IP/URL in debathena-loader.sh
    
    Tweak debathena-loader.sh to get the URI of the preseed file and
    transform it to the URL of the tarball, rather than hardcoding the IP
    in yet another place.  This facilitates testing from other servers or
    paths.

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

diff --git a/pxe/stage1/debathena-loader.sh b/pxe/stage1/debathena-loader.sh
index 8e52c89..7d05a78 100644
--- a/pxe/stage1/debathena-loader.sh
+++ b/pxe/stage1/debathena-loader.sh
@@ -1,14 +1,31 @@
 #!/bin/sh
 
-# This could probably all just go in the preseed file, but what a mess!
-# 18.9.60.73 = athena10.mit.edu (formerly 18.92.2.195)
+# To minimize the number of places we hardcode things, we use the
+# preseed URL to figure out where to get the tarball from.
+# This will break if the .preseed and tarball are not in the same
+# location.  "Don't do that."
 
-cd /
-wget http://18.9.60.73/installer/stage1/debathena.tar.gz > /dev/tty5 2>&1
-tar xzf debathena.tar.gz
+URI="$(debconf-get preseed/url | sed -e 's/debathena\.preseed$/debathena.tar.gz/')"
+
+if [ -n "$URI" ]; then
+    cd /
+    wget "$URI" > /dev/tty5 2>&1
+    tar xzf debathena.tar.gz > /dev/tty5 2>&1
+    [ -x /debathena/installer.sh ] && exec /debathena/installer.sh
+else
+    echo "Error: failed to retrieve preseed/url from debconf" > /dev/tty5
+fi
 chvt 5
-sh debathena/installer.sh < /dev/tty5 > /dev/tty5 2>&1
-# We will in theory always kexec out before this point
-chvt 1
-# Pick up the generated preseed file (if any):
-echo file://debathena/preseed
+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.
+************************************************************************
+EOF
+while true; do
+    sh < /dev/tty5 > /dev/tty5 2>&1
+done

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