[26125] in Source-Commits
/svn/athena r25406 - in trunk/debathena/scripts/installer/pxe: . oneiric oneiric/debathena oneiric/debathena/athena stage1/debathena
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Fri Sep 23 11:30:22 2011
Date: Fri, 23 Sep 2011 11:30:16 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201109231530.p8NFUGn5024594@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-09-23 11:30:16 -0400 (Fri, 23 Sep 2011)
New Revision: 25406
Added:
trunk/debathena/scripts/installer/pxe/oneiric/
trunk/debathena/scripts/installer/pxe/oneiric/Makefile
trunk/debathena/scripts/installer/pxe/oneiric/debathena-loader.sh
trunk/debathena/scripts/installer/pxe/oneiric/debathena.preseed
trunk/debathena/scripts/installer/pxe/oneiric/debathena/
trunk/debathena/scripts/installer/pxe/oneiric/debathena/athena/
trunk/debathena/scripts/installer/pxe/oneiric/debathena/athena/masks
trunk/debathena/scripts/installer/pxe/oneiric/debathena/athena/netparams
trunk/debathena/scripts/installer/pxe/oneiric/debathena/check-disks.sh
trunk/debathena/scripts/installer/pxe/oneiric/debathena/installer.sh
trunk/debathena/scripts/installer/pxe/oneiric/debathena/lvm-cluster-machine.partman
trunk/debathena/scripts/installer/pxe/oneiric/debathena/postinstall.sh
trunk/debathena/scripts/installer/pxe/oneiric/debathena/preseed
trunk/debathena/scripts/installer/pxe/oneiric/debathena/preseed.autoinstall
trunk/debathena/scripts/installer/pxe/oneiric/debathena/preseed.common
Modified:
trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
Log:
* Pretend to support oneiric
* Warn the user in stage1 if bad things are likely to happen
Added: trunk/debathena/scripts/installer/pxe/oneiric/Makefile
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/Makefile (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/Makefile 2011-09-23 15:30:16 UTC (rev 25406)
@@ -0,0 +1,11 @@
+# This is pretty dangerous in a bunch of ways. Approach with caution.
+d=/afs/athena.mit.edu/system/athena10/installer/oneiric
+
+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/oneiric/debathena/athena/masks
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena/athena/masks (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena/athena/masks 2011-09-23 15:30:16 UTC (rev 25406)
@@ -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/oneiric/debathena/athena/netparams
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena/athena/netparams (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena/athena/netparams 2011-09-23 15:30:16 UTC (rev 25406)
@@ -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/oneiric/debathena/athena/netparams
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/debathena/scripts/installer/pxe/oneiric/debathena/check-disks.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena/check-disks.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena/check-disks.sh 2011-09-23 15:30:16 UTC (rev 25406)
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# This is run by d-i before the partman step (e.g. d-i partman/early_command)
+
+MIN_DISK_SIZE=20000000
+
+youlose() {
+ chvt 5
+ # Steal STDIN and STDOUT back from the installer
+ exec < /dev/tty5 > /dev/tty5 2>&1
+ echo ""
+ echo "****************************"
+ echo "ERROR: $@"
+ echo "Installation cannot proceed. Press any key to reboot."
+ read foo
+ echo "Rebooting, please wait..."
+ reboot
+}
+
+first_disk=`list-devices disk | head -n1`
+if ! echo "$first_disk" | grep -q ^/dev; then
+ youlose "No disks found."
+fi
+if [ "$(sfdisk -s "$first_disk")" -lt $MIN_DISK_SIZE ]; then
+ youlose "Your disk is too small ($(( $MIN_DISK_SIZE / 1000000)) GB required)."
+fi
+# Tell partman which disk to use
+debconf-set partman-auto/disk "$first_disk"
+exit 0
Added: trunk/debathena/scripts/installer/pxe/oneiric/debathena/installer.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena/installer.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena/installer.sh 2011-09-23 15:30:16 UTC (rev 25406)
@@ -0,0 +1,204 @@
+#!/bin/sh
+
+# Live Poultry Fresh Killed
+if grep -q "^Vostro 320" /sys/class/dmi/id/product_name; then
+ echo "Scribbling over check-missing-firmware"
+ echo > /bin/check-missing-firmware
+fi
+
+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
+
+# support for clusteraddr should be removed sometime in Spring 2012
+# Be sure to remove the conditional around line 115 too.
+clusteraddr=`sed -e 's/ /\n/g' < /proc/cmdline | grep debathena/clusteraddr | sed -e 's/.*=//'`
+pxetype=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/pxe= | sed -e 's/.*=//'`
+if [ -z "$pxetype" ]; then
+ # Fallback to old-style option for very old machines that haven't
+ # updated. This conditional should be removed sometime in Spring 2012
+ pxetype=`sed -e 's/ /\n/g' < /proc/cmdline | grep debathena/pxetype | sed -e 's/.*=//'`
+fi
+installertype=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/i= | sed -e 's/.*=//'`
+mirrorsite=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/m= | sed -e 's/.*=//'`
+partitioning=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/part= | sed -e 's/.*=//'`
+nodhcp=`sed -e 's/ /\n/g' < /proc/cmdline | grep netcfg/disable_dhcp= | sed -e 's/.*=//'`
+
+
+echo "Picked up values from command line:
+clusteraddr=$clusteraddr
+pxetype=$pxetype
+installertype=$installertype
+mirrorsite=$mirrorsite"
+
+# Apply some sane defaults
+if [ -z "$installertype" ]; then installertype=production ; fi
+if [ -z "$mirrorsite" ]; then mirrorsite="mirrors.mit.edu" ; fi
+
+# Sanity check
+if [ -z "$pxetype" ]; then
+ echo "ERROR: No pxetype on the command line."
+ echo "Cannot proceed. Reboot now, please."
+ read dummy
+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"
+
+ 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
+ echo "Saving preseed netcfg values"
+ 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
+}
+
+# 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
+
+# OK, we can arrive at this point in the installer through two
+# ways: from the stage1 installer or from athena-auto-upgrade
+# Anything else is an error and will not be supported.
+# The stage1 installer takes care of sanity-checking networking
+# so if we have a DHCP address here, it's either valid, or we got here
+# from an old athena-auto-upgrade that doesn't do full networking.
+
+if [ -n "$clusteraddr" ] && [ "$nodhcp" != "true" ]; then
+ IPADDR=$clusteraddr
+ netconfig
+else
+ # We're not running netconfig here, but install-debathena.sh still
+ # uses the information from the preseed. So convert information from
+ # the kernel command line to the preseed file format.
+ sed "s/ /\n/g" < /proc/cmdline | grep "^netcfg" | sed -e "s/^/d-i /" -e "s/=/ string /" >> preseed
+fi
+
+# 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 "Network config checks out. Proceeding..."
+ else
+ echo "Your computer seems not to be registered on MITnet, but the mirror"
+ echo "site $mirrorsite is accessible. Continuing anyway."
+ fi
+else
+ echo "${rrr}The mirror site $mirrorsite is NOT accessible in your current"
+ echo "network configuration. Cannot continue."
+ echo "Reboot now."
+ read dummy
+fi
+
+# Perferred hostname of mirror site
+# We want this here even for vanilla installs
+cat >> preseed <<EOF
+d-i apt-setup/hostname string $mirrorsite
+d-i mirror/http/hostname string $mirrorsite
+d-i mirror/country string manual
+d-i mirror/http/directory string /ubuntu
+d-i mirror/http/proxy string
+EOF
+
+if [ vanilla = "$pxetype" ] ; then
+ echo "Starting normal Ubuntu install in five seconds."
+ sleep 5
+ exit 0
+fi
+
+if [ cluster = "$pxetype" ]; then
+ if [ "$partitioning" != "manual" ]; 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
+
+
+# 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" > pxe-install-flag
+
+echo "Initial Debathena installer complete; exiting preconfig to start main install."
+if [ "$pxetype" != "cluster" ] || [ "$installertype" = "beta" ]; then
+ echo "Hit return to continue."
+ read r
+fi
+exit 0
Added: trunk/debathena/scripts/installer/pxe/oneiric/debathena/lvm-cluster-machine.partman
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena/lvm-cluster-machine.partman (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena/lvm-cluster-machine.partman 2011-09-23 15:30:16 UTC (rev 25406)
@@ -0,0 +1,18 @@
+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{ } .
+
Added: trunk/debathena/scripts/installer/pxe/oneiric/debathena/postinstall.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena/postinstall.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena/postinstall.sh 2011-09-23 15:30:16 UTC (rev 25406)
@@ -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/oneiric/debathena/preseed
===================================================================
Added: trunk/debathena/scripts/installer/pxe/oneiric/debathena/preseed.autoinstall
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena/preseed.autoinstall (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena/preseed.autoinstall 2011-09-23 15:30:16 UTC (rev 25406)
@@ -0,0 +1,246 @@
+# 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.
+# No, use the first disk (via a shell script that also does sanity checking
+d-i partman/early_command string sh /debathena/check-disks.sh
+# We could also do this to just pick the first disk
+#d-i partman/early_command string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
+
+# 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.
+# Except now it does work?
+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/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
+# Stop configuring backports (originally needed for Jaunty on the 755s)
+# 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/oneiric/debathena/preseed.common
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena/preseed.common (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena/preseed.common 2011-09-23 15:30:16 UTC (rev 25406)
@@ -0,0 +1,36 @@
+# This contains only things which interactive installers are still likely to want.
+
+### Mirror settings
+# All of these are now set by installer.sh
+# d-i mirror/country string manual
+# 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 oneiric
+# 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/oneiric/debathena-loader.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena-loader.sh (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena-loader.sh 2011-09-23 15:30:16 UTC (rev 25406)
@@ -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/oneiric/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/oneiric/debathena.preseed
===================================================================
--- trunk/debathena/scripts/installer/pxe/oneiric/debathena.preseed (rev 0)
+++ trunk/debathena/scripts/installer/pxe/oneiric/debathena.preseed 2011-09-23 15:30:16 UTC (rev 25406)
@@ -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/oneiric/debathena-loader.sh ; sh debathena-loader.sh
Modified: trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh 2011-09-23 15:03:54 UTC (rev 25405)
+++ trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh 2011-09-23 15:30:16 UTC (rev 25406)
@@ -353,7 +353,7 @@
fi
case "$distro" in
- natty)
+ natty|oneiric)
# Sigh
kbdcode="keyboard-configuration/layoutcode=us"
;;
@@ -382,6 +382,14 @@
echo "$dkargs $kargs"
exit 0
fi
+if hash wc > /dev/null 2>&1; then
+ if [ $(echo "$dkargs $kargs" | wc -c) -gt 512 ]; then
+ echo "Kernel arguments exceed 512 bytes. This will probably"
+ echo "end badly. If this install fails, be sure to mention"
+ echo "this specific message in your bug report."
+ fi
+fi
+
debug "About to run kexec with these args: $dkargs $kargs"
./kexec -l linux --append="$dkargs $kargs" --initrd=initrd.gz \
&& sleep 3 && chvt 1 && sleep 2 && ./kexec -e