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. |
---|
11 | if 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* |
---|
17 | fi |
---|
18 | |
---|
19 | cd /debathena |
---|
20 | |
---|
21 | touch preseed |
---|
22 | |
---|
23 | pxetype="" |
---|
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 | |
---|
34 | pxetype=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/pxe= | sed -e 's/.*=//'` |
---|
35 | installertype=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/i= | sed -e 's/.*=//'` |
---|
36 | mirrorsite=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/m= | sed -e 's/.*=//'` |
---|
37 | partitioning=`sed -e 's/ /\n/g' < /proc/cmdline | grep da/part= | sed -e 's/.*=//'` |
---|
38 | nodhcp=`sed -e 's/ /\n/g' < /proc/cmdline | grep netcfg/disable_dhcp= | sed -e 's/.*=//'` |
---|
39 | |
---|
40 | |
---|
41 | echo "Picked up values from command line: |
---|
42 | pxetype=$pxetype |
---|
43 | installertype=$installertype |
---|
44 | mirrorsite=$mirrorsite" |
---|
45 | |
---|
46 | # Apply some sane defaults |
---|
47 | if [ -z "$installertype" ]; then installertype=production ; fi |
---|
48 | if [ -z "$mirrorsite" ]; then mirrorsite="mirrors.mit.edu" ; fi |
---|
49 | |
---|
50 | # Sanity check |
---|
51 | if [ -z "$pxetype" ]; then |
---|
52 | echo "ERROR: No pxetype on the command line." |
---|
53 | echo "Cannot proceed. Reboot now, please." |
---|
54 | read dummy |
---|
55 | fi |
---|
56 | |
---|
57 | # Color strings. I'd like to use tput, but the installer doesn't have it. |
---|
58 | esc="" |
---|
59 | nnn="${esc}[m" # Normal |
---|
60 | ccc="${esc}[36m" # Cyan |
---|
61 | rrr="${esc}[1;31m" # Bold and red |
---|
62 | ddd="${esc}[1;31;47m" # Plus gray background |
---|
63 | ddb="${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. |
---|
77 | if [ "$nodhcp" = true ]; then |
---|
78 | sed "s/ /\n/g" < /proc/cmdline | grep "^netcfg" | sed -e "s/^/d-i /" -e "s/=/ string /" >> preseed |
---|
79 | fi |
---|
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) & |
---|
84 | if 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 |
---|
91 | else |
---|
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 |
---|
96 | fi |
---|
97 | |
---|
98 | # Perferred hostname of mirror site |
---|
99 | # We want this here even for vanilla installs |
---|
100 | cat >> preseed <<EOF |
---|
101 | d-i apt-setup/hostname string $mirrorsite |
---|
102 | d-i mirror/http/hostname string $mirrorsite |
---|
103 | d-i mirror/country string manual |
---|
104 | d-i mirror/http/directory string /ubuntu |
---|
105 | d-i mirror/http/proxy string |
---|
106 | EOF |
---|
107 | |
---|
108 | if [ vanilla = "$pxetype" ] ; then |
---|
109 | echo "Starting normal Ubuntu install in five seconds." |
---|
110 | sleep 5 |
---|
111 | exit 0 |
---|
112 | fi |
---|
113 | |
---|
114 | if [ 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 | |
---|
122 | IF YOU DO NOT WISH TO CONTINUE, REBOOT NOW. |
---|
123 | |
---|
124 | ************************************************************ |
---|
125 | |
---|
126 | EOF |
---|
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 |
---|
133 | fi |
---|
134 | |
---|
135 | # Shovel in the generically useful preseed stuff regardless. |
---|
136 | egrep -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. |
---|
141 | echo "Fetching Debathena postinstaller." |
---|
142 | # 18.92.2.195 = OLD athena10.mit.edu |
---|
143 | # 18.9.60.73 = NEW athena10.mit.edu |
---|
144 | if [ "$installertype" = "beta" ]; then |
---|
145 | wget http://18.9.60.73/install-debathena.beta.sh |
---|
146 | mv install-debathena.beta.sh install-debathena.sh |
---|
147 | else |
---|
148 | wget http://18.9.60.73/install-debathena.sh |
---|
149 | fi |
---|
150 | |
---|
151 | # Start up a minimal athinfod |
---|
152 | wget http://18.9.60.73/installer/athinfod && chmod 755 athinfod && ./athinfod |
---|
153 | # Give said athinfod some basic info |
---|
154 | cat > install-info <<EOF |
---|
155 | pxetype=$pxetype |
---|
156 | installertype=$installertype |
---|
157 | partitioning=$partitioning |
---|
158 | mirrorsite=$mirrorsite |
---|
159 | EOF |
---|
160 | |
---|
161 | |
---|
162 | # Let the postinstall know what we are up to. |
---|
163 | echo "$pxetype" > pxe-install-flag |
---|
164 | |
---|
165 | echo "Initial Debathena installer complete; exiting preconfig to start main install." |
---|
166 | if [ "$pxetype" != "cluster" ] || [ "$installertype" = "beta" ]; then |
---|
167 | echo "Hit return to continue." |
---|
168 | read r |
---|
169 | fi |
---|
170 | exit 0 |
---|