1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # setup 4.1 - install a MINIX distribution
|
---|
4 | #
|
---|
5 | # Changes:
|
---|
6 | # Aug 2005 robustness checks and beautifications (Jorrit N. Herder)
|
---|
7 | # Jul 2005 extended with autopart and networking (Ben Gras)
|
---|
8 | # Dec 20, 1994 created (Kees J. Bot)
|
---|
9 | #
|
---|
10 |
|
---|
11 | LOCALRC=/usr/etc/rc.local
|
---|
12 | MYLOCALRC=/mnt/etc/rc.local
|
---|
13 | ROOTMB=16
|
---|
14 | ROOTSECTS="`expr $ROOTMB '*' 1024 '*' 2`"
|
---|
15 | USRKBFILE=/.usrkb
|
---|
16 | if [ ! -f "$USRKBFILE" ]
|
---|
17 | then echo "Are you really running from CD?"
|
---|
18 | echo "No $USRKBFILE file."
|
---|
19 | exit 1
|
---|
20 | fi
|
---|
21 | USRKB="`cat /.usrkb`"
|
---|
22 | TOTALMB="`expr 3 + $USRKB / 1024 + $ROOTMB`"
|
---|
23 | ROOTFILES="`cat /.rootfiles`"
|
---|
24 | USRFILES="`cat /.usrfiles`"
|
---|
25 | EXTRASRCFILES="`cat /.extrasrcfiles`"
|
---|
26 | EXTRASRCKB="`cat /.extrasrckb`"
|
---|
27 |
|
---|
28 | # Install size without extra sources (rounded up)
|
---|
29 | NOSRCMB="`expr $TOTALMB - $EXTRASRCKB / 1024`"
|
---|
30 | NOSRCUSRFILES="`expr $USRFILES - $EXTRASRCFILES`"
|
---|
31 |
|
---|
32 | if [ "$EXTRASRCKB" -lt 1 ]
|
---|
33 | then
|
---|
34 | echo "Are you really running from CD?"
|
---|
35 | echo "Something wrong with the extra-source-kb on CD."
|
---|
36 | exit 1
|
---|
37 | fi
|
---|
38 |
|
---|
39 | if [ "$EXTRASRCFILES" -lt 1 ]
|
---|
40 | then
|
---|
41 | echo "Are you really running from CD?"
|
---|
42 | echo "Something wrong with the extra-source-files estimate on CD."
|
---|
43 | exit 1
|
---|
44 | fi
|
---|
45 |
|
---|
46 | if [ "$TOTALMB" -lt 1 ]
|
---|
47 | then
|
---|
48 | echo "Are you really running from CD?"
|
---|
49 | echo "Something wrong with size estimate on CD."
|
---|
50 | exit 1
|
---|
51 | fi
|
---|
52 |
|
---|
53 | if [ "$ROOTFILES" -lt 1 ]
|
---|
54 | then
|
---|
55 | echo "Are you really running from CD?"
|
---|
56 | echo "Something wrong with root files count on CD."
|
---|
57 | exit 1
|
---|
58 | fi
|
---|
59 |
|
---|
60 | if [ "$USRFILES" -lt 1 ]
|
---|
61 | then
|
---|
62 | echo "Are you really running from CD?"
|
---|
63 | echo "Something wrong with usr files count on CD."
|
---|
64 | exit 1
|
---|
65 | fi
|
---|
66 |
|
---|
67 | PATH=/bin:/usr/bin
|
---|
68 | export PATH
|
---|
69 |
|
---|
70 |
|
---|
71 | usage()
|
---|
72 | {
|
---|
73 | cat >&2 <<'EOF'
|
---|
74 | Usage: setup # Install a skeleton system on the hard disk.
|
---|
75 | setup /usr # Install the rest of the system (binaries or sources).
|
---|
76 |
|
---|
77 | # To install from other things then floppies:
|
---|
78 |
|
---|
79 | urlget http://... | setup /usr # Read from a web site.
|
---|
80 | urlget ftp://... | setup /usr # Read from an FTP site.
|
---|
81 | mtools copy c0d0p0:... - | setup /usr # Read from the C: drive.
|
---|
82 | dosread c0d0p0 ... | setup /usr # Likewise if no mtools.
|
---|
83 | EOF
|
---|
84 | exit 1
|
---|
85 | }
|
---|
86 |
|
---|
87 | warn()
|
---|
88 | {
|
---|
89 | echo -e "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b ! $1"
|
---|
90 | }
|
---|
91 |
|
---|
92 | # No options.
|
---|
93 | while getopts '' opt; do usage; done
|
---|
94 | shift `expr $OPTIND - 1`
|
---|
95 |
|
---|
96 | if [ "$USER" != root ]
|
---|
97 | then echo "Please run setup as root."
|
---|
98 | exit 1
|
---|
99 | fi
|
---|
100 |
|
---|
101 | # Find out what we are running from.
|
---|
102 | exec 9<&0 </etc/mtab # Mounted file table.
|
---|
103 | read thisroot rest # Current root (/dev/ram or /dev/fd?)
|
---|
104 | read fdusr rest # USR (/dev/fd? or /dev/fd?p2)
|
---|
105 | exec 0<&9 9<&-
|
---|
106 |
|
---|
107 | # What do we know about ROOT?
|
---|
108 | case $thisroot:$fdusr in
|
---|
109 | /dev/ram:/dev/fd0p2) fdroot=/dev/fd0 # Combined ROOT+USR in drive 0
|
---|
110 | ;;
|
---|
111 | /dev/ram:/dev/fd1p2) fdroot=/dev/fd1 # Combined ROOT+USR in drive 1
|
---|
112 | ;;
|
---|
113 | /dev/ram:/dev/fd*) fdroot=unknown # ROOT is some other floppy
|
---|
114 | ;;
|
---|
115 | /dev/fd*:/dev/fd*) fdroot=$thisroot # ROOT is mounted directly
|
---|
116 | ;;
|
---|
117 | *) fdroot=$thisroot # ?
|
---|
118 | esac
|
---|
119 |
|
---|
120 | echo -n "
|
---|
121 | Welcome to the MINIX 3 setup script. This script will guide you in setting up
|
---|
122 | MINIX on your machine. Please consult the manual for detailed instructions.
|
---|
123 |
|
---|
124 | Note 1: If the screen blanks, hit CTRL+F3 to select \"software scrolling\".
|
---|
125 | Note 2: If things go wrong then hit CTRL+C to abort and start over.
|
---|
126 | Note 3: Default answers, like [y], can simply be chosen by hitting ENTER.
|
---|
127 | Note 4: If you see a colon (:) then you should hit ENTER to continue.
|
---|
128 | :"
|
---|
129 | read ret
|
---|
130 |
|
---|
131 | # begin Step 1
|
---|
132 | echo ""
|
---|
133 | echo " --- Step 1: Select keyboard type --------------------------------------"
|
---|
134 | echo ""
|
---|
135 |
|
---|
136 | echo "What type of keyboard do you have? You can choose one of:"
|
---|
137 | echo ""
|
---|
138 | ls -C /usr/lib/keymaps | sed -e 's/\.map//g' -e 's/^/ /'
|
---|
139 | echo ""
|
---|
140 | step1=""
|
---|
141 | while [ "$step1" != ok ]
|
---|
142 | do
|
---|
143 | echo -n "Keyboard type? [us-std] "; read keymap
|
---|
144 | test -n "$keymap" || keymap=us-std
|
---|
145 | if loadkeys "/usr/lib/keymaps/$keymap.map" 2>/dev/null
|
---|
146 | then step1=ok
|
---|
147 | else warn "invalid keyboard"
|
---|
148 | fi
|
---|
149 | done
|
---|
150 | # end Step 1
|
---|
151 |
|
---|
152 | # begin Step 2
|
---|
153 | echo ""
|
---|
154 | echo " --- Step 2: Select your Ethernet chip ---------------------------------"
|
---|
155 | echo ""
|
---|
156 |
|
---|
157 | # Ask user about networking
|
---|
158 | echo "MINIX 3 currently supports the following Ethernet cards. Please choose: "
|
---|
159 | echo ""
|
---|
160 | echo "0. No Ethernet card (no networking)"
|
---|
161 | echo "1. Intel Pro/100"
|
---|
162 | echo "2. 3Com 501 or 3Com 509 based card"
|
---|
163 | echo "3. Realtek 8139 based card"
|
---|
164 | echo "4. Realtek 8029 based card (also emulated by Qemu)"
|
---|
165 | echo " Note: If you want to use this in Qemu, set 'qemu_pci=1' in the boot monitor."
|
---|
166 | echo "5. NE2000, 3com 503 or WD based card (also emulated by Bochs)"
|
---|
167 | echo "6. AMD LANCE (also emulated by VMWare)"
|
---|
168 | echo "7. Different Ethernet card (no networking)"
|
---|
169 | echo ""
|
---|
170 | echo "You can always change your mind after the setup."
|
---|
171 | echo ""
|
---|
172 | step2=""
|
---|
173 | while [ "$step2" != ok ]
|
---|
174 | do
|
---|
175 | eth=""
|
---|
176 | echo -n "Ethernet card? [0] "; read eth
|
---|
177 | test -z $eth && eth=0
|
---|
178 | driver=""
|
---|
179 | driverargs=""
|
---|
180 | case "$eth" in
|
---|
181 | 0) step2="ok"; ;;
|
---|
182 | 1) step2="ok"; driver=fxp; ;;
|
---|
183 | 2) step2="ok"; driver=dpeth; driverargs="#dpeth_arg='DPETH0=port:irq:memory'";
|
---|
184 | echo ""
|
---|
185 | echo "Note: After installing, edit $LOCALRC to the right configuration."
|
---|
186 | ;;
|
---|
187 | 3) step2="ok"; driver=rtl8139; ;;
|
---|
188 | 4) step2="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=pci'"; ;;
|
---|
189 | 5) step2="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=240:9'";
|
---|
190 | echo ""
|
---|
191 | echo "Note: After installing, edit $LOCALRC to the right configuration."
|
---|
192 | echo " chose option 4, the defaults for emulation by Bochs have been set."
|
---|
193 | ;;
|
---|
194 | 6) driver="lance"; driverargs="lance_arg='LANCE0=on'"; step2="ok"; ;;
|
---|
195 | 7) step2="ok"; ;;
|
---|
196 | *) warn "choose a number"
|
---|
197 | esac
|
---|
198 | done
|
---|
199 | # end Step 2
|
---|
200 |
|
---|
201 | # begin Step 3
|
---|
202 | step3=""
|
---|
203 | while [ "$step3" != ok ]
|
---|
204 | do
|
---|
205 | echo ""
|
---|
206 | echo " --- Step 3: Select minimal or full distribution -----------------------"
|
---|
207 | echo ""
|
---|
208 | echo "You can install MINIX as (M)inimal or (F)ull. (M)inimal"
|
---|
209 | echo "includes only the binary system and basic system sources."
|
---|
210 | echo "(F)ull also includes commands sources."
|
---|
211 | echo ""
|
---|
212 | echo "Please select:"
|
---|
213 | echo " (M)inimal install (only basic sources) ($NOSRCMB MB required)"
|
---|
214 | echo " (F)ull install (full install) ($TOTALMB MB required)"
|
---|
215 | echo " "
|
---|
216 | echo -n "Basic (M)inimal or (F)ull install? [F] "
|
---|
217 | read conf
|
---|
218 | case "$conf" in
|
---|
219 | "") step3="ok"; nobigsource="" ;;
|
---|
220 | [Ff]*) step3="ok"; nobigsource="" ;;
|
---|
221 | [Mm]*) step3="ok"; nobigsource="1"; TOTALMB=$NOSRCMB; USRFILES=$NOSRCUSRFILES ;;
|
---|
222 | esac
|
---|
223 | done
|
---|
224 | # end Step 3
|
---|
225 |
|
---|
226 | # begin Step 4
|
---|
227 | step4=""
|
---|
228 | while [ "$step4" != ok ]
|
---|
229 | do
|
---|
230 | echo ""
|
---|
231 | echo " --- Step 4: Create or select a partition for MINIX 3 -------------------"
|
---|
232 | echo ""
|
---|
233 |
|
---|
234 | echo "Now you need to create a MINIX 3 partition on your hard disk."
|
---|
235 | echo "It has to have $TOTALMB MB at the very least."
|
---|
236 | echo "You can also select one that's already there."
|
---|
237 | echo " "
|
---|
238 | echo "If you have an existing installation, reinstalling will let you"
|
---|
239 | echo "keep your current partitioning and subpartitioning, and overwrite"
|
---|
240 | echo "everything except your s1 subpartition (/home). If you want to"
|
---|
241 | echo "reinstall, select your existing minix partition."
|
---|
242 | echo " "
|
---|
243 | echo "Unless you are an expert, you are advised to use the automated"
|
---|
244 | echo "step-by-step help in setting up."
|
---|
245 | echo ""
|
---|
246 | ok=""
|
---|
247 | while [ "$ok" = "" ]
|
---|
248 | do
|
---|
249 | echo -n "Press ENTER for automatic mode, or type 'expert': "
|
---|
250 | read mode
|
---|
251 | if [ -z "$mode" ]; then auto="1"; ok="yes"; fi
|
---|
252 | if [ "$mode" = expert ]; then auto=""; ok="yes"; fi
|
---|
253 | if [ "$ok" != yes ]; then warn "try again"; fi
|
---|
254 | done
|
---|
255 |
|
---|
256 | primary=
|
---|
257 |
|
---|
258 | if [ -z "$auto" ]
|
---|
259 | then
|
---|
260 | # Expert mode
|
---|
261 | echo -n "
|
---|
262 | MINIX needs one primary partition of $TOTALMB MB for a full install,
|
---|
263 | plus what you want for /home.
|
---|
264 | The maximum file system currently supported is 4 GB.
|
---|
265 |
|
---|
266 | If there is no free space on your disk then you have to choose an option:
|
---|
267 | (1) Delete one or more partitions
|
---|
268 | (2) Allocate an existing partition to MINIX 3
|
---|
269 | (3) Exit setup and shrink a partition using a different OS
|
---|
270 |
|
---|
271 | To make this partition you will be put in the editor \"part\". Follow the
|
---|
272 | advice under the '!' key to make a new partition of type MINIX. Do not
|
---|
273 | touch an existing partition unless you know precisely what you are doing!
|
---|
274 | Please note the name of the partition (e.g. c0d0p1, c0d1p3, c1d1p0) you
|
---|
275 | make. (See the devices section in usage(8) on MINIX device names.)
|
---|
276 | :"
|
---|
277 | read ret
|
---|
278 |
|
---|
279 | while [ -z "$primary" ]
|
---|
280 | do
|
---|
281 | part || exit
|
---|
282 |
|
---|
283 | echo -n "
|
---|
284 | Please finish the name of the primary partition you have created:
|
---|
285 | (Just type ENTER if you want to rerun \"part\") /dev/"
|
---|
286 | read primary
|
---|
287 | done
|
---|
288 | echo ""
|
---|
289 | echo "This is the point of no return. You have selected to install MINIX"
|
---|
290 | echo "on partition /dev/$primary. Please confirm that you want to use this"
|
---|
291 | echo "selection to install MINIX."
|
---|
292 | echo ""
|
---|
293 | confirmation=""
|
---|
294 | while [ -z "$confirmation" -o "$confirmation" != yes -a "$confirmation" != no ]
|
---|
295 | do
|
---|
296 | echo -n "Are you sure you want to continue? Please enter 'yes' or 'no': "
|
---|
297 | read confirmation
|
---|
298 | if [ "$confirmation" = yes ]; then step4=ok; fi
|
---|
299 | done
|
---|
300 | biosdrivename="Actual BIOS device name unknown, due to expert mode."
|
---|
301 | else
|
---|
302 | if [ "$auto" = "1" ]
|
---|
303 | then
|
---|
304 | # Automatic mode
|
---|
305 | PF="/tmp/pf"
|
---|
306 | if autopart -m$TOTALMB -f$PF
|
---|
307 | then if [ -s "$PF" ]
|
---|
308 | then
|
---|
309 | set `cat $PF`
|
---|
310 | bd="$1"
|
---|
311 | bdn="$2"
|
---|
312 | biosdrivename="Probably, the right command is \"boot $bdn\"."
|
---|
313 | if [ -b "/dev/$bd" ]
|
---|
314 | then primary="$bd"
|
---|
315 | else echo "Funny device $bd from autopart."
|
---|
316 | fi
|
---|
317 | else
|
---|
318 | echo "Didn't find output from autopart."
|
---|
319 | fi
|
---|
320 | else echo "Autopart tool failed. Trying again."
|
---|
321 | fi
|
---|
322 |
|
---|
323 | # Reset at retries and timeouts in case autopart left
|
---|
324 | # them messy.
|
---|
325 | atnormalize
|
---|
326 |
|
---|
327 | if [ -n "$primary" ]; then step4=ok; fi
|
---|
328 | fi
|
---|
329 | fi
|
---|
330 |
|
---|
331 | if [ ! -b "/dev/$primary" ]
|
---|
332 | then echo "/dev/$primary is not a block device."
|
---|
333 | step4=""
|
---|
334 | else
|
---|
335 | devsize="`devsize /dev/$primary`"
|
---|
336 |
|
---|
337 | if [ "$devsize" -lt 1 ]
|
---|
338 | then echo "/dev/$primary is a 0-sized device."
|
---|
339 | step4=""
|
---|
340 | fi
|
---|
341 | fi
|
---|
342 | done # while step4 != ok
|
---|
343 | # end Step 4
|
---|
344 |
|
---|
345 | root=${primary}s0
|
---|
346 | home=${primary}s1
|
---|
347 | usr=${primary}s2
|
---|
348 | umount /dev/$root 2>/dev/null && echo "Unmounted $root for you."
|
---|
349 | umount /dev/$home 2>/dev/null && echo "Unmounted $home for you."
|
---|
350 | umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you."
|
---|
351 |
|
---|
352 | devsizemb="`expr $devsize / 1024 / 2`"
|
---|
353 | maxhome="`expr $devsizemb - $TOTALMB - 1`"
|
---|
354 |
|
---|
355 | if [ "$devsizemb" -lt "$TOTALMB" ]
|
---|
356 | then echo "The selected partition ($devsizemb MB) is too small."
|
---|
357 | echo "You'll need $TOTALMB MB at least."
|
---|
358 | exit 1
|
---|
359 | fi
|
---|
360 |
|
---|
361 | if [ "$maxhome" -lt 1 ]
|
---|
362 | then echo "Note: you can't have /home with that size partition."
|
---|
363 | maxhome=0
|
---|
364 | fi
|
---|
365 |
|
---|
366 | TMPMP=/m
|
---|
367 | mkdir $TMPMP >/dev/null 2>&1
|
---|
368 |
|
---|
369 | confirm=""
|
---|
370 |
|
---|
371 | while [ "$confirm" = "" ]
|
---|
372 | do
|
---|
373 | auto=""
|
---|
374 | echo ""
|
---|
375 | echo " --- Step 5: Reinstall choice ------------------------------------------"
|
---|
376 | if mount -r /dev/$home $TMPMP >/dev/null 2>&1
|
---|
377 | then umount /dev/$home >/dev/null 2>&1
|
---|
378 | echo ""
|
---|
379 | echo "You have selected an existing MINIX 3 partition."
|
---|
380 | echo "Type F for full installation (to overwrite entire partition)"
|
---|
381 | echo "Type R for a reinstallation (existing /home will not be affected)"
|
---|
382 | echo ""
|
---|
383 | echo -n "(F)ull or (R)einstall? [R] "
|
---|
384 | read conf
|
---|
385 | case "$conf" in
|
---|
386 | "") confirm="ok"; auto="r"; ;;
|
---|
387 | [Rr]*) confirm="ok"; auto="r"; ;;
|
---|
388 | [Ff]*) confirm="ok"; auto="" ;;
|
---|
389 | esac
|
---|
390 |
|
---|
391 | else echo ""
|
---|
392 | echo "No old /home found. Doing full install."
|
---|
393 | echo ""
|
---|
394 | confirm="ok";
|
---|
395 | fi
|
---|
396 |
|
---|
397 | done
|
---|
398 |
|
---|
399 | rmdir $TMPMP
|
---|
400 |
|
---|
401 | nohome="0"
|
---|
402 |
|
---|
403 | homesize=""
|
---|
404 | if [ ! "$auto" = r ]
|
---|
405 | then
|
---|
406 | echo ""
|
---|
407 | echo " --- Step 6: Select the size of /home ----------------------------------"
|
---|
408 | while [ -z "$homesize" ]
|
---|
409 | do
|
---|
410 |
|
---|
411 | # 20% of what is left over after / and /usr
|
---|
412 | # are taken.
|
---|
413 | defmb="`expr $maxhome / 5`"
|
---|
414 | if [ "$defmb" -gt "$maxhome" ]
|
---|
415 | then
|
---|
416 | defmb=$maxhome
|
---|
417 | fi
|
---|
418 |
|
---|
419 | echo ""
|
---|
420 | echo "MINIX will take up $TOTALMB MB, without /home."
|
---|
421 | echo -n "How big do you want your /home to be in MB (0-$maxhome) ? [$defmb] "
|
---|
422 | read homesize
|
---|
423 | if [ "$homesize" = "" ] ; then homesize=$defmb; fi
|
---|
424 | if [ "$homesize" -lt 1 ]
|
---|
425 | then nohome=1
|
---|
426 | echo "Ok, not making a /home."
|
---|
427 | homesize=0
|
---|
428 | else
|
---|
429 | if [ "$homesize" -gt "$maxhome" ]
|
---|
430 | then echo "That won't fit!"
|
---|
431 | homesize=""
|
---|
432 | else
|
---|
433 | echo ""
|
---|
434 | echo -n "$homesize MB Ok? [Y] "
|
---|
435 | read ok
|
---|
436 | [ "$ok" = Y -o "$ok" = y -o "$ok" = "" ] || homesize=""
|
---|
437 | fi
|
---|
438 | fi
|
---|
439 | echo ""
|
---|
440 | done
|
---|
441 | # Homesize in sectors
|
---|
442 | homemb="$homesize MB"
|
---|
443 | homesize="`expr $homesize '*' 1024 '*' 2`"
|
---|
444 | else
|
---|
445 | homepart="`devsize /dev/$home`"
|
---|
446 | homesize="`expr $homepart / 2 / 1024`"
|
---|
447 | if [ "$homesize" -gt "$maxhome" ]
|
---|
448 | then
|
---|
449 | echo "Sorry, but your /home is too big ($homesize MB) to leave enough"
|
---|
450 | echo "space on the rest of the partition ($devsizemb MB) for your"
|
---|
451 | echo "selected installation size ($TOTALMB MB)."
|
---|
452 | exit 1
|
---|
453 | fi
|
---|
454 | # Homesize unchanged (reinstall)
|
---|
455 | homesize=exist
|
---|
456 | homemb="current size"
|
---|
457 | fi
|
---|
458 |
|
---|
459 | blockdefault=4
|
---|
460 |
|
---|
461 | if [ ! "$auto" = "r" ]
|
---|
462 | then
|
---|
463 | echo ""
|
---|
464 | echo " --- Step 7: Select a block size ---------------------------------------"
|
---|
465 | echo ""
|
---|
466 |
|
---|
467 | echo "The maximum (and default) file system block size is $blockdefault KB."
|
---|
468 | echo "For a small disk or small RAM you may want 1 or 2 KB blocks."
|
---|
469 | echo ""
|
---|
470 |
|
---|
471 | while [ -z "$blocksize" ]
|
---|
472 | do
|
---|
473 | echo -n "Block size in kilobytes? [$blockdefault] "; read blocksize
|
---|
474 | test -z "$blocksize" && blocksize=$blockdefault
|
---|
475 | if [ "$blocksize" -ne 1 -a "$blocksize" -ne 2 -a "$blocksize" -ne $blockdefault ]
|
---|
476 | then
|
---|
477 | warn "1, 2 or 4 please"
|
---|
478 | blocksize=""
|
---|
479 | fi
|
---|
480 | done
|
---|
481 | else
|
---|
482 | blocksize=$blockdefault
|
---|
483 | fi
|
---|
484 |
|
---|
485 | blocksizebytes="`expr $blocksize '*' 1024`"
|
---|
486 |
|
---|
487 | echo "
|
---|
488 | You have selected to (re)install MINIX 3 in the partition /dev/$primary.
|
---|
489 | The following subpartitions are now being created on /dev/$primary:
|
---|
490 |
|
---|
491 | Root subpartition: /dev/$root $ROOTMB MB
|
---|
492 | /home subpartition: /dev/$home $homemb
|
---|
493 | /usr subpartition: /dev/$usr rest of $primary
|
---|
494 | "
|
---|
495 | # Secondary master bootstrap.
|
---|
496 | installboot -m /dev/$primary /usr/mdec/masterboot >/dev/null || exit
|
---|
497 | # Partition the primary.
|
---|
498 | partition /dev/$primary 1 81:${ROOTSECTS}* 81:$homesize 81:0+ > /dev/null || exit
|
---|
499 |
|
---|
500 | echo "Creating /dev/$root for / .."
|
---|
501 | mkfs -B $blocksizebytes /dev/$root || exit
|
---|
502 |
|
---|
503 | if [ "$nohome" = 0 ]
|
---|
504 | then
|
---|
505 | if [ ! "$auto" = r ]
|
---|
506 | then echo "Creating /dev/$home for /home .."
|
---|
507 | mkfs -B $blocksizebytes /dev/$home || exit
|
---|
508 | fi
|
---|
509 | else echo "Skipping /home"
|
---|
510 | fi
|
---|
511 |
|
---|
512 | echo "Creating /dev/$usr for /usr .."
|
---|
513 | mkfs -B $blocksizebytes /dev/$usr || exit
|
---|
514 |
|
---|
515 | echo ""
|
---|
516 | echo " --- Step 8: Wait for bad block detection ------------------------------"
|
---|
517 | echo ""
|
---|
518 | echo "Scanning disk for bad blocks. Hit CTRL+C to stop the scan if you are"
|
---|
519 | echo "sure that there can not be any bad blocks. Otherwise just wait."
|
---|
520 |
|
---|
521 | trap ': nothing;echo' 2
|
---|
522 |
|
---|
523 | echo ""
|
---|
524 | echo "Scanning /dev/$root for bad blocks:"
|
---|
525 | readall -b /dev/$root | sh
|
---|
526 |
|
---|
527 | if [ "$nohome" = 0 ]
|
---|
528 | then
|
---|
529 | echo ""
|
---|
530 | echo "Scanning /dev/$home for bad blocks:"
|
---|
531 | readall -b /dev/$home | sh
|
---|
532 | fshome="home=/dev/$home"
|
---|
533 | else fshome=""
|
---|
534 | fi
|
---|
535 |
|
---|
536 | echo ""
|
---|
537 | echo "Scanning /dev/$usr for bad blocks:"
|
---|
538 | readall -b /dev/$usr | sh
|
---|
539 |
|
---|
540 | trap 2
|
---|
541 |
|
---|
542 | echo ""
|
---|
543 | echo " --- Step 9: Wait for files to be copied -------------------------------"
|
---|
544 | echo ""
|
---|
545 | echo "This is the final step of the MINIX 3 setup. All files will now be"
|
---|
546 | echo "copied to your hard disk. This may take a while."
|
---|
547 | echo ""
|
---|
548 |
|
---|
549 | mount /dev/$usr /mnt >/dev/null || exit # Mount the intended /usr.
|
---|
550 |
|
---|
551 | (cd /usr || exit 1
|
---|
552 | if [ "$nobigsource" = 1 ]
|
---|
553 | then list="`ls | fgrep -v src. | fgrep -v install`"
|
---|
554 | else list="`ls | fgrep -v install`"
|
---|
555 | fi
|
---|
556 | for d in $list
|
---|
557 | do
|
---|
558 | cpdir -v $d /mnt/$d
|
---|
559 | done
|
---|
560 | ) | progressbar "$USRFILES" || exit # Copy the usr floppy.
|
---|
561 |
|
---|
562 | if [ -d /mnt/src.commands ]
|
---|
563 | then mv /mnt/src.commands /mnt/src/commands
|
---|
564 | fi
|
---|
565 |
|
---|
566 | if [ -d /mnt/src.contrib ]
|
---|
567 | then mv /mnt/src.contrib /mnt/src/contrib
|
---|
568 | fi
|
---|
569 | # Set inet.conf to correct driver
|
---|
570 | if [ -n "$driver" ]
|
---|
571 | then echo "$driverargs" >$MYLOCALRC
|
---|
572 | fi
|
---|
573 |
|
---|
574 | umount /dev/$usr >/dev/null || exit # Unmount the intended /usr.
|
---|
575 | mount /dev/$root /mnt >/dev/null || exit
|
---|
576 |
|
---|
577 | # Running from the installation CD.
|
---|
578 | cpdir -vx / /mnt | progressbar "$ROOTFILES" || exit
|
---|
579 | cp /mnt/etc/motd.install /mnt/etc/motd
|
---|
580 |
|
---|
581 | # Fix /var/log
|
---|
582 | rm /mnt/var/log
|
---|
583 | ln -s /usr/log /mnt/var/log
|
---|
584 |
|
---|
585 | if [ -n "$driver" ]
|
---|
586 | then echo "eth0 $driver 0 { default; };" >/mnt/etc/inet.conf
|
---|
587 | fi
|
---|
588 |
|
---|
589 | # CD remnants that aren't for the installed system
|
---|
590 | rm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null
|
---|
591 | # Change /etc/fstab. (No swap.)
|
---|
592 | # ${swap:+swap=/dev/$swap}
|
---|
593 | echo >/mnt/etc/fstab "\
|
---|
594 | # Poor man's File System Table.
|
---|
595 |
|
---|
596 | root=/dev/$root
|
---|
597 | usr=/dev/$usr
|
---|
598 | $fshome"
|
---|
599 |
|
---|
600 | # National keyboard map.
|
---|
601 | test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap
|
---|
602 |
|
---|
603 | umount /dev/$root >/dev/null || exit # Unmount the new root.
|
---|
604 | mount /dev/$usr /mnt >/dev/null || exit
|
---|
605 |
|
---|
606 | # Make bootable.
|
---|
607 | installboot -d /dev/$root /usr/mdec/bootblock /boot/boot >/dev/null || exit
|
---|
608 |
|
---|
609 | edparams /dev/$root "rootdev=$root; ramimagedev=$root; minix(1,Start MINIX 3 (requires at least 16 MB RAM)) { image=/boot/image_big; boot; }; smallminix(2,Start Small MINIX 3 (intended for 8 MB RAM systems)) { image=/boot/image_small; boot; }; newminix(3,Start Custom MINIX 3) { unset image; boot }; main() { echo By default, MINIX 3 will automatically load in 3 seconds.; echo Press ESC to enter the monitor for special configuration.; trap 3000 boot; menu; }; save" || exit
|
---|
610 | pfile="/mnt/src/tools/fdbootparams"
|
---|
611 | echo "rootdev=$root; ramimagedev=$root; save" >$pfile
|
---|
612 | # Save name of CD drive
|
---|
613 | cddrive="`mount | grep usr | awk '{ print $1 }' | sed 's/p.*//'`"
|
---|
614 | echo "cddrive=$cddrive" >>/mnt/etc/rc.package
|
---|
615 |
|
---|
616 | bios="`echo $primary | sed -e 's/d./dX/g' -e 's/c.//g'`"
|
---|
617 |
|
---|
618 | if [ ! "$auto" = "r" ]
|
---|
619 | then if mount /dev/$home /home 2>/dev/null
|
---|
620 | then for u in bin ast
|
---|
621 | do if mkdir ~$u
|
---|
622 | then echo " * Creating home directory for $u in ~$u"
|
---|
623 | cpdir /usr/ast ~$u
|
---|
624 | chown -R $u:operator ~$u
|
---|
625 | else echo " * Couldn't create ~$u"
|
---|
626 | fi
|
---|
627 | done
|
---|
628 | umount /dev/$home
|
---|
629 | fi
|
---|
630 | fi
|
---|
631 |
|
---|
632 | echo "Saving random data.."
|
---|
633 | dd if=/dev/random of=/mnt/adm/random.dat bs=1024 count=1
|
---|
634 |
|
---|
635 | echo "
|
---|
636 | Please type 'shutdown' to exit MINIX 3 and enter the boot monitor. At
|
---|
637 | the boot monitor prompt, type 'boot $bios', where X is the bios drive
|
---|
638 | number of the drive you installed on, to try your new MINIX system.
|
---|
639 | $biosdrivename
|
---|
640 |
|
---|
641 | This ends the MINIX 3 setup script. After booting your newly set up system,
|
---|
642 | you can run the test suites as indicated in the setup manual. You also
|
---|
643 | may want to take care of local configuration, such as securing your system
|
---|
644 | with a password. Please consult the usage manual for more information.
|
---|
645 |
|
---|
646 | "
|
---|
647 |
|
---|