[25654] in Source-Commits
/svn/athena r25147 - in trunk/debathena/scripts/installer/pxe: . natty natty/debathena natty/debathena/athena
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Jun 20 11:56:10 2011
Date: Mon, 20 Jun 2011 11:56:03 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201106201556.p5KFu3xn018880@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-06-20 11:56:03 -0400 (Mon, 20 Jun 2011)
New Revision: 25147
Added:
trunk/debathena/scripts/installer/pxe/natty/
trunk/debathena/scripts/installer/pxe/natty/Makefile
trunk/debathena/scripts/installer/pxe/natty/NOTES
trunk/debathena/scripts/installer/pxe/natty/README
trunk/debathena/scripts/installer/pxe/natty/TODO
trunk/debathena/scripts/installer/pxe/natty/debathena-loader.sh
trunk/debathena/scripts/installer/pxe/natty/debathena.preseed
trunk/debathena/scripts/installer/pxe/natty/debathena/
trunk/debathena/scripts/installer/pxe/natty/debathena/athena/
trunk/debathena/scripts/installer/pxe/natty/debathena/athena/masks
trunk/debathena/scripts/installer/pxe/natty/debathena/athena/netparams
trunk/debathena/scripts/installer/pxe/natty/debathena/installer.sh
trunk/debathena/scripts/installer/pxe/natty/debathena/lvm-cluster-machine.partman
trunk/debathena/scripts/installer/pxe/natty/debathena/postinstall.sh
trunk/debathena/scripts/installer/pxe/natty/debathena/preseed
trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.autoinstall
trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.common
Log:
* Prep for natty install
* Better support for alternate mirrors
* Support beta installer
Added: trunk/debathena/scripts/installer/pxe/natty/Makefile
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/Makefile (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/Makefile 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,11 @@
+# This is pretty dangerous in a bunch of ways. Approach with caution.
+d=/afs/athena.mit.edu/system/athena10/installer/natty
+
+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/natty/NOTES
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/NOTES (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/NOTES 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,13 @@
+Notes on partman-auto:
+
+- specifying partman-auto/method of "lvm" forces the automatic creation
+ of a physical volume (of around 100GB; way too small) and forces the
+ volume group name to be the same as the DHCP hostname. This is
+ overrideable via undo
+
+- $lvmok{ } tags are secretly required
+
+20000 50000 256000 lvm
+ $primary{ } $defaultignore{ }
+ method{ lvm } .
+
Added: trunk/debathena/scripts/installer/pxe/natty/README
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/README (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/README 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,23 @@
+This directory contains some basic setup stuff for a PXE-based Athena
+10 installer. If you're looking for basic Athena 10 install instructions, check out:
+
+http://athena10.mit.edu/
+
+This is largely a vanilla Ubuntu install; a DHCP server running a
+standard PXELINUX setup invokes the debian netinstall kernel with an
+invocation like:
+
+LABEL athena10
+ kernel intrepid-installer/i386/linux
+ append auto=true locale=en_US console-setup/layoutcode=us console-setup/charmap=UTF-8 interface=auto url=http://18.18.1.12/linux/athena10-intrepid.preseed initrd=intrepid-installer/i386/initrd.gz DEBCONF_DEBUG=5 --
+
+...after which the kernel loads the preseed file
+(athena10-intrepid.preseed), which fetches and runs a loader script
+(athena10-intrepid-loader.sh), which fetches, unpacks, and runs the real
+install script (out of athena10-intrepid.tar.gz), which asks a few
+questions up front and then generates a preseed file which can
+complete the install without further input.
+
+Most of this stuff is currently served via HTTP from athena10.mit.edu.
+
+--amb 27feb2009
Added: trunk/debathena/scripts/installer/pxe/natty/TODO
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/TODO (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/TODO 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,24 @@
+high:
+- Non-cluster PXE installs need post-install network munging
+ by install-debathena.sh in order to have usable net, since
+ the ubuntu installer forces a DHCP config if the installer
+ used DHCP. So sad.
+- the entire install session *really* needs to be logged
+- increase the timeout for Ubuntu's DHCP request, since the netops
+ servers can sometimes take longer.
+
+low:
+- sometimes there's a warning dialog about lv name reuse.
+ figure out why and suppress it.
+- installer script shouldn't assume eth0
+- clean up "debathena but not cluster version" install option,
+ maybe further split it.
+- shuffle preseed stuff around; more of the .autoinstall stuff
+ should probably move to common. (perhaps selection of
+ a default package set?)
+- hack non-cluster preseed to not prompt for cd ejection.
+
+some of what was done:
+- add hacks to install-debathena.sh for noninteractive use
+- push to MIT PXE servers
+- have a "debathena but not cluster version" install option
Added: trunk/debathena/scripts/installer/pxe/natty/debathena/athena/masks
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/athena/masks (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/athena/masks 2011-06-20 15:56:03 UTC (rev 25147)
@@ -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/natty/debathena/athena/netparams
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/athena/netparams (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/athena/netparams 2011-06-20 15:56:03 UTC (rev 25147)
@@ -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/natty/debathena/athena/netparams
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/debathena/scripts/installer/pxe/natty/debathena/installer.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/installer.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/installer.sh 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,262 @@
+#!/bin/sh
+
+cd /debathena
+
+touch preseed
+
+pxetype=""
+
+# Using debconf here will hang, so parse the command line manually.
+# old options:
+# debathena/clusterforce: implies pxetype=cluster, don't recheck net
+# debathena/clusteraddr: address to use with above
+# 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/.*=//'`
+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/.*=//'`
+
+if [ "$clusteraddr" ] ; then IPADDR=$clusteraddr ; fi
+if [ "$clusteraddr" -a "$clusterforce" = yes -a -z "$pxetype" ] ; then pxetype=cluster ; fi
+
+netconfig () {
+ echo "Configuring network..."
+ mp=/debathena
+ 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
+
+ # 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
+}
+
+# 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"
+
+echo "Welcome to Athena."
+echo
+
+while [ -z "$pxetype" ] ; do
+ echo "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 11.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
+ 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 -n "Enter a new mirror hostname:"
+ read mirrorsite
+ echo "Using mirror site $mirrorsite. Now select the installation type.";;
+ b|B)
+ if [ "$installertype" = "production" ]; then
+ echo "Switching to beta installer."
+ installertype="beta"
+ else
+ echo "Switching to production installer."
+ installertype="production"
+ fi
+ echo "Now select the installation type.";;
+ *)
+ 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
+
+if [ vanilla = $pxetype ] ; then
+ echo "Starting normal Ubuntu install in five seconds."
+ sleep 5
+ exit 0
+fi
+
+if [ cluster = "$pxetype" ]; then
+ if [ notreally != "$destroys" ]; then
+ cat << EOF
+************************************************************
+ ${ddb}DESTROYS${nnn}
+${rrr}THIS PROCEDURE ${ddd}DESTROYS${nnn}${rrr} THE CONTENTS OF THE HARD DISK.${nnn}
+ ${ddb}DESTROYS${nnn}
+
+IF YOU DO NOT WISH TO CONTINUE, REBOOT NOW.
+
+************************************************************
+
+EOF
+ echo "Installing autoinstall preseed file."
+ egrep -v '(^$|^#)' < preseed.autoinstall >> preseed
+ else
+ echo "Installing autoinstall preseed file without automated partitioning."
+ egrep -v '(^$|^#|partman)' < preseed.autoinstall >> preseed
+ fi
+fi
+
+# Shovel in the generically useful preseed stuff regardless.
+egrep -v '(^$|^#)' < preseed.common >> preseed
+
+if [ "$IPADDR" ] ; then
+ # ...and the specified network config.
+ cat >> preseed <<EOF
+d-i netcfg/get_nameservers string 18.72.0.3
+d-i netcfg/get_ipaddress string $IPADDR
+d-i netcfg/get_netmask string $NETMASK
+d-i netcfg/get_gateway string $GATEWAY
+d-i netcfg/confirm_static boolean true
+EOF
+fi
+
+# Perferred hostname of mirror site
+cat >> preseed <<EOF
+d-i apt-setup/hostname string $mirrorsite
+d-i mirror/http/hostname string $mirrorsite
+EOF
+
+# This is used by the final installer step.
+# A hardcoded number is used as DNS may still be iffy.
+echo "Fetching Debathena postinstaller."
+# 18.92.2.195 = OLD athena10.mit.edu
+# 18.9.60.73 = NEW athena10.mit.edu
+if [ "$installertype" = "beta" ]; then
+ wget http://18.9.60.73/install-debathena.beta.sh
+ mv install-debathena.beta.sh install-debathena.sh
+else
+ wget http://18.9.60.73/install-debathena.sh
+fi
+
+# Let the postinstall know what we are up to.
+echo "$pxetype" > $mp/pxe-install-flag
+
+echo "Initial Debathena installer complete; exiting preconfig to start main install."
+if ! [ "$clusteraddr" -a "$pxetype" = cluster ] ; then
+ echo "Hit return to continue."
+ read r
+fi
+exit 0
Added: trunk/debathena/scripts/installer/pxe/natty/debathena/lvm-cluster-machine.partman
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/lvm-cluster-machine.partman (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/lvm-cluster-machine.partman 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,21 @@
+cluster ::
+
+200 200 200 ext3
+ $primary{ } $bootable{ }
+ method{ format } format{ }
+ use_filesystem{ } filesystem{ ext3 }
+ mountpoint{ /boot } .
+
+10000 100000 1000000000 ext3
+ $lvmok{ }
+ use_filesystem{ } filesystem{ ext3 }
+ method{ format } format{ }
+ mountpoint{ / } .
+
+512 300% 300% linux-swap
+ $lvmok{ }
+ method{ swap } format{ } .
+
+10000 100000 1000000000 ext3
+ $lvmok{ }
+ method{ keep } .
Added: trunk/debathena/scripts/installer/pxe/natty/debathena/postinstall.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/postinstall.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/postinstall.sh 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# This is only invoked when the relevant preseed entry is passed in
+# during the preinstall questioning. (Thus, not for vanilla installs.)
+
+cp /debathena/preseed /target/root/debathena.preseed
+cp /debathena/install-debathena.sh /target/root
+if test -f /debathena/pxe-install-flag ; then
+ cp /debathena/pxe-install-flag /target/root/pxe-install-flag
+fi
+
+. /lib/chroot-setup.sh
+
+chroot /target dpkg-divert --rename --add /usr/sbin/policy-rc.d
+if ! chroot_setup; then
+ logger -t postinstall.sh -- "Target system not usable. Can't install Debathena."
+ exit 1
+fi
+
+chvt 5
+
+# Something like this approach was once said to fail due to lingering
+# processes keeping the pipeline open and the script hung. According to
+# trac#225 this doesn't happen any more.
+(chroot /target sh /root/install-debathena.sh < /dev/tty5 2>&1 \
+ && touch /debathena/install-succeeded) \
+ | chroot /target tee /var/log/athena-install.log > /dev/tty5
+
+if ! [ -e /debathena/install-succeeded ]; then
+ echo "WARNING: your debathena postinstall has returned an error;" > /dev/tty5
+ echo "see above for details." > /dev/tty5
+ echo > /dev/tty5
+ echo "This shell is provided for debugging purposes. When you exit" > /dev/tty5
+ echo "the shell, your system will reboot into the newly-installed" > /dev/tty5
+ echo "system, though depending on the failure you may see continuing issues." > /dev/tty5
+ /bin/sh < /dev/tty5 > /dev/tty5 2>&1
+fi
+
+sleep 5
+
+chroot_cleanup
+chroot /target dpkg-divert --rename --remove /usr/sbin/policy-rc.d
+
+chvt 1
Added: trunk/debathena/scripts/installer/pxe/natty/debathena/preseed
===================================================================
Added: trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.autoinstall
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.autoinstall (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.autoinstall 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,239 @@
+# Modified from Hardy's example-preseed.txt.
+
+# This is mildly parsed by the install script.
+
+# Locale and keyboard are set by PXELINUX via kernel options.
+
+##############################################################################
+##############################################################################
+# Stuff which looks bogus for custom installs is current split out up here
+# for later separation.
+d-i pkgsel/update-policy select none
+
+### Network configuration
+# netcfg will choose an interface that has link if possible. This makes it
+# skip displaying a list if there is more than one interface.
+d-i netcfg/choose_interface select auto
+
+##############################################################################
+##############################################################################
+
+# Any hostname and domain names assigned from dhcp take precedence over
+# values set here. However, setting the values still prevents the questions
+# from being shown, even if values come from dhcp.
+# d-i netcfg/get_hostname string unassigned-hostname
+# d-i netcfg/get_domain string unassigned-domain
+
+# Disable that annoying WEP key dialog.
+# d-i netcfg/wireless_wep string
+# The wacky dhcp hostname that some ISPs use as a password of sorts.
+# d-i netcfg/dhcp_hostname string radish
+
+### Partitioning
+# Use the whole disk. Any disk.
+# The presently available methods are: "regular", "lvm" and "crypto"
+d-i partman-auto/method string lvm
+
+# Stomp old LVM config.
+d-i partman-auto/purge_lvm_from_device boolean true
+# Don't confirm writing LVM.
+d-i partman-lvm/confirm boolean true
+# ...and for overwriting the same thing from a previous install:
+d-i partman-lvm/device_remove_lvm boolean true
+# ...and for overwriting a completely zeroed disk:
+# This doesn't work when preseeded. It does work manually. Yay.
+# LP:154086 covers the basic problem, though not the nonpreseedability.
+# d-i partman-lvm/confirm_nooverwrite boolean true
+
+# You can choose from any of the predefined partitioning recipes.
+# atomic: All files in one partition (recommended for new users)
+# home: Separate /home partition
+# multi: Separate /home, /usr, /var, and /tmp partitions
+# small_disk (alpha architecture only):
+# Small-disk (< 1GB) partitioning scheme
+# d-i partman-auto/choose_recipe select atomic
+
+# Or provide a recipe of your own...
+# 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
+# This is completely undocumented. Sigh.
+d-i partman-auto-lvm/new_vg_name string athena
+# As reported in Trac #253
+d-i partman-auto-lvm/guided_size string max
+# Don't punt for no-method filesystems. Another undocumented option.
+d-i partman-basicmethods/method_only boolean false
+
+# This makes partman automatically partition without confirmation, provided
+# that you told it what to do using one of the methods above.
+d-i partman/confirm_write_new_label boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+
+### Base system installation
+# Select the initramfs generator used to generate the initrd for 2.6 kernels.
+#d-i base-installer/kernel/linux/initramfs-generators string yaird
+
+# The kernel image (meta) package to be installed; "none" can be used if no
+# kernel is to be installed.
+d-i base-installer/kernel/image linux-generic
+
+### Account setup
+# No user account; root account with standard password:
+d-i passwd/make-user boolean false
+d-i passwd/root-login boolean true
+d-i passwd/root-password password profroot
+d-i passwd/root-password-again password profroot
+
+# Normal user's password, either in clear text
+#d-i passwd/user-password password insecure
+#d-i passwd/user-password-again password insecure
+# or encrypted using an MD5 hash.
+#d-i passwd/user-password-crypted password [MD5 hash]
+# Create the first user with the specified UID instead of the default.
+#d-i passwd/user-uid string 1010
+
+# The user account will be added to some standard initial groups. To
+# override that, use this.
+#d-i passwd/user-default-groups string audio cdrom video
+
+### Apt setup
+# You can choose to install restricted and universe software, or to install
+# software from the backports repository.
+d-i apt-setup/restricted boolean true
+d-i apt-setup/universe boolean true
+d-i apt-setup/backports boolean true
+# Uncomment this if you don't want to use a network mirror.
+#d-i apt-setup/use_mirror boolean false
+# Select which update services to use; define the mirrors to be used.
+# Values shown below are the normal defaults.
+#d-i apt-setup/services-select multiselect security
+#d-i apt-setup/security_host string security.ubuntu.com
+#d-i apt-setup/security_path string /ubuntu
+d-i apt-setup/country string US
+# Actual mirror host now taken care of (semi-secretly) by the installer script.
+# d-i apt-setup/hostname string mirrors.mit.edu
+d-i apt-setup/directory string /ubuntu
+d-i apt-setup/country US
+
+
+# Additional repositories, local[0-9] available
+#d-i apt-setup/local0/repository string \
+# http://local.server/ubuntu hardy main
+#d-i apt-setup/local0/comment string local server
+# Enable deb-src lines
+#d-i apt-setup/local0/source boolean true
+# URL to the public key of the local repository; you must provide a key or
+# apt will complain about the unauthenticated repository and so the
+# sources.list line will be left commented out
+#d-i apt-setup/local0/key string http://local.server/key
+
+# By default the installer requires that repositories be authenticated
+# using a known gpg key. This setting can be used to disable that
+# authentication. Warning: Insecure, not recommended.
+#d-i debian-installer/allow_unauthenticated string true
+
+### Package selection
+tasksel tasksel/first multiselect standard, ubuntu-desktop
+#tasksel tasksel/first multiselect standard, lamp-server
+#tasksel tasksel/first multiselect standard, kubuntu-desktop
+
+# Individual additional packages to install
+#d-i pkgsel/include string openssh-server build-essential
+
+# Language pack selection
+#d-i pkgsel/language-packs multiselect de, en, zh
+
+# Some versions of the installer can report back on what software you have
+# installed, and what software you use. The default is not to report back,
+# but sending reports helps the project determine what software is most
+# popular and include it on CDs.
+#popularity-contest popularity-contest/participate boolean false
+
+### Boot loader installation
+# Grub is the default boot loader (for x86). If you want lilo installed
+# instead, uncomment this:
+#d-i grub-installer/skip boolean true
+# To also skip installing lilo, and install no bootloader, uncomment this
+# too:
+#d-i lilo-installer/skip boolean true
+
+# This is fairly safe to set, it makes grub install automatically to the MBR
+# if no other operating system is detected on the machine.
+d-i grub-installer/only_debian boolean true
+
+# This one makes grub-installer install to the MBR if it also finds some other
+# OS, which is less safe as it might not be able to boot that other OS.
+d-i grub-installer/with_other_os boolean true
+
+# Alternatively, if you want to install to a location other than the mbr,
+# uncomment and edit these lines:
+#d-i grub-installer/only_debian boolean false
+#d-i grub-installer/with_other_os boolean false
+#d-i grub-installer/bootdev string (hd0,0)
+# To install grub to multiple disks:
+#d-i grub-installer/bootdev string (hd0,0) (hd1,0) (hd2,0)
+
+# On systems where unauthorized users have access at boot time, you may want
+# to set a GRUB password, either in clear text
+#d-i grub-installer/password password insecure
+#d-i grub-installer/password-again password insecure
+# or encrypted using an MD5 hash.
+#d-i grub-installer/password-crypted password [MD5 hash]
+
+### Finishing up the installation
+# Avoid that last message about the install being complete.
+d-i finish-install/reboot_in_progress note
+
+# This will prevent the installer from ejecting the CD during the reboot,
+# which is useful in some situations.
+#d-i cdrom-detect/eject boolean false
+
+# This is how to make the installer shutdown when finished, but not
+# reboot into the installed system.
+#d-i debian-installer/exit/halt boolean true
+
+### X configuration
+# X can detect the right driver for some cards, but if you're preseeding,
+# you override whatever it chooses. Still, vesa will work most places.
+#xserver-xorg xserver-xorg/config/device/driver select vesa
+
+# A caveat with mouse autodetection is that if it fails, X will retry it
+# over and over. So if it's preseeded to be done, there is a possibility of
+# an infinite loop if the mouse is not autodetected.
+#xserver-xorg xserver-xorg/autodetect_mouse boolean true
+
+# Monitor autodetection is recommended.
+xserver-xorg xserver-xorg/autodetect_monitor boolean true
+# Uncomment if you have an LCD display.
+#xserver-xorg xserver-xorg/config/monitor/lcd boolean true
+# X has three configuration paths for the monitor. Here's how to preseed
+# the "medium" path, which is always available. The "simple" path may not
+# be available, and the "advanced" path asks too many questions.
+xserver-xorg xserver-xorg/config/monitor/selection-method select medium
+xserver-xorg xserver-xorg/config/monitor/mode-list select 1024x768 @ 60 Hz
+
+### Preseeding other packages
+# Depending on what software you choose to install, or if things go wrong
+# during the installation process, it's possible that other questions may
+# be asked. You can preseed those too, of course. To get a list of every
+# possible question that could be asked during an install, do an
+# installation, and then run these commands:
+# debconf-get-selections --installer > file
+# debconf-get-selections >> file
+
+
+#### Advanced options
+### Running custom commands during the installation
+# d-i preseeding is inherently not secure. Nothing in the installer checks
+# for attempts at buffer overflows or other exploits of the values of a
+# preconfiguration file like this one. Only use preconfiguration files from
+# trusted locations! To drive that home, and because it's generally useful,
+# here's a way to run any shell command you'd like inside the installer,
+# automatically.
+
+# This first command is run as early as possible, just after
+# preseeding is read.
+#d-i preseed/early_command string anna-install some-udeb
Added: trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.common
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.common (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.common 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,36 @@
+# This contains only things which interactive installers are still likely to want.
+
+### Mirror settings
+d-i mirror/country string manual
+# Now set explicitly by install script.
+# d-i mirror/http/hostname string mirrors.mit.edu
+d-i mirror/http/directory string /ubuntu
+d-i mirror/http/proxy string
+
+# Suite to install.
+d-i mirror/suite string lucid
+# Suite to use for loading installer components (optional).
+#d-i mirror/udeb/suite string intrepid
+# Components to use for loading installer components (optional).
+#d-i mirror/udeb/components multiselect main, restricted
+
+### Clock and time zone setup
+# Controls whether or not the hardware clock is set to UTC.
+d-i clock-setup/utc boolean true
+
+# You may set this to any valid setting for $TZ; see the contents of
+# /usr/share/zoneinfo/ for valid values.
+d-i time/zone string US/Eastern
+
+# Controls whether to use NTP to set the clock during the install
+d-i clock-setup/ntp boolean true
+# NTP server to use. The default is almost always fine here.
+#d-i clock-setup/ntp-server ntp.example.com
+
+# This command is run just before the install finishes, but when there is
+# still a usable /target directory. You can chroot to /target and use it
+# directly, or use the apt-install and in-target commands to easily install
+# packages and run commands in the target system.
+#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
+
+d-i preseed/late_command string sh /debathena/postinstall.sh
Added: trunk/debathena/scripts/installer/pxe/natty/debathena-loader.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena-loader.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena-loader.sh 2011-06-20 15:56:03 UTC (rev 25147)
@@ -0,0 +1,13 @@
+#!/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/natty/debathena.tar.gz > /dev/tty5 2>&1
+tar xzf debathena.tar.gz
+chvt 5
+sh debathena/installer.sh < /dev/tty5 > /dev/tty5 2>&1
+chvt 1
+# Pick up the generated preseed file (if any):
+echo file://debathena/preseed
Added: trunk/debathena/scripts/installer/pxe/natty/debathena.preseed
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena.preseed (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena.preseed 2011-06-20 15:56:03 UTC (rev 25147)
@@ -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/natty/debathena-loader.sh ; sh debathena-loader.sh