[25668] in Source-Commits
/svn/athena r25155 - in trunk/debathena/scripts/installer/pxe: . lucid/debathena natty/debathena stage1 stage1/debathena stage1/debathena/athena
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Wed Jun 22 20:27:39 2011
Date: Wed, 22 Jun 2011 20:27:33 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201106230027.p5N0RXLI000612@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-06-22 20:27:33 -0400 (Wed, 22 Jun 2011)
New Revision: 25155
Added:
trunk/debathena/scripts/installer/pxe/stage1/
trunk/debathena/scripts/installer/pxe/stage1/Makefile
trunk/debathena/scripts/installer/pxe/stage1/debathena-loader.sh
trunk/debathena/scripts/installer/pxe/stage1/debathena.preseed
trunk/debathena/scripts/installer/pxe/stage1/debathena/
trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/
trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/masks
trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/netparams
trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
Modified:
trunk/debathena/scripts/installer/pxe/lucid/debathena/preseed.autoinstall
trunk/debathena/scripts/installer/pxe/natty/debathena/installer.sh
trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.common
Log:
* Add new stage1 bootstrapper (previously done by the jaunty installer)
* Make natty stage2 noninteractive
* Change typo in lucid installer which had wrong path to partman recipe
Modified: trunk/debathena/scripts/installer/pxe/lucid/debathena/preseed.autoinstall
===================================================================
--- trunk/debathena/scripts/installer/pxe/lucid/debathena/preseed.autoinstall 2011-06-22 16:24:02 UTC (rev 25154)
+++ trunk/debathena/scripts/installer/pxe/lucid/debathena/preseed.autoinstall 2011-06-23 00:27:33 UTC (rev 25155)
@@ -57,7 +57,7 @@
# The recipe format is documented in the file devel/partman-auto-recipe.txt.
# If you have a way to get a recipe file into the d-i environment, you can
# just point at it.
-d-i partman-auto/expert_recipe_file string /debathena-lucid/lvm-cluster-machine.partman
+d-i partman-auto/expert_recipe_file string /debathena/lvm-cluster-machine.partman
# This is completely undocumented. Sigh.
d-i partman-auto-lvm/new_vg_name string athena
# As reported in Trac #253
Modified: trunk/debathena/scripts/installer/pxe/natty/debathena/installer.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/installer.sh 2011-06-22 16:24:02 UTC (rev 25154)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/installer.sh 2011-06-23 00:27:33 UTC (rev 25155)
@@ -13,12 +13,20 @@
# new options:
# debathena/pxetype: could be cluster, but could be other things
-clusterforce=`sed -e 's/ /\n/g' < /proc/cmdline | grep debathena/clusterforce | sed -e 's/.*=//'`
+# Don't support this anymore
+#clusterforce=`sed -e 's/ /\n/g' < /proc/cmdline | grep debathena/clusterforce | sed -e 's/.*=//'`
clusteraddr=`sed -e 's/ /\n/g' < /proc/cmdline | grep debathena/clusteraddr | sed -e 's/.*=//'`
pxetype=`sed -e 's/ /\n/g' < /proc/cmdline | grep debathena/pxetype | sed -e 's/.*=//'`
+installertype=`sed -e 's/ /\n/g' < /proc/cmdline | grep debathena/i= | sed -e 's/.*=//'`
+mirrorsite=`sed -e 's/ /\n/g' < /proc/cmdline | grep debathena/m= | sed -e 's/.*=//'`
+echo "Picked up values from command line:
+clusteraddr=$clusteraddr
+pxetype=$pxetype
+installertype=$installertype
+mirrorsite=$mirrorsite"
+
if [ "$clusteraddr" ] ; then IPADDR=$clusteraddr ; fi
-if [ "$clusteraddr" -a "$clusterforce" = yes -a -z "$pxetype" ] ; then pxetype=cluster ; fi
netconfig () {
echo "Configuring network..."
@@ -81,89 +89,6 @@
ddb="${esc}[1;31;47;5m" # Plus blinking
-mirrorsite="mirrors.mit.edu"
-installertype="production"
-suite="lucid"
-
-echo "Welcome to Athena."
-echo
-
-while [ -z "$pxetype" ] ; do
- echo "Will install $suite using $installertype installer and $mirrorsite"
- echo
- echo "Choose one:"
- echo
- echo " 1: Perform an unattended ${ccc}debathena-cluster${nnn} install, ${rrr}ERASING your"
- echo " ENTIRE DISK${nnn}. This option is only intended for people setting up"
- echo " public cluster machines maintained by IS&T/Athena. "
- echo
- echo " 2: Do a ${ccc}normal Debathena install${nnn}. You'll need to answer normal Ubuntu"
- echo " install prompts, and then the Athena-specific prompts, including"
- echo " choosing which flavor of Debathena you'd like (e.g., private workstation)."
- echo
- echo " 3: Punt to a completely ${ccc}vanilla install of Ubuntu 10.04${nnn} (Lucid Lynx)."
- echo " (Note: locale and keyboard have already been set.)"
- echo
- echo " 4: /bin/sh (for rescue purposes)"
- echo
- echo " Advanced users only:"
- echo " m: Select a different mirror. "
- echo " b: Toggle between beta and production installer. "
- echo " s: Change the suite (version)."
- echo
- echo -n "Choose: "
- read r
- case "$r" in
- 1)
- echo "Debathena CLUSTER it is."; pxetype=cluster ;;
- 1b)
- # This too.
- echo "Debathena CLUSTER it is."; pxetype=cluster
- echo "...but you get to partition by hand. Your hard disk"
- echo "will not be automatically reformatted."; destroys=notreally
- echo
- echo "The default cluster installer sets up:"
- echo " - a 200MB ext3 /boot partition"
- echo " - an LVM volume group named 'athena', containing"
- echo " - a (3x system RAM)-sized swap LV (at least 512 MB)"
- echo " - a root LV taking up half the remaining space (at least 10 GB)"
- echo
- echo "You probably want to set up something similar."
- echo "Press enter to continue."
- read r;;
- 2)
- echo "Normal Debathena install it is."; pxetype=choose ;;
- 3)
- echo "Vanilla Ubuntu it is."; pxetype=vanilla;;
- 4)
- echo "Here's a shell. You'll return to this prompt when done."
- /bin/sh;;
- m|M)
- echo
- echo "NOTE: There is no data validation. Don't make a typo."
- echo -n "Enter a new mirror hostname: "
- read mirrorsite
- s|S)
- echo
- echo "NOTE: There is no data validation. Don't make a typo."
- echo -n "Enter a new suite: "
- read suite
- b|B)
- if [ "$installertype" = "production" ]; then
- echo "Switching to beta installer."
- installertype="beta"
- else
- echo "Switching to production installer."
- installertype="production"
- fi
- *)
- echo "Choose one of the above, please.";;
- esac
-done
-
-##############################################################################
-
-
# Consider setting a static IP address, especially if we can't reach the mirror.
if [ cluster != $pxetype ]; then
# We're at a point in the install process where we can be fairly sure
@@ -241,7 +166,6 @@
# Perferred hostname of mirror site
cat >> preseed <<EOF
-d-i mirror/suite string $suite
d-i apt-setup/hostname string $mirrorsite
d-i mirror/http/hostname string $mirrorsite
EOF
Modified: trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.common
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.common 2011-06-22 16:24:02 UTC (rev 25154)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.common 2011-06-23 00:27:33 UTC (rev 25155)
@@ -7,8 +7,8 @@
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
-# Suite to install. (Now set in installer)
-#d-i mirror/suite string natty
+# Suite to install.
+d-i mirror/suite string natty
# Suite to use for loading installer components (optional).
#d-i mirror/udeb/suite string intrepid
# Components to use for loading installer components (optional).
Added: trunk/debathena/scripts/installer/pxe/stage1/Makefile
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/Makefile (rev 0)
+++ trunk/debathena/scripts/installer/pxe/stage1/Makefile 2011-06-23 00:27:33 UTC (rev 25155)
@@ -0,0 +1,11 @@
+# This is pretty dangerous in a bunch of ways. Approach with caution.
+d=/afs/athena.mit.edu/system/athena10/installer/stage1
+
+default:
+ : Use "make install" to move this from where the installer will fetch it.
+
+install: ${d}/debathena.tar.gz
+
+${d}/debathena.tar.gz: debathena.preseed debathena-loader.sh debathena
+ tar czvf ${d}/debathena.tar.gz --exclude "*~" --exclude "*/.svn*" debathena
+ cp debathena.preseed debathena-loader.sh ${d}
Added: trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/masks
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/masks (rev 0)
+++ trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/masks 2011-06-23 00:27:33 UTC (rev 25155)
@@ -0,0 +1,90 @@
+# $Id: masks,v 1.7 2004/03/20 11:38:17 zacheiss Exp $
+
+# This file specifies the netmasks for each network supported by the
+# Athena environment. The format for lines in the file is:
+#
+# address significant-bits netmask-bits [gateway]
+#
+# The number of netmask bits for a given IP address is the value of
+# <netmask-bits> on the first line for which <address> matches the
+# first <significant-bits> bits of the given address. If a gateway
+# is not given, the gateway is assumed to be one greater than the
+# network address.
+#
+# The contents of this file are maintained by Athena release
+# engineering. If you edit this file on your workstation, it will be
+# replaced at the next update and your changes will be lost. If you
+# have local changes to make, create or add to
+# /etc/athena/masks.local, which has the same file format as this
+# file. Entries in /etc/athena/masks.local take precedence over
+# entries in this file.
+#
+# The shell script /etc/athena/netparams uses this file to compute the
+# network, broadcast, and gateway address for a given IP address. See
+# the comments at the top of that file for usage information.
+
+# Most MITnet addresses begin with "18" and have a 16-bit netmask.
+# 18.7 is being used in IS machine rooms with a 24-bit netmask.
+# At least parts of 18.7.1 are being used as /30s for servers that
+# don't like to have their IP address changed.
+# Bits of LCS also have a 24-bit netmask, according to
+# wollman@lcs.mit.edu, 1/12/98.
+# 18.101 is being used for IS internal experiments, with a 28 bit netmask.
+18.7.1.0 24 30
+18.7.0.0 16 24
+18.24.0.0 16 24
+18.26.0.0 16 24
+18.101.0.0 16 28
+18.0.0.0 8 16
+
+# WHOI has a class B subnetted to 22 bits. 128.128.16 has a funny
+# gateway address.
+128.128.16.0 22 22 128.128.16.7
+128.128.0.0 16 22
+
+# More AI Lab configuration, from foley, 1/24/03
+128.52.29.0 24 24 128.52.29.10
+# AI lab configuration, from bruce@ai.mit.edu, 1/12/98
+128.52.32.0 24 24 128.52.32.10
+128.52.37.0 24 24 128.52.37.10
+128.52.38.0 24 24 128.52.38.10
+128.52.39.0 24 24 128.52.39.10
+128.52.54.0 24 24 128.52.54.10
+
+# Stata Center configuration, see http://tig.csail.mit.edu/stata-net.html
+128.30.0.0 25 25
+128.30.0.192 27 27
+128.30.0.244 30 30
+128.30.0.248 30 30
+128.30.0.252 30 30
+128.30.2.0 24 24
+128.30.3.0 24 24
+128.30.4.0 23 23
+128.30.6.0 23 23
+128.30.16.0 20 24
+128.30.32.0 22 22
+128.30.36.0 24 24
+128.30.40.0 22 22
+128.30.44.0 24 24
+128.30.48.0 22 22
+128.30.52.0 22 22
+128.30.56.0 22 22
+128.30.60.0 24 24
+128.30.64.0 22 22
+128.30.72.0 22 22
+128.30.76.0 22 22
+128.30.80.0 22 22
+128.30.84.0 24 24
+128.30.86.0 24 24
+128.30.88.0 22 22
+128.30.92.0 24 24
+128.30.96.0 22 22
+128.30.100.0 24 24
+128.30.104.0 22 22
+128.30.108.0 24 24
+128.31.0.0 24 24
+128.31.1.0 24 24
+128.31.4.0 22 22
+128.31.8.0 22 22
+128.31.16.0 24 24
+192.12.11.0 24 24
Added: trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/netparams
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/netparams (rev 0)
+++ trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/netparams 2011-06-23 00:27:33 UTC (rev 25155)
@@ -0,0 +1,261 @@
+#!/bin/sh
+# $Id: netparams.sh,v 1.2 1998/05/17 03:25:03 ghudson Exp $
+
+# Usage: netparams [-d defaultbits] [-e] [-f file] address ...
+#
+# Computes the netmask for each address and outputs the netmask,
+# network, broadcast address, and gateway address. Options are:
+#
+# -d defaultbits Give the default number of bits to use if an
+# IP address is not located on the file. The
+# default is 24.
+#
+# -e Error if an IP address is not located in the
+# file.
+#
+# -f file Give the masks filename to use. The default
+# is the concatenation of /etc/athena/masks.local
+# (if it exists) and /etc/athena/masks.
+#
+# The format of each line of the masks file is:
+#
+# address significant-bits mask-bits [gateway]
+#
+# The first <significant-bits> of <address> are compared against the
+# given IP address. If they match, <mask-bits> is the number of bits
+# in the netmask, and <gateway> is the gateway address if given. (If
+# gateway is not given, it is assumed to be one greater than the
+# network address.) The first match in the file is taken. Blank lines
+# and lines beginning with a '#' are ignored.
+
+# This script may want to run before /usr is mounted on BSD-ish
+# systems, so it uses a very limited set of external commands (expr,
+# test, echo). If you want to use a command not in that set, make
+# sure it lives in /bin or /sbin in BSD 4.4.
+
+# Regular expression to match things that looklike IP addresss.
+ipreg='[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$'
+
+# Usage message
+usage="$0 [-f file] [-d defaultbits] [-e] address ..."
+
+# octet <ip address> sets o1..o4 to the octets of the address.
+octets() {
+ OLDIFS="$IFS"
+ IFS=.
+ set -- $1
+ o1=$1 o2=$2 o3=$3 o4=$4
+ IFS="$OLDIFS"
+}
+
+# octetbits <n> splits <n> up into four values b1..b4 each between 0
+# and 8. If you want the first n bits of a 32-bit value, then you
+# want the first b1..b4 bits of the corresponding octets.
+octetbits() {
+ case "$1" in
+ 0) b1=0; b2=0; b3=0; b4=0 ;;
+ 1) b1=1; b2=0; b3=0; b4=0 ;;
+ 2) b1=2; b2=0; b3=0; b4=0 ;;
+ 3) b1=3; b2=0; b3=0; b4=0 ;;
+ 4) b1=4; b2=0; b3=0; b4=0 ;;
+ 5) b1=5; b2=0; b3=0; b4=0 ;;
+ 6) b1=6; b2=0; b3=0; b4=0 ;;
+ 7) b1=7; b2=0; b3=0; b4=0 ;;
+ 8) b1=8; b2=0; b3=0; b4=0 ;;
+ 9) b1=8; b2=1; b3=0; b4=0 ;;
+ 10) b1=8; b2=2; b3=0; b4=0 ;;
+ 11) b1=8; b2=3; b3=0; b4=0 ;;
+ 12) b1=8; b2=4; b3=0; b4=0 ;;
+ 13) b1=8; b2=5; b3=0; b4=0 ;;
+ 14) b1=8; b2=6; b3=0; b4=0 ;;
+ 15) b1=8; b2=7; b3=0; b4=0 ;;
+ 16) b1=8; b2=8; b3=0; b4=0 ;;
+ 17) b1=8; b2=8; b3=1; b4=0 ;;
+ 18) b1=8; b2=8; b3=2; b4=0 ;;
+ 19) b1=8; b2=8; b3=3; b4=0 ;;
+ 20) b1=8; b2=8; b3=4; b4=0 ;;
+ 21) b1=8; b2=8; b3=5; b4=0 ;;
+ 22) b1=8; b2=8; b3=6; b4=0 ;;
+ 23) b1=8; b2=8; b3=7; b4=0 ;;
+ 24) b1=8; b2=8; b3=8; b4=0 ;;
+ 25) b1=8; b2=8; b3=8; b4=1 ;;
+ 26) b1=8; b2=8; b3=8; b4=2 ;;
+ 27) b1=8; b2=8; b3=8; b4=3 ;;
+ 28) b1=8; b2=8; b3=8; b4=4 ;;
+ 29) b1=8; b2=8; b3=8; b4=5 ;;
+ 30) b1=8; b2=8; b3=8; b4=6 ;;
+ 31) b1=8; b2=8; b3=8; b4=7 ;;
+ 32) b1=8; b2=8; b3=8; b4=8 ;;
+ esac
+}
+
+# mask8 <o> <b> sets a8 to the first <b> bits of <o>.
+mask8() {
+ case "$2" in
+ 0) a8=0 ;;
+ 1) a8=`expr "$1" - "$1" % 128` ;;
+ 2) a8=`expr "$1" - "$1" % 64` ;;
+ 3) a8=`expr "$1" - "$1" % 32` ;;
+ 4) a8=`expr "$1" - "$1" % 16` ;;
+ 5) a8=`expr "$1" - "$1" % 8` ;;
+ 6) a8=`expr "$1" - "$1" % 4` ;;
+ 7) a8=`expr "$1" - "$1" % 2` ;;
+ 8) a8=$1 ;;
+ esac
+}
+
+# fill8 <o> <b> sets a8 to <o> with the last 8-<b> bits set to 1.
+fill8() {
+ case "$2" in
+ 0) a8=255 ;;
+ 1) a8=`expr "$1" - "$1" % 128 + 127` ;;
+ 2) a8=`expr "$1" - "$1" % 64 + 63` ;;
+ 3) a8=`expr "$1" - "$1" % 32 + 31` ;;
+ 4) a8=`expr "$1" - "$1" % 16 + 15` ;;
+ 5) a8=`expr "$1" - "$1" % 8 + 7` ;;
+ 6) a8=`expr "$1" - "$1" % 4 + 3` ;;
+ 7) a8=`expr "$1" - "$1" % 2 + 1` ;;
+ 8) a8=$1 ;;
+ esac
+}
+
+# mask <ip address> <n> sets a to the first <n> bits of <ip address>.
+# If a third parameter is given, add 1 to the last octet (to get the
+# gateway address).
+mask() {
+ a=""
+ octets "$1"
+ octetbits "$2"
+ mask8 "$o1" "$b1"
+ a=$a8
+ mask8 "$o2" "$b2"
+ a=$a.$a8
+ mask8 "$o3" "$b3"
+ a=$a.$a8
+ mask8 "$o4" "$b4"
+ if [ -n "$3" ]; then
+ a8=`expr "$a8" + 1`
+ fi
+ a=$a.$a8
+}
+
+# fill <ip address> <n> sets a to <ip address> with the last 32-<n> bits
+# set to 1.
+fill() {
+ a=""
+ octets "$1"
+ octetbits "$2"
+ fill8 "$o1" "$b1"
+ a=$a8
+ fill8 "$o2" "$b2"
+ a=$a.$a8
+ fill8 "$o3" "$b3"
+ a=$a.$a8
+ fill8 "$o4" "$b4"
+ a=$a.$a8
+}
+
+# getnetmask <ip address> <file> sets maskbits to the number of netmask
+# bits for <ip address> according to <file>. Also sets gateway to the
+# gateway field on the matching line, if one was specified.
+getnetmask() {
+ exec < $2
+ maskbits=""
+ while read addr sigbits mbits gw; do
+ # Ignore blank lines and comments.
+ if [ -z "$addr" -o `expr "$addr" : '#'` -ne 0 ]; then
+ continue
+ fi
+
+ # Make sure the line is in the proper form.
+ if [ `expr "$addr" : "$ipreg"` -eq 0 \
+ -o `expr "$sigbits" : '[0-9][0-9]*$'` -eq 0 \
+ -o `expr "$mbits" : '[0-9][0-9]*$'` -eq 0 ]; then
+ echo "Bad line in $2: $addr $sigbits $mbits $gw" 1>&2
+ exit 1
+ fi
+ if [ -n "$gw" -a `expr "$gw" : "$ipreg"` -eq 0 ]; then
+ echo "Bad gateway in $2: $gw" 1>&2
+ exit 1
+ fi
+
+ mask "$1" "$sigbits"
+ if [ "$a" = "$addr" ]; then
+ maskbits=$mbits
+ gateway=$gw
+ break
+ fi
+ done
+}
+
+# Process arguments.
+defaultbits=24
+errornf=false
+maskfile=""
+while getopts d:ef: opt; do
+ case "$opt" in
+ d)
+ defaultbits=$OPTARG
+ ;;
+ e)
+ errornf=true
+ ;;
+ f)
+ maskfile=$OPTARG
+ ;;
+ \?)
+ echo "$usage"
+ exit 1
+ ;;
+ esac
+done
+shift `expr $OPTIND - 1`
+
+# Make sure we have some addresses.
+if [ $# -eq 0 ]; then
+ echo "Usage: $0 ip-address ..." 1>&2
+ exit 1
+fi
+
+# Make sure our addresses are in something like the proper format.
+for ip in "$@"; do
+ if [ `expr "$ip" : "$ipreg"` -eq 0 ]; then
+ echo "Bad address: $ip" 1>&2
+ echo "Usage: $0 ip-address ..." 1>&2
+ exit 1
+ fi
+done
+
+for ip in "$@"; do
+ if [ -n "$maskfile" ]; then
+ getnetmask "$ip" "$maskfile"
+ elif [ -f /etc/athena/masks.local ]; then
+ getnetmask "$ip" /etc/athena/masks.local
+ if [ -z "$maskbits" ]; then
+ getnetmask "$ip" /etc/athena/masks
+ fi
+ else
+ getnetmask "$ip" /etc/athena/masks
+ fi
+ if [ -z "$maskbits" ]; then
+ # Error out if we were told to, or guess.
+ if [ "$errornf" = true ]; then
+ echo "$ip not matched." 1>&2
+ exit 1
+ fi
+ maskbits=$defaultbits
+ fi
+
+ mask 255.255.255.255 "$maskbits"
+ netmask=$a
+ mask "$ip" "$maskbits"
+ network=$a
+ fill "$ip" "$maskbits"
+ broadcast=$a
+ if [ -z "$gateway" ]; then
+ mask "$ip" "$maskbits" 1
+ gateway=$a
+ fi
+
+ echo "$netmask $network $broadcast $gateway $maskbits"
+done
Property changes on: trunk/debathena/scripts/installer/pxe/stage1/debathena/athena/netparams
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh 2011-06-23 00:27:33 UTC (rev 25155)
@@ -0,0 +1,265 @@
+#!/bin/sh
+
+test=
+if [ "$1" = "--test" ]; then
+ test="test"
+ echo "** TESTING MODE"
+fi
+
+if [ "$test" != "test" ]; then
+ cd /debathena
+fi
+
+pxetype=""
+
+netconfig () {
+ echo "Configuring network..."
+ mp=/debathena
+ if [ "$test" = "test" ]; then
+ mp="`dirname $0`/$mp"
+ fi
+ export IPADDR NETMASK GATEWAY SYSTEM CONTROL
+ while [ -z "$IPADDR" ] ; do
+ echo -n "Enter IP address: "
+ read IPADDR
+ done
+ NETMASK=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\ -f 1`
+ net=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\ -f 2`
+ bc=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\ -f 3`
+ GATEWAY=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\ -f 4`
+ maskbits=`$mp/athena/netparams -f $mp/athena/masks $IPADDR|cut -d\ -f 5`
+
+ echo "Address: $IPADDR"
+ echo
+ echo "Autoconfigured settings:"
+ echo " Netmask bits: $maskbits"
+ echo " Broadcast: $bc"
+ echo " Gateway: $GATEWAY"
+
+ if [ "$pxetype" != cluster ] ; then
+ echo -n "Are these OK? [Y/n]: "; read response
+ case $response in
+ y|Y|"") ;;
+ *)
+ echo -n "Netmask bits [$maskbits]: "; read r; if [ "$r" ] ; then maskbits=$r ; fi
+ echo -n "Broadcast [$bc]: "; read r; if [ "$r" ] ; then bc=$r ; fi
+ echo -n "Gateway [$GATEWAY]: "; read r; if [ "$r" ] ; then GATEWAY=$r ; fi
+ esac
+ fi
+
+ if [ "$test" != "test" ]; then
+ # We can not set the hostname here; running "debconf-set netcfg/get_hostname"
+ # causes fatal reentry problems. Setting values directly with preseeding
+ # also fails, as the DHCP values override it.
+ echo "Killing dhcp client."
+ killall dhclient
+ echo "Running: ip addr flush dev eth0"
+ ip addr flush dev eth0
+ echo "Running: ip addr add $IPADDR/$maskbits broadcast $bc dev eth0"
+ ip addr add $IPADDR/$maskbits broadcast $bc dev eth0
+ echo "Flushing old default route."
+ route delete default 2> /dev/null
+ echo "Running: route add default gw $GATEWAY"
+ route add default gw $GATEWAY
+ echo "Replacing installer DHCP nameserver with MIT nameservers."
+ sed -e '/nameserver/s/ .*/ 18.72.0.3/' < /etc/resolv.conf > /etc/resolv.conf.new
+ echo "nameserver 18.70.0.160" >> /etc/resolv.conf.new
+ echo "nameserver 18.71.0.151" >> /etc/resolv.conf.new
+ mv -f /etc/resolv.conf.new /etc/resolv.conf
+ fi
+}
+
+# Color strings. I'd like to use tput, but the installer doesn't have it.
+esc=""
+nnn="${esc}[m" # Normal
+ccc="${esc}[36m" # Cyan
+rrr="${esc}[1;31m" # Bold and red
+ddd="${esc}[1;31;47m" # Plus gray background
+ddb="${esc}[1;31;47;5m" # Plus blinking
+
+
+mirrorsite="mirrors.mit.edu"
+installertype="production"
+distro="lucid"
+arch="i386"
+# That is a space and a tab
+if egrep -q '^flags[ ].* lm( |$)' /proc/cpuinfo; then
+ arch="amd64"
+fi
+
+
+echo "Welcome to Athena."
+echo
+
+while [ -z "$pxetype" ] ; do
+ echo "Will install $distro ($arch) using $installertype installer and $mirrorsite"
+ echo
+ echo "Choose one:"
+ echo
+ echo " 1: Perform an unattended ${ccc}debathena-cluster${nnn} install, ${rrr}ERASING your"
+ echo " ENTIRE DISK${nnn}. This option is only intended for people setting up"
+ echo " public cluster machines maintained by IS&T/Athena. "
+ echo
+ echo " 2: Do a ${ccc}normal Debathena install${nnn}. You'll need to answer normal Ubuntu"
+ echo " install prompts, and then the Athena-specific prompts, including"
+ echo " choosing which flavor of Debathena you'd like (e.g., private workstation)."
+ echo
+ echo " 3: Punt to a completely ${ccc}vanilla install of Ubuntu 10.04${nnn} (Lucid Lynx)."
+ echo " (Note: locale and keyboard have already been set.)"
+ echo
+ echo " 4: /bin/sh (for rescue purposes)"
+ echo
+ echo " Advanced users only:"
+ echo " m: Select a different mirror. "
+ echo " b: Toggle between beta and production installer. "
+ echo " s: Change the distro (version)."
+ echo " a: Change architecture."
+ echo
+ echo -n "Choose: "
+ read r
+ case "$r" in
+ 1)
+ echo "Debathena CLUSTER it is."; pxetype=cluster ;;
+ 1b)
+ # This too.
+ echo "Debathena CLUSTER it is."; pxetype=cluster
+ echo "...but you get to partition by hand. Your hard disk"
+ echo "will not be automatically reformatted."; destroys=notreally
+ echo
+ echo "The default cluster installer sets up:"
+ echo " - a 200MB ext3 /boot partition"
+ echo " - an LVM volume group named 'athena', containing"
+ echo " - a (3x system RAM)-sized swap LV (at least 512 MB)"
+ echo " - a root LV taking up half the remaining space (at least 10 GB)"
+ echo
+ echo "You probably want to set up something similar."
+ echo "Press enter to continue."
+ read r;;
+ 2)
+ echo "Normal Debathena install it is."; pxetype=choose ;;
+ 3)
+ echo "Vanilla Ubuntu it is."; pxetype=vanilla;;
+ 4)
+ echo "Here's a shell. You'll return to this prompt when done."
+ /bin/sh;;
+ m|M)
+ echo
+ echo "NOTE: There is no data validation. Don't make a typo."
+ echo -n "Enter a new mirror hostname: "
+ read mirrorsite
+ ;;
+ s|S)
+ echo
+ echo "NOTE: There is no data validation. Don't make a typo."
+ echo -n "Enter a new distro: "
+ read distro
+ ;;
+ b|B)
+ if [ "$installertype" = "production" ]; then
+ echo "Switching to beta installer."
+ installertype="beta"
+ else
+ echo "Switching to production installer."
+ installertype="production"
+ fi
+ ;;
+ a|A)
+ echo
+ oldarch="$arch"
+ echo -n "Enter a new arch (acceptable values: i386, amd64): "
+ read arch
+ if [ "$arch" != "i386" ] && [ "$arch" != "amd64" ]; then
+ echo "Invalid value. Reverting to $arch."
+ arch="$oldarch"
+ fi
+ unset oldarch
+ ;;
+ *)
+ echo "Choose one of the above, please.";;
+ esac
+done
+
+##############################################################################
+
+
+# Consider setting a static IP address, especially if we can't reach the mirror.
+if [ cluster != $pxetype ]; then
+ # We're at a point in the install process where we can be fairly sure
+ # that nothing else is happening, so "killall wget" should be safe.
+ (sleep 5; killall wget >/dev/null 2>&1) &
+ if wget -s http://$mirrorsite/ubuntu ; then
+ if ip address show to 18.0.0.0/8 | grep -q . && ! ip address show to 18.2.0.0/16 | grep -q . ; then
+ echo "Your computer seems to be registered on MITnet."
+ else
+ echo "Your computer seems not to be registered on MITnet, but the mirror"
+ echo "site $mirrorsite is accessible."
+ fi
+ echo
+ echo "${ccc}You can continue the install using your existing dynamic address.${nnn}"
+ echo -n "Configure a static address anyway? [y/N]: "
+ while : ; do
+ read r
+ case "$r" in
+ N*|n*|"") break;;
+ y*|Y*) netconfig; break;;
+ esac
+ echo -n "Choose: [y/N]: "
+ done
+ else
+ echo "The mirror site $mirrorsite is NOT accessible in your current"
+ echo "dynamic configuration."
+ echo
+ echo "${rrr}You must specify a static address for the installation.${nnn}"
+ netconfig
+ fi
+else
+ netconfig
+fi
+
+# Fetch secondary (real) installer, invoking as specified above:
+
+echo "Fetching next installer phase..."
+# Network config now done above.
+if [ "$test" != "test" ]; then
+ mkdir /h; cd /h
+ wget http://debathena.mit.edu/net-install/kexec
+ wget http://debathena.mit.edu/net-install/lucid/${arch}/initrd.gz
+ wget http://debathena.mit.edu/net-install/lucid/${arch}/linux
+ chmod 755 kexec
+fi
+dkargs="DEBCONF_DEBUG=5"
+
+hname=install-target-host
+if [ "$IPADDR" = dhcp ] ; then
+ knetinfo="netcfg/get_hostname=$hname "
+else
+ # There's no good way to get a hostname here, but the postinstall will deal.
+ knetinfo="netcfg/disable_dhcp=true \
+netcfg/get_domain=mit.edu \
+netcfg/get_hostname=$hname \
+netcfg/get_nameservers=18.72.0.3 \
+netcfg/get_ipaddress=$IPADDR \
+netcfg/get_netmask=$NETMASK \
+netcfg/get_gateway=$GATEWAY \
+netcfg/confirm_static=true"
+fi
+
+kargs="$knetinfo locale=en_US console-setup/layoutcode=us interface=auto \
+url=http://18.9.60.73/installer/$distro/debathena.preseed \
+debathena/pxetype=$pxetype debathena/clusteraddr=$IPADDR \
+debathena/i=$installertype debathena/m=$mirrorsite --"
+
+echo "Continuing in five seconds..."
+if [ "$test" = "test" ]; then
+ echo "Would run kexec with these args:"
+ echo "$dkargs $kargs"
+ exit 0
+fi
+./kexec -l linux --append="$dkargs $kargs" --initrd=initrd.gz \
+ && sleep 3 && chvt 1 && sleep 2 && ./kexec -e
+echo "Secondary installed failed; please contact release-team@mit.edu"
+echo "with the circumstances of your install attempt. Here's a shell for debugging:"
+# We don't want to let this fall through to an actual install of whatever
+# kernel we're using.
+while : ; do /bin/sh ; done
+exit 0
Added: trunk/debathena/scripts/installer/pxe/stage1/debathena-loader.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/debathena-loader.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/stage1/debathena-loader.sh 2011-06-23 00:27:33 UTC (rev 25155)
@@ -0,0 +1,14 @@
+#!/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)
+
+cd /
+wget http://18.9.60.73/installer/stage1/debathena.tar.gz > /dev/tty5 2>&1
+tar xzf debathena.tar.gz
+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
Added: trunk/debathena/scripts/installer/pxe/stage1/debathena.preseed
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/debathena.preseed (rev 0)
+++ trunk/debathena/scripts/installer/pxe/stage1/debathena.preseed 2011-06-23 00:27:33 UTC (rev 25155)
@@ -0,0 +1,4 @@
+# Minimal preseed, designed to just punt to our own network-based installer.
+# 18.92.2.195 = athena10.mit.edu
+# 18.9.60.73 = new athena10.mit.edu
+d-i preseed/include_command string wget -q http://18.9.60.73/installer/stage1/debathena-loader.sh ; sh debathena-loader.sh