source: trunk/debathena/scripts/installer/pxe/precise/debathena/installer.sh @ 25504

Revision 25504, 6.0 KB checked in by jdreed, 12 years ago (diff)
Use minimal athinfod in the installer
Line 
1#!/bin/sh
2
3# Sigh.  check-missing-firmware is too stupid to reconfigure the NIC after
4# removing and reloading the module.  So we lose network in the middle
5# of the install.  The card works just fine without firmware, so we
6# just convince hwdetect and friends that there is no missing firmware.
7# NOTE: Although the nic-firmware udeb does not include the Realtek
8# firmware, shipping the firmware ourselves does not fix the problem,
9# because check-missing-firmware still insists on reloading the module
10# and we lose the network configuration.
11if grep -q "^Vostro 320" /sys/class/dmi/id/product_name || lsmod | grep -q r8169; then
12    # This will break if the firmware eventually wants to live somewhere else
13    # This is possibly a bad idea if there are r8169-based cards that do need
14    # firmware, but if they do, it's not likely they made it this far in the
15    # installation process.
16    rm -f /dev/.udev/firmware-missing/rtl_nic*
17fi
18
19cd /debathena
20
21touch preseed
22
23pxetype=""
24
25# Using debconf here will hang, so parse the command line manually.
26# old options:
27#   debathena/clusterforce: implies pxetype=cluster, don't recheck net
28#   debathena/clusteraddr: address to use with above
29# new options:
30#   debathena/pxetype: could be cluster, but could be other things
31
32# support for clusteraddr is now removed.
33
34pxetype=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/pxe= | sed -e 's/.*=//'`
35installertype=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/i= | sed -e 's/.*=//'`
36mirrorsite=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/m= | sed -e 's/.*=//'`
37partitioning=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/part= | sed -e 's/.*=//'`
38nodhcp=`sed -e 's/ /\n/g' < /proc/cmdline | grep netcfg/disable_dhcp= | sed -e 's/.*=//'`
39
40
41echo "Picked up values from command line:
42pxetype=$pxetype
43installertype=$installertype
44mirrorsite=$mirrorsite"
45
46# Apply some sane defaults
47if [ -z "$installertype" ]; then installertype=production ; fi
48if [ -z "$mirrorsite" ]; then mirrorsite="mirrors.mit.edu" ; fi
49
50# Sanity check
51if [ -z "$pxetype" ]; then
52  echo "ERROR: No pxetype on the command line."
53  echo "Cannot proceed.  Reboot now, please."
54  read dummy
55fi
56
57# Color strings. I'd like to use tput, but the installer doesn't have it.
58esc=""
59nnn="${esc}[m"          # Normal
60ccc="${esc}[36m"        # Cyan
61rrr="${esc}[1;31m"      # Bold and red
62ddd="${esc}[1;31;47m"   # Plus gray background
63ddb="${esc}[1;31;47;5m" # Plus blinking
64
65# OK, we can arrive at this point in the installer through two
66# ways:  from the stage1 installer or from athena-auto-upgrade
67# Anything else is an error and will not be supported.
68# The stage1 installer takes care of sanity-checking networking
69# so if we have a DHCP address here, it's either valid, or we got here
70# from an old athena-auto-upgrade that doesn't do full networking.
71# The latter would imply a very old installation, and reinstallation
72# from scratch is recommended.
73
74# We're not running netconfig here, but install-debathena.sh still
75# uses the information from the preseed. So convert information from
76# the kernel command line to the preseed file format.
77if [ "$nodhcp" = true ]; then
78  sed "s/ /\n/g" < /proc/cmdline | grep "^netcfg" | sed -e "s/^/d-i /" -e "s/=/ string /" >> preseed
79fi
80
81# We're at a point in the install process where we can be fairly sure
82# that nothing else is happening, so "killall wget" should be safe.
83(sleep 5; killall wget >/dev/null 2>&1) &
84if wget -s http://$mirrorsite/ubuntu ; then
85  if ip address show to 18.0.0.0/8 | grep -q . && ! ip address show to 18.2.0.0/16 | grep -q . ; then
86    echo "Network config checks out.  Proceeding..."
87  else
88    echo "Your computer seems not to be registered on MITnet, but the mirror"
89    echo "site $mirrorsite is accessible. Continuing anyway."
90  fi
91else
92  echo "${rrr}The mirror site $mirrorsite is NOT accessible in your current"
93  echo "network configuration.  Cannot continue."
94  echo "Reboot now."
95  read dummy
96fi
97
98# Perferred hostname of mirror site
99# We want this here even for vanilla installs
100cat >> preseed <<EOF
101d-i apt-setup/hostname string $mirrorsite
102d-i mirror/http/hostname string $mirrorsite
103d-i mirror/country string manual
104d-i mirror/http/directory string /ubuntu
105d-i mirror/http/proxy string
106EOF
107
108if [ vanilla = "$pxetype" ] ; then
109  echo "Starting normal Ubuntu install in five seconds."
110  sleep 5
111  exit 0
112fi
113
114if [ cluster = "$pxetype" ]; then
115  if [ "$partitioning" != "manual" ]; then
116    cat << EOF
117************************************************************
118               ${ddb}DESTROYS${nnn}
119${rrr}THIS PROCEDURE ${ddd}DESTROYS${nnn}${rrr} THE CONTENTS OF THE HARD DISK.${nnn}
120               ${ddb}DESTROYS${nnn}
121
122IF YOU DO NOT WISH TO CONTINUE, REBOOT NOW.
123
124************************************************************
125
126EOF
127    echo "Installing autoinstall preseed file."
128    egrep -v '(^$|^#)' < preseed.autoinstall >> preseed
129  else
130    echo "Installing autoinstall preseed file without automated partitioning."
131    egrep -v '(^$|^#|partman)' < preseed.autoinstall >> preseed
132  fi
133fi
134
135# Shovel in the generically useful preseed stuff regardless.
136egrep -v '(^$|^#)' < preseed.common >> preseed
137
138
139# This is used by the final installer step.
140# A hardcoded number is used as DNS may still be iffy.
141echo "Fetching Debathena postinstaller."
142# 18.92.2.195 = OLD athena10.mit.edu
143# 18.9.60.73 = NEW athena10.mit.edu
144if [ "$installertype" = "beta" ]; then
145  wget http://18.9.60.73/install-debathena.beta.sh
146  mv install-debathena.beta.sh install-debathena.sh
147else
148  wget http://18.9.60.73/install-debathena.sh
149fi
150
151# Start up a minimal athinfod
152wget http://18.9.60.73/installer/athinfod && chmod 755 athinfod && ./athinfod
153# Give said athinfod some basic info
154cat > install-info <<EOF
155pxetype=$pxetype
156installertype=$installertype
157partitioning=$partitioning
158mirrorsite=$mirrorsite
159EOF
160
161
162# Let the postinstall know what we are up to.
163echo "$pxetype" > pxe-install-flag
164
165echo "Initial Debathena installer complete; exiting preconfig to start main install."
166if [ "$pxetype" != "cluster" ] || [ "$installertype" = "beta" ]; then
167  echo "Hit return to continue."
168  read r
169fi
170exit 0
Note: See TracBrowser for help on using the repository browser.