1433d6423SLionel Sambuc#!/bin/sh 2433d6423SLionel Sambuc# 3433d6423SLionel Sambuc# setup 4.1 - install a MINIX distribution 4433d6423SLionel Sambuc# 5433d6423SLionel Sambuc# Changes: 6433d6423SLionel Sambuc# Aug 2005 robustness checks and beautifications (Jorrit N. Herder) 7433d6423SLionel Sambuc# Jul 2005 extended with autopart and networking (Ben Gras) 8433d6423SLionel Sambuc# Dec 20, 1994 created (Kees J. Bot) 9433d6423SLionel Sambuc# 10433d6423SLionel Sambuc 11433d6423SLionel SambucLOCALRC=/usr/etc/rc.local 12433d6423SLionel SambucMYLOCALRC=/mnt/etc/rc.local 13fcba33f5SBen GrasROOTMB=128 14433d6423SLionel SambucROOTSECTS="`expr $ROOTMB '*' 1024 '*' 2`" 15433d6423SLionel SambucBOOTXXSECTS=32 16433d6423SLionel SambucUSRKB="`du -sxk /usr | awk '{ print $1 }'`" 17433d6423SLionel SambucTOTALMB="`expr 3 + $USRKB / 1024 + $ROOTMB`" 18*69eead77SJean-Baptiste BoricTOTALFILES="`find -x / | wc -l`" 19433d6423SLionel Sambuc 20433d6423SLionel Sambuc# /usr/install isn't copied onto the new system; compensate 21433d6423SLionel SambucINSTALLDIR=/usr/install 22433d6423SLionel Sambucif [ -d $INSTALLDIR ] 23433d6423SLionel Sambucthen USRFILES=$(($USRFILES - `find -x $INSTALLDIR | wc -l`)) 24433d6423SLionel Sambuc USRKB=$(($USRKB - `du -sxk $INSTALLDIR | awk '{ print $1 }'`)) 25433d6423SLionel Sambucfi 26433d6423SLionel Sambuc 27433d6423SLionel Sambucif [ -z "$FSTYPE" ] 28433d6423SLionel Sambucthen FSTYPE=mfs 29433d6423SLionel Sambucfi 30433d6423SLionel Sambuc 31433d6423SLionel SambucPATH=/bin:/sbin:/usr/bin:/usr/sbin 32433d6423SLionel Sambucexport PATH 33433d6423SLionel Sambuc 34433d6423SLionel Sambuc 35433d6423SLionel Sambucusage() 36433d6423SLionel Sambuc{ 37433d6423SLionel Sambuc cat >&2 <<'EOF' 38433d6423SLionel SambucUsage: setup # Install a skeleton system on the hard disk. 39433d6423SLionel Sambuc setup /usr # Install the rest of the system (binaries or sources). 40433d6423SLionel Sambuc 41433d6423SLionel Sambuc # To install from other things then floppies: 42433d6423SLionel Sambuc 43433d6423SLionel Sambuc fetch -q -o - http://... | setup /usr # Read from a web site. 44433d6423SLionel Sambuc fetch -q -o - ftp://... | setup /usr # Read from an FTP site. 45433d6423SLionel Sambuc mtools copy c0d0p0:... - | setup /usr # Read from the C: drive. 46433d6423SLionel Sambuc dosread c0d0p0 ... | setup /usr # Likewise if no mtools. 47433d6423SLionel SambucEOF 48433d6423SLionel Sambuc exit 1 49433d6423SLionel Sambuc} 50433d6423SLionel Sambuc 51433d6423SLionel Sambucwarn() 52433d6423SLionel Sambuc{ 53433d6423SLionel Sambuc 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" 54433d6423SLionel Sambuc} 55433d6423SLionel Sambuc 56433d6423SLionel Sambuccheck_mbr() 57433d6423SLionel Sambuc{ 58433d6423SLionel Sambuc # check for potential problems with old mbr. 59433d6423SLionel Sambuc disk=`echo -n "/dev/$primary" | sed 's/p[0-3]//'` 60433d6423SLionel Sambuc minix_primaries=`echo -n "" | fdisk "$disk" | grep "MINIX" | wc -l` 61433d6423SLionel Sambuc if [ "$minix_primaries" -gt 1 ] 62433d6423SLionel Sambuc then 63433d6423SLionel Sambuc # old mbr + bootxx will not work with several partitions of 64433d6423SLionel Sambuc # the same type. 65433d6423SLionel Sambuc dd if=/usr/mdec/mbr of=temp_mbr_netbsd bs=1 count=440 2>/dev/null 66433d6423SLionel Sambuc dd if="$disk" bs=1 count=440 2>/dev/null | cmp - temp_mbr_netbsd >/dev/null 67433d6423SLionel Sambuc if [ "$?" -ne 0 ] 68433d6423SLionel Sambuc then 69433d6423SLionel Sambuc echo "" 70433d6423SLionel Sambuc echo "Warning: you have MBR which doesn't support multiple MINIX 3 partitions!" 71433d6423SLionel Sambuc echo "You will be able to boot from the first one only!" 72433d6423SLionel Sambuc echo -n "Do you want to install new MBR into $disk? [Y] " 73433d6423SLionel Sambuc read ok 74433d6423SLionel Sambuc if [ "$ok" = Y -o "$ok" = y -o "$ok" = "" ] 75433d6423SLionel Sambuc then 76433d6423SLionel Sambuc installboot_nbsd -m "$disk" /usr/mdec/mbr >/dev/null 77433d6423SLionel Sambuc fi 78433d6423SLionel Sambuc fi 79433d6423SLionel Sambuc rm temp_mbr_netbsd 80433d6423SLionel Sambuc fi 81433d6423SLionel Sambuc 82433d6423SLionel Sambuc} 83433d6423SLionel Sambuc 84433d6423SLionel Sambuc# No options. 85433d6423SLionel Sambucwhile getopts '' opt; do usage; done 86433d6423SLionel Sambucshift `expr $OPTIND - 1` 87433d6423SLionel Sambuc 88433d6423SLionel Sambucif [ "$USER" != root ] 89433d6423SLionel Sambucthen echo "Please run setup as root." 90433d6423SLionel Sambuc exit 1 91433d6423SLionel Sambucfi 92433d6423SLionel Sambuc 93433d6423SLionel Sambuc# Find out what we are running from. 94433d6423SLionel Sambucexec 9<&0 </etc/mtab # Mounted file table. 95433d6423SLionel Sambucread thisroot rest # Current root (/dev/ram or /dev/fd?) 96433d6423SLionel Sambucread fdusr rest # USR (/dev/fd? or /dev/fd?p2) 97433d6423SLionel Sambucexec 0<&9 9<&- 98433d6423SLionel Sambuc 99433d6423SLionel Sambuc# What do we know about ROOT? 100433d6423SLionel Sambuccase $thisroot:$fdusr in 101433d6423SLionel Sambuc/dev/ram:/dev/fd0p2) fdroot=/dev/fd0 # Combined ROOT+USR in drive 0 102433d6423SLionel Sambuc ;; 103433d6423SLionel Sambuc/dev/ram:/dev/fd1p2) fdroot=/dev/fd1 # Combined ROOT+USR in drive 1 104433d6423SLionel Sambuc ;; 105433d6423SLionel Sambuc/dev/ram:/dev/fd*) fdroot=unknown # ROOT is some other floppy 106433d6423SLionel Sambuc ;; 107433d6423SLionel Sambuc/dev/fd*:/dev/fd*) fdroot=$thisroot # ROOT is mounted directly 108433d6423SLionel Sambuc ;; 109433d6423SLionel Sambuc*) fdroot=$thisroot # ? 110433d6423SLionel Sambucesac 111433d6423SLionel Sambuc 112433d6423SLionel Sambucecho -n " 113433d6423SLionel SambucWelcome to the MINIX 3 setup script. This script will guide you in setting up 114433d6423SLionel SambucMINIX on your machine. Please consult the manual for detailed instructions. 115433d6423SLionel Sambuc 116433d6423SLionel SambucNote 1: If the screen blanks, hit CTRL+F3 to select \"software scrolling\". 117433d6423SLionel SambucNote 2: If things go wrong then hit CTRL+C to abort and start over. 118433d6423SLionel SambucNote 3: Default answers, like [y], can simply be chosen by hitting ENTER. 119433d6423SLionel SambucNote 4: If you see a colon (:) then you should hit ENTER to continue. 120433d6423SLionel Sambuc:" 121433d6423SLionel Sambucread ret 122433d6423SLionel Sambuc 123433d6423SLionel Sambuc# begin Step 1 124433d6423SLionel Sambucecho "" 125433d6423SLionel Sambucecho " --- Step 1: Select keyboard type --------------------------------------" 126433d6423SLionel Sambucecho "" 127433d6423SLionel Sambuc 128433d6423SLionel Sambuc echo "What type of keyboard do you have? You can choose one of:" 129433d6423SLionel Sambuc echo "" 130433d6423SLionel Sambuc ls -C /usr/lib/keymaps | sed -e 's/\.map//g' -e 's/^/ /' 131433d6423SLionel Sambuc echo "" 132433d6423SLionel Sambucstep1="" 133433d6423SLionel Sambucwhile [ "$step1" != ok ] 134433d6423SLionel Sambucdo 135433d6423SLionel Sambuc echo -n "Keyboard type? [us-std] "; read keymap 136433d6423SLionel Sambuc test -n "$keymap" || keymap=us-std 137433d6423SLionel Sambuc if loadkeys "/usr/lib/keymaps/$keymap.map" 2>/dev/null 138433d6423SLionel Sambuc then step1=ok 139433d6423SLionel Sambuc else warn "invalid keyboard" 140433d6423SLionel Sambuc fi 141433d6423SLionel Sambucdone 142433d6423SLionel Sambuc# end Step 1 143433d6423SLionel Sambuc 144433d6423SLionel Sambuc# begin Step 2 145433d6423SLionel Sambuc#step2="" 146433d6423SLionel Sambuc#while [ "$step2" != ok ] 147433d6423SLionel Sambuc#do 148433d6423SLionel Sambuc# echo "" 149433d6423SLionel Sambuc# echo " --- Step 2: Select minimal or full distribution -----------------------" 150433d6423SLionel Sambuc# echo "" 151433d6423SLionel Sambuc# echo "You can install MINIX as (M)inimal or (F)ull. (M)inimal" 152433d6423SLionel Sambuc# echo "includes only the binary system and basic system sources." 153433d6423SLionel Sambuc# echo "(F)ull also includes commands sources." 154433d6423SLionel Sambuc# echo "" 155433d6423SLionel Sambuc# echo "Please select:" 156433d6423SLionel Sambuc# echo " (M)inimal install (only basic sources) ($NOSRCMB MB required)" 157433d6423SLionel Sambuc# echo " (F)ull install (full install) ($TOTALMB MB required)" 158433d6423SLionel Sambuc# echo " " 159433d6423SLionel Sambuc# echo -n "Basic (M)inimal or (F)ull install? [F] " 160433d6423SLionel Sambuc# read conf 161433d6423SLionel Sambuc# case "$conf" in 162433d6423SLionel Sambuc# "") step2="ok"; nobigsource="" ;; 163433d6423SLionel Sambuc# [Ff]*) step2="ok"; nobigsource="" ;; 164433d6423SLionel Sambuc# [Mm]*) step2="ok"; nobigsource="1"; TOTALMB=$NOSRCMB; USRFILES=$NOSRCUSRFILES ;; 165433d6423SLionel Sambuc# esac 166433d6423SLionel Sambuc#done 167433d6423SLionel Sambuc# end Step 2 168433d6423SLionel Sambuc 169433d6423SLionel Sambucecho "" 170433d6423SLionel Sambucecho " --- Step 2: Selecting full distribution -------------------------------" 171433d6423SLionel Sambucecho "" 172433d6423SLionel Sambucnobigsource="" 173433d6423SLionel Sambuc 174433d6423SLionel Sambuc# begin Step 3 175433d6423SLionel Sambucstep3="" 176433d6423SLionel Sambucwhile [ "$step3" != ok ] 177433d6423SLionel Sambucdo 178433d6423SLionel Sambuc echo "" 179433d6423SLionel Sambuc echo " --- Step 3: Create or select a partition for MINIX 3 -------------------" 180433d6423SLionel Sambuc echo "" 181433d6423SLionel Sambuc 182433d6423SLionel Sambuc echo "Now you need to create a MINIX 3 partition on your hard disk." 183433d6423SLionel Sambuc echo "You can also select one that's already there." 184433d6423SLionel Sambuc echo " " 185433d6423SLionel Sambuc echo "If you have an existing installation, reinstalling will let you" 186433d6423SLionel Sambuc echo "keep your current partitioning and subpartitioning, and overwrite" 187433d6423SLionel Sambuc echo "everything except your s1 subpartition (/home). If you want to" 188433d6423SLionel Sambuc echo "reinstall, select your existing minix partition." 189433d6423SLionel Sambuc echo " " 190433d6423SLionel Sambuc echo "Unless you are an expert, you are advised to use the automated" 191433d6423SLionel Sambuc echo "step-by-step help in setting up." 192433d6423SLionel Sambuc echo "" 193433d6423SLionel Sambuc ok="" 194433d6423SLionel Sambuc while [ "$ok" = "" ] 195433d6423SLionel Sambuc do 196433d6423SLionel Sambuc echo -n "Press ENTER for automatic mode, or type 'expert': " 197433d6423SLionel Sambuc read mode 198433d6423SLionel Sambuc if [ -z "$mode" ]; then auto="1"; ok="yes"; fi 199433d6423SLionel Sambuc if [ "$mode" = expert ]; then auto=""; ok="yes"; fi 200433d6423SLionel Sambuc if [ "$ok" != yes ]; then warn "try again"; fi 201433d6423SLionel Sambuc done 202433d6423SLionel Sambuc 203433d6423SLionel Sambuc primary= 204433d6423SLionel Sambuc 205433d6423SLionel Sambuc if [ -z "$auto" ] 206433d6423SLionel Sambuc then 207433d6423SLionel Sambuc # Expert mode 208433d6423SLionel Sambuc echo -n " 209433d6423SLionel SambucMINIX needs one primary partition of $TOTALMB MB for a full install, 210433d6423SLionel Sambucplus what you want for /home. 211433d6423SLionel Sambuc 212433d6423SLionel SambucIf there is no free space on your disk then you have to choose an option: 213433d6423SLionel Sambuc (1) Delete one or more partitions 214433d6423SLionel Sambuc (2) Allocate an existing partition to MINIX 3 215433d6423SLionel Sambuc (3) Exit setup and shrink a partition using a different OS 216433d6423SLionel Sambuc 217433d6423SLionel SambucTo make this partition you will be put in the editor \"part\". Follow the 218433d6423SLionel Sambucadvice under the '!' key to make a new partition of type MINIX. Do not 219433d6423SLionel Sambuctouch an existing partition unless you know precisely what you are doing! 220433d6423SLionel SambucPlease note the name of the partition (e.g. c0d0p1, c0d1p3, c1d1p0) you 221433d6423SLionel Sambucmake. (See the devices section in usage(8) on MINIX device names.) 222433d6423SLionel Sambuc:" 223433d6423SLionel Sambuc read ret 224433d6423SLionel Sambuc 225433d6423SLionel Sambuc while [ -z "$primary" ] 226433d6423SLionel Sambuc do 227433d6423SLionel Sambuc part || exit 228433d6423SLionel Sambuc 229433d6423SLionel Sambuc echo -n " 230433d6423SLionel SambucPlease finish the name of the primary partition you have created: 231433d6423SLionel Sambuc(Just type ENTER if you want to rerun \"part\") /dev/" 232433d6423SLionel Sambuc read primary 233433d6423SLionel Sambuc done 234433d6423SLionel Sambuc echo "" 235433d6423SLionel Sambuc echo "This is the point of no return. You have selected to install MINIX" 236433d6423SLionel Sambuc echo "on partition /dev/$primary. Please confirm that you want to use this" 237433d6423SLionel Sambuc echo "selection to install MINIX." 238433d6423SLionel Sambuc echo "" 239433d6423SLionel Sambuc confirmation="" 240433d6423SLionel Sambuc 241433d6423SLionel Sambuc if [ ! -b "/dev/$primary" ] 242433d6423SLionel Sambuc then echo "/dev/$primary is not a block device." 243433d6423SLionel Sambuc fi 244433d6423SLionel Sambuc 245433d6423SLionel Sambuc while [ -z "$confirmation" -o "$confirmation" != yes -a "$confirmation" != no ] 246433d6423SLionel Sambuc do 247433d6423SLionel Sambuc echo -n "Are you sure you want to continue? Please enter 'yes' or 'no': " 248433d6423SLionel Sambuc read confirmation 249433d6423SLionel Sambuc if [ "$confirmation" = yes ]; then step3=ok; fi 250433d6423SLionel Sambuc done 251433d6423SLionel Sambuc biosdrivename="Actual BIOS device name unknown, due to expert mode." 252433d6423SLionel Sambuc else 253433d6423SLionel Sambuc if [ "$auto" = "1" ] 254433d6423SLionel Sambuc then 255433d6423SLionel Sambuc # Automatic mode 256433d6423SLionel Sambuc PF="/tmp/pf" 257433d6423SLionel Sambuc if autopart -m$TOTALMB -f$PF 258433d6423SLionel Sambuc then if [ -s "$PF" ] 259433d6423SLionel Sambuc then 260433d6423SLionel Sambuc set `cat $PF` 261433d6423SLionel Sambuc bd="$1" 262433d6423SLionel Sambuc bdn="$2" 263433d6423SLionel Sambuc biosdrivename="Probably, the right command is \"boot $bdn\"." 264433d6423SLionel Sambuc if [ -b "/dev/$bd" ] 265433d6423SLionel Sambuc then primary="$bd" 266433d6423SLionel Sambuc else echo "Funny device $bd from autopart." 267433d6423SLionel Sambuc fi 268433d6423SLionel Sambuc else 269433d6423SLionel Sambuc echo "Didn't find output from autopart." 270433d6423SLionel Sambuc fi 271433d6423SLionel Sambuc else echo "Autopart tool failed. Trying again." 272433d6423SLionel Sambuc fi 273433d6423SLionel Sambuc 274433d6423SLionel Sambuc # Reset at retries and timeouts in case autopart left 275433d6423SLionel Sambuc # them messy. 276433d6423SLionel Sambuc atnormalize 277433d6423SLionel Sambuc 278433d6423SLionel Sambuc if [ -n "$primary" ]; then step3=ok; fi 279433d6423SLionel Sambuc fi 280433d6423SLionel Sambuc fi 281433d6423SLionel Sambuc 282433d6423SLionel Sambuc if [ ! -b "/dev/$primary" ] 283433d6423SLionel Sambuc then echo Doing step 3 again. 284433d6423SLionel Sambuc step3="" 285433d6423SLionel Sambuc else 286433d6423SLionel Sambuc devsize="`devsize /dev/$primary`" 287433d6423SLionel Sambuc 288433d6423SLionel Sambuc if [ "$devsize" -lt 1 ] 289433d6423SLionel Sambuc then echo "/dev/$primary is a 0-sized device." 290433d6423SLionel Sambuc step3="" 291433d6423SLionel Sambuc fi 292433d6423SLionel Sambuc fi 293433d6423SLionel Sambucdone # while step3 != ok 294433d6423SLionel Sambuc# end Step 3 295433d6423SLionel Sambuc 296433d6423SLionel Sambucroot=${primary}s0 297433d6423SLionel Sambuchome=${primary}s1 298433d6423SLionel Sambucusr=${primary}s2 299433d6423SLionel Sambucumount /dev/$root 2>/dev/null && echo "Unmounted $root for you." 300433d6423SLionel Sambucumount /dev/$home 2>/dev/null && echo "Unmounted $home for you." 301433d6423SLionel Sambucumount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you." 302433d6423SLionel Sambuc 303433d6423SLionel Sambucdevsizemb="`expr $devsize / 1024 / 2`" 304433d6423SLionel Sambucmaxhome="`expr $devsizemb - $TOTALMB - 1`" 305433d6423SLionel Sambuc 306433d6423SLionel Sambucif [ "$devsizemb" -lt "$TOTALMB" ] 307433d6423SLionel Sambucthen echo "The selected partition ($devsizemb MB) is too small." 308433d6423SLionel Sambuc echo "You'll need $TOTALMB MB at least." 309433d6423SLionel Sambuc exit 1 310433d6423SLionel Sambucfi 311433d6423SLionel Sambuc 312433d6423SLionel Sambucif [ "$maxhome" -lt 1 ] 313433d6423SLionel Sambucthen echo "Note: you can't have /home with that size partition." 314433d6423SLionel Sambuc maxhome=0 315433d6423SLionel Sambucfi 316433d6423SLionel Sambuc 317433d6423SLionel SambucTMPMP=/m 318433d6423SLionel Sambucmkdir $TMPMP >/dev/null 2>&1 319433d6423SLionel Sambuc 320433d6423SLionel Sambucconfirm="" 321433d6423SLionel Sambuc 322433d6423SLionel Sambucwhile [ "$confirm" = "" ] 323433d6423SLionel Sambucdo 324433d6423SLionel Sambuc auto="" 325433d6423SLionel Sambuc echo "" 326433d6423SLionel Sambucecho " --- Step 4: Reinstall choice ------------------------------------------" 327433d6423SLionel Sambuc if mount -r /dev/$home $TMPMP >/dev/null 2>&1 328433d6423SLionel Sambuc then umount /dev/$home >/dev/null 2>&1 329433d6423SLionel Sambuc echo "" 330433d6423SLionel Sambuc echo "You have selected an existing MINIX 3 partition." 331433d6423SLionel Sambuc echo "Type F for full installation (to overwrite entire partition)" 332433d6423SLionel Sambuc echo "Type R for a reinstallation (existing /home will not be affected)" 333433d6423SLionel Sambuc echo "Type B to reinstall/upgrade bootloader (no data affected)" 334433d6423SLionel Sambuc echo "" 335433d6423SLionel Sambuc echo -n "(F)ull, (R)einstall or (B)ootloader install? [R] " 336433d6423SLionel Sambuc read conf 337433d6423SLionel Sambuc case "$conf" in 338433d6423SLionel Sambuc "") confirm="ok"; auto="r"; ;; 339433d6423SLionel Sambuc [Rr]*) confirm="ok"; auto="r"; ;; 340433d6423SLionel Sambuc [Ff]*) confirm="ok"; auto="" ;; 341433d6423SLionel Sambuc [Bb]*) confirm="ok"; bootreinstall="ok" ;; 342433d6423SLionel Sambuc esac 343433d6423SLionel Sambuc 344433d6423SLionel Sambuc else echo "" 345433d6423SLionel Sambuc echo "No old /home found. Doing full install." 346433d6423SLionel Sambuc echo "" 347433d6423SLionel Sambuc confirm="ok"; 348433d6423SLionel Sambuc fi 349433d6423SLionel Sambuc 350433d6423SLionel Sambucdone 351433d6423SLionel Sambuc 352433d6423SLionel Sambucif [ "$bootreinstall" = "ok" ] 353433d6423SLionel Sambucthen 354433d6423SLionel Sambuc echo "" 355433d6423SLionel Sambuc echo " --- Step 5: Reinstall bootloader ----------------------------------" 356433d6423SLionel Sambuc echo "" 357433d6423SLionel Sambuc 358433d6423SLionel Sambuc echo "WARNING: This procedure uses your current /usr to store your /." 359433d6423SLionel Sambuc echo "Once the procedure starts, it has to finish" 360433d6423SLionel Sambuc echo "to restore your / partition. Please make sure it is not interrupted." 361433d6423SLionel Sambuc echo "" 362433d6423SLionel Sambuc 363433d6423SLionel Sambuc echo -n "It's recommended to run fsck before you continue, run? [Y/n] " 364433d6423SLionel Sambuc read ok 365433d6423SLionel Sambuc if [ "$ok" = "y" -o "$ok" = "Y" -o "$ok" = "" ] 366433d6423SLionel Sambuc then 3673f072cf3SLionel Sambuc fsck -t mfs -T mfs:-a "/dev/$root" >/dev/null 3683f072cf3SLionel Sambuc fsck -t mfs -T mfs:-a "/dev/$usr" >/dev/null 369433d6423SLionel Sambuc fi 370433d6423SLionel Sambuc 371433d6423SLionel Sambuc # If there is no ELF stuff and not enough space after repartitioning, 372433d6423SLionel Sambuc # user will fall into trouble. So at first copy new stuff. 373433d6423SLionel Sambuc mount "/dev/$root" /mnt >/dev/null || exit 374433d6423SLionel Sambuc 375433d6423SLionel Sambuc # grep, stat, etc in chroot 376433d6423SLionel Sambuc mount "/dev/$usr" /mnt/usr >/dev/null || exit 377433d6423SLionel Sambuc 378433d6423SLionel Sambuc cp -pf /bin/update_bootcfg /mnt/bin/ && \ 379433d6423SLionel Sambuc cp -pf /etc/boot.cfg.default /mnt/etc/ && \ 3803f072cf3SLionel Sambuc cp -pf /usr/mdec/boot_monitor /mnt/ || exit 381433d6423SLionel Sambuc 382433d6423SLionel Sambuc if [ ! -d /mnt/boot/minix_default -o ! -r /mnt/boot/minix_default/kernel ] 383433d6423SLionel Sambuc then 384433d6423SLionel Sambuc if [ -r /mnt/boot.cfg ] 385433d6423SLionel Sambuc then 386433d6423SLionel Sambuc echo "" 387433d6423SLionel Sambuc echo "There is no /boot/minix_default/, but /boot.cfg exists." 388433d6423SLionel Sambuc echo -n "Do you want to copy minix_default from CD? [Y/n] " 389433d6423SLionel Sambuc else 390433d6423SLionel Sambuc echo "" 391433d6423SLionel Sambuc echo -n "There is no /boot/minix_default/, do you want to copy it from CD? [Y/n] " 392433d6423SLionel Sambuc fi 393433d6423SLionel Sambuc read ok 394433d6423SLionel Sambuc if [ "$ok" = "y" -o "$ok" = "Y" -o "$ok" = "" ] 395433d6423SLionel Sambuc then 396433d6423SLionel Sambuc if [ -e /mnt/boot/minix_default ] 397433d6423SLionel Sambuc then 398433d6423SLionel Sambuc echo "Old /boot/minix_default moved to /boot/minix_default_old" 399433d6423SLionel Sambuc mv /mnt/boot/minix_default /mnt/boot/minix_default_old 400433d6423SLionel Sambuc fi 401433d6423SLionel Sambuc 402433d6423SLionel Sambuc cp -rfp /boot/minix_default /mnt/boot/ || exit 403433d6423SLionel Sambuc fi 404433d6423SLionel Sambuc fi 405433d6423SLionel Sambuc 406433d6423SLionel Sambuc echo " * Updating /boot.cfg" 407433d6423SLionel Sambuc 408433d6423SLionel Sambuc chroot /mnt update_bootcfg 409433d6423SLionel Sambuc 410433d6423SLionel Sambuc sync 411433d6423SLionel Sambuc 412433d6423SLionel Sambuc # Get sizes and space availability while the file systems are still 413433d6423SLionel Sambuc # mounted. Otherwise we have to mount them again just for this. 414433d6423SLionel Sambuc required_root_space=`df -kP /dev/$root | awk '{print $3}' | tail -n 1` 415433d6423SLionel Sambuc free_root_space=`df -kP /dev/$root | awk '{print $4}' | tail -n 1` 416433d6423SLionel Sambuc free_usr_space=`df -kP /dev/$usr | awk '{print $4}' | tail -n 1` 417433d6423SLionel Sambuc 418433d6423SLionel Sambuc umount /mnt/usr && umount /mnt || exit 419433d6423SLionel Sambuc 420433d6423SLionel Sambuc # Check if enough space for new boot 4213f072cf3SLionel Sambuc bootspace=$((`devsize /dev/$primary`-`devsize /dev/$root`-`devsize /dev/$home`-`devsize /dev/$usr`)) >/dev/null 422433d6423SLionel Sambuc if [ $bootspace -lt $BOOTXXSECTS ] 423433d6423SLionel Sambuc then 424433d6423SLionel Sambuc echo "" 425433d6423SLionel Sambuc echo "Root partition size will be reduced by up to 16Kb to fit new bootloader." 426433d6423SLionel Sambuc echo "This is not a problem." 427433d6423SLionel Sambuc 428433d6423SLionel Sambuc # round 16 => 20 429433d6423SLionel Sambuc if [ "$free_root_space" -le 20 ] 430433d6423SLionel Sambuc then 431433d6423SLionel Sambuc echo "" 432433d6423SLionel Sambuc echo "Not enough space on /dev/$root, you need at least 20Kb to use new bootloader!" 433433d6423SLionel Sambuc exit 1 434433d6423SLionel Sambuc fi 435433d6423SLionel Sambuc 436433d6423SLionel Sambuc ROOTSECTS=`expr \`devsize /dev/$root\` - $BOOTXXSECTS + $bootspace` 437433d6423SLionel Sambuc 438433d6423SLionel Sambuc if [ "$required_root_space" -gt "$free_usr_space" ] 439433d6423SLionel Sambuc then 440433d6423SLionel Sambuc echo "" 441433d6423SLionel Sambuc echo "You don't have enough free space on /dev/$usr to backup /dev/$root!" 442433d6423SLionel Sambuc echo "${free_usr_space}Kb available, ${required_root_space} required." 443433d6423SLionel Sambuc exit 1 444433d6423SLionel Sambuc fi 445433d6423SLionel Sambuc 446433d6423SLionel Sambuc mkdir /mnt/root && mkdir /mnt/usr || exit 447433d6423SLionel Sambuc 448433d6423SLionel Sambuc echo "Re-mounting your current / and /usr" 449433d6423SLionel Sambuc 450433d6423SLionel Sambuc mount "/dev/$root" /mnt/root || exit 451433d6423SLionel Sambuc mount "/dev/$usr" /mnt/usr || exit 452433d6423SLionel Sambuc 453433d6423SLionel Sambuc mkdir /mnt/usr/tmp/root_backup || exit 454433d6423SLionel Sambuc 455433d6423SLionel Sambuc echo " * Copying / contents" 456433d6423SLionel Sambuc 457433d6423SLionel Sambuc cp -rfp /mnt/root/* /mnt/usr/tmp/root_backup 458433d6423SLionel Sambuc if [ $? -ne 0 ] 459433d6423SLionel Sambuc then 460433d6423SLionel Sambuc echo "" 461433d6423SLionel Sambuc echo "Failed to backup root partition, aborting!" 462433d6423SLionel Sambuc rm -rf /mnt/usr/tmp/root_backup 463433d6423SLionel Sambuc # umount shouldn't fail here, but if it will, next 464433d6423SLionel Sambuc # "rm -rf" will serve for user's pleasure. 465433d6423SLionel Sambuc umount /mnt/root >/dev/null || exit 466433d6423SLionel Sambuc umount /mnt/usr >/dev/null || exit 467433d6423SLionel Sambuc rm -rf /mnt/root /mnt/usr 468433d6423SLionel Sambuc exit 1 469433d6423SLionel Sambuc fi 470433d6423SLionel Sambuc 471433d6423SLionel Sambuc echo " * Copying done" 472433d6423SLionel Sambuc 473433d6423SLionel Sambuc umount /mnt/root 474433d6423SLionel Sambuc umount /mnt/usr 475433d6423SLionel Sambuc 476433d6423SLionel Sambuc add_subpart="" 477433d6423SLionel Sambuc minix_subparts=`echo -n "" | fdisk /dev/$primary | grep "MINIX" | wc -l` 478433d6423SLionel Sambuc if [ "$minix_subparts" -gt 3 ] 479433d6423SLionel Sambuc then 480433d6423SLionel Sambuc echo "" 481433d6423SLionel Sambuc echo "You have additional subpartition except /, /usr and /home." 482433d6423SLionel Sambuc echo "Partition type will be set to MINIX (81), you can change it later using part." 483433d6423SLionel Sambuc echo -n "Do you want to continue? [Y/n] " 484433d6423SLionel Sambuc read ok 485433d6423SLionel Sambuc [ "$ok" = "n" -o "$ok" = "N" ] && exit 486433d6423SLionel Sambuc add_subpart="81:exist" 487433d6423SLionel Sambuc fi 488433d6423SLionel Sambuc 489433d6423SLionel Sambuc echo " * Repartitioning" 490433d6423SLionel Sambuc 491433d6423SLionel Sambuc partition /dev/$primary $BOOTXXSECTS 81:${ROOTSECTS}* 81:exist 81:exist $add_subpart || exit 492433d6423SLionel Sambuc 493433d6423SLionel Sambuc echo " * mkfs on new /" 494433d6423SLionel Sambuc 495433d6423SLionel Sambuc mkfs.mfs "/dev/$root" || exit 496433d6423SLionel Sambuc 497433d6423SLionel Sambuc if [ $? -ne 0 ] 498433d6423SLionel Sambuc then 499433d6423SLionel Sambuc echo "Failed to repartition /dev/$primary" 500433d6423SLionel Sambuc rmdir /mnt/root 501433d6423SLionel Sambuc rmdir /mnt/usr 502433d6423SLionel Sambuc exit 1 503433d6423SLionel Sambuc fi 504433d6423SLionel Sambuc 505433d6423SLionel Sambuc mount "/dev/$usr" /mnt/usr || exit 506433d6423SLionel Sambuc mount "/dev/$root" /mnt/root || exit 507433d6423SLionel Sambuc 508433d6423SLionel Sambuc echo " * Filling new / filesystem" 509433d6423SLionel Sambuc 510433d6423SLionel Sambuc mv /mnt/usr/tmp/root_backup/* /mnt/root/ || exit 511433d6423SLionel Sambuc if [ $? -ne 0 ] 512433d6423SLionel Sambuc then 513433d6423SLionel Sambuc echo "Failed to copy old root data! It is in /tmp/root_backup/" 514433d6423SLionel Sambuc fi 515433d6423SLionel Sambuc 516433d6423SLionel Sambuc rmdir /mnt/usr/tmp/root_backup/ 517433d6423SLionel Sambuc 518433d6423SLionel Sambuc umount /mnt/root 519433d6423SLionel Sambuc umount /mnt/usr 520433d6423SLionel Sambuc fi 521433d6423SLionel Sambuc 522433d6423SLionel Sambuc check_mbr 523433d6423SLionel Sambuc installboot_nbsd -f /dev/$primary /usr/mdec/bootxx_minixfs3 >/dev/null || exit 1 524433d6423SLionel Sambuc 525433d6423SLionel Sambuc if [ $? -ne 0 ] 526433d6423SLionel Sambuc then 527433d6423SLionel Sambuc echo "Warning: failed to remove /tmp/root_backup!" 528433d6423SLionel Sambuc fi 529433d6423SLionel Sambuc 530433d6423SLionel Sambuc echo "New boot installed successfully! You can reboot now." 531433d6423SLionel Sambuc exit 532433d6423SLionel Sambucfi 533433d6423SLionel Sambuc 534433d6423SLionel Sambucrmdir $TMPMP 535433d6423SLionel Sambuc 536433d6423SLionel Sambucnohome="0" 537433d6423SLionel Sambuc 538433d6423SLionel Sambuchomesize="" 539433d6423SLionel Sambucif [ ! "$auto" = r ] 540433d6423SLionel Sambucthen 541433d6423SLionel Sambucecho "" 542433d6423SLionel Sambucecho " --- Step 5: Select the size of /home ----------------------------------" 543433d6423SLionel Sambuc while [ -z "$homesize" ] 544433d6423SLionel Sambuc do 545433d6423SLionel Sambuc 546433d6423SLionel Sambuc # 20% of what is left over after / and /usr 547433d6423SLionel Sambuc # are taken. 548433d6423SLionel Sambuc defmb="`expr $maxhome / 5`" 549433d6423SLionel Sambuc if [ "$defmb" -gt "$maxhome" ] 550433d6423SLionel Sambuc then 551433d6423SLionel Sambuc defmb=$maxhome 552433d6423SLionel Sambuc fi 553433d6423SLionel Sambuc 554433d6423SLionel Sambuc echo "" 555433d6423SLionel Sambuc echo "MINIX will take up $TOTALMB MB, without /home." 556433d6423SLionel Sambuc echo -n "How big do you want your /home to be in MB (0-$maxhome) ? [$defmb] " 557433d6423SLionel Sambuc read homesize 558433d6423SLionel Sambuc if [ "$homesize" = "" ] ; then homesize=$defmb; fi 559433d6423SLionel Sambuc if [ "$homesize" -lt 1 ] 560433d6423SLionel Sambuc then nohome=1 561433d6423SLionel Sambuc echo "Ok, not making a /home." 562433d6423SLionel Sambuc homesize=0 563433d6423SLionel Sambuc else 564433d6423SLionel Sambuc if [ "$homesize" -gt "$maxhome" ] 565433d6423SLionel Sambuc then echo "That won't fit!" 566433d6423SLionel Sambuc homesize="" 567433d6423SLionel Sambuc else 568433d6423SLionel Sambuc echo "" 569433d6423SLionel Sambuc echo -n "$homesize MB Ok? [Y] " 570433d6423SLionel Sambuc read ok 571433d6423SLionel Sambuc [ "$ok" = Y -o "$ok" = y -o "$ok" = "" ] || homesize="" 572433d6423SLionel Sambuc fi 573433d6423SLionel Sambuc fi 574433d6423SLionel Sambuc echo "" 575433d6423SLionel Sambuc done 576433d6423SLionel Sambuc # Homesize in sectors 577433d6423SLionel Sambuc homemb="$homesize MB" 578433d6423SLionel Sambuc homesize="`expr $homesize '*' 1024 '*' 2`" 579433d6423SLionel Sambucelse 580433d6423SLionel Sambuc # Root size same as our default? If not, warn and keep old root size 581433d6423SLionel Sambuc ROOTSECTSDEFAULT=$ROOTSECTS 582433d6423SLionel Sambuc ROOTSECTS="`devsize /dev/$root`" 583433d6423SLionel Sambuc ROOTMB="`expr $ROOTSECTS / 2048`" 584433d6423SLionel Sambuc if [ $ROOTSECTS -ne $ROOTSECTSDEFAULT ] 585433d6423SLionel Sambuc then 586433d6423SLionel Sambuc # Check if we 587433d6423SLionel Sambuc echo "Root partition size `expr $ROOTSECTS / 2`kb differs from default `expr $ROOTSECTSDEFAULT / 2`kb." 588433d6423SLionel Sambuc echo "This is not a problem, but you may want to do a fresh install at some point to" 589433d6423SLionel Sambuc echo "be able to benefit from the new default." 590433d6423SLionel Sambuc fi 591433d6423SLionel Sambuc 592433d6423SLionel Sambuc # Check if enough space for new boot (even if old used) 5933f072cf3SLionel Sambuc bootspace=$((`devsize /dev/$primary`-`devsize /dev/$root`-`devsize /dev/$home`-`devsize /dev/$usr`)) >/dev/null 594433d6423SLionel Sambuc if [ $bootspace -lt $BOOTXXSECTS ] 595433d6423SLionel Sambuc then 596433d6423SLionel Sambuc echo "Root partition size will be reduced by up to 16Kb to fit new bootloader." 597433d6423SLionel Sambuc echo "This is not a problem." 598433d6423SLionel Sambuc ROOTSECTS=`expr $ROOTSECTS - $BOOTXXSECTS + $bootspace` 599433d6423SLionel Sambuc fi 600433d6423SLionel Sambuc 601433d6423SLionel Sambuc # Recompute totals based on root size 602433d6423SLionel Sambuc TOTALMB="`expr 3 + $USRKB / 1024 + $ROOTMB`" 603433d6423SLionel Sambuc maxhome="`expr $devsizemb - $TOTALMB - 1`" 604433d6423SLionel Sambuc 605433d6423SLionel Sambuc homepart="`devsize /dev/$home`" 606433d6423SLionel Sambuc homesize="`expr $homepart / 2 / 1024`" 607433d6423SLionel Sambuc if [ "$homesize" -gt "$maxhome" ] 608433d6423SLionel Sambuc then 609433d6423SLionel Sambuc echo "Sorry, but your /home is too big ($homesize MB) to leave enough" 610433d6423SLionel Sambuc echo "space on the rest of the partition ($devsizemb MB) for your" 611433d6423SLionel Sambuc echo "selected installation size ($TOTALMB MB)." 612433d6423SLionel Sambuc exit 1 613433d6423SLionel Sambuc fi 614433d6423SLionel Sambuc # Homesize unchanged (reinstall) 615433d6423SLionel Sambuc homesize=exist 616433d6423SLionel Sambuc homemb="current size" 617433d6423SLionel Sambucfi 618433d6423SLionel Sambuc 619433d6423SLionel Sambucminblocksize=1 620433d6423SLionel Sambucmaxblocksize=64 621433d6423SLionel Sambucblockdefault=4 622433d6423SLionel Sambuc 623433d6423SLionel Sambucif [ ! "$auto" = "r" ] 624433d6423SLionel Sambucthen 625433d6423SLionel Sambuc echo "" 626433d6423SLionel Sambucecho " --- Step 6: Select a block size ---------------------------------------" 627433d6423SLionel Sambuc echo "" 628433d6423SLionel Sambuc 629433d6423SLionel Sambuc echo "The default file system block size is $blockdefault kB." 630433d6423SLionel Sambuc echo "" 631433d6423SLionel Sambuc 632433d6423SLionel Sambuc while [ -z "$blocksize" ] 633433d6423SLionel Sambuc do 634433d6423SLionel Sambuc echo -n "Block size in kilobytes? [$blockdefault] "; read blocksize 635433d6423SLionel Sambuc test -z "$blocksize" && blocksize=$blockdefault 636433d6423SLionel Sambuc if [ "$blocksize" -lt $minblocksize -o "$blocksize" -gt $maxblocksize ] 637433d6423SLionel Sambuc then 638433d6423SLionel Sambuc warn "At least $minblocksize kB and at most $maxblocksize kB please." 639433d6423SLionel Sambuc blocksize="" 640433d6423SLionel Sambuc fi 641433d6423SLionel Sambuc done 642433d6423SLionel Sambucelse 643433d6423SLionel Sambuc blocksize=$blockdefault 644433d6423SLionel Sambucfi 645433d6423SLionel Sambuc 646433d6423SLionel Sambucblocksizebytes="`expr $blocksize '*' 1024`" 647433d6423SLionel Sambuc 648433d6423SLionel Sambucbootsectors=$BOOTXXSECTS 649433d6423SLionel Sambuc 650433d6423SLionel Sambuccheck_mbr 651433d6423SLionel Sambuc 652433d6423SLionel Sambucecho " 653433d6423SLionel SambucYou have selected to (re)install MINIX 3 in the partition /dev/$primary. 654433d6423SLionel SambucThe following subpartitions are now being created on /dev/$primary: 655433d6423SLionel Sambuc 656433d6423SLionel Sambuc Root subpartition: /dev/$root $ROOTMB MB 657433d6423SLionel Sambuc /home subpartition: /dev/$home $homemb 658433d6423SLionel Sambuc /usr subpartition: /dev/$usr rest of $primary 659433d6423SLionel Sambuc" 660433d6423SLionel Sambuc # Secondary master bootstrap. 661433d6423SLionel Sambuc# New boot doesn't require mbr on pN (bootxx will be there) 662433d6423SLionel Sambuc# When necessarily mbr is installed on dN by partition. 663433d6423SLionel Sambuc # Partition the primary. 664433d6423SLionel Sambucpartition /dev/$primary $bootsectors 81:${ROOTSECTS}* 81:$homesize 81:0+ > /dev/null || exit 665433d6423SLionel Sambuc 666433d6423SLionel Sambucecho "Creating /dev/$root for / .." 667433d6423SLionel Sambucmkfs.mfs /dev/$root || exit 668433d6423SLionel Sambuc 669433d6423SLionel Sambucif [ "$nohome" = 0 ] 670433d6423SLionel Sambucthen 671433d6423SLionel Sambuc if [ ! "$auto" = r ] 672433d6423SLionel Sambuc then echo "Creating /dev/$home for /home .." 673433d6423SLionel Sambuc mkfs.$FSTYPE -B $blocksizebytes /dev/$home || exit 674433d6423SLionel Sambuc fi 675433d6423SLionel Sambucelse echo "Skipping /home" 676433d6423SLionel Sambucfi 677433d6423SLionel Sambuc 678433d6423SLionel Sambucecho "Creating /dev/$usr for /usr .." 679433d6423SLionel Sambucmkfs.$FSTYPE -B $blocksizebytes /dev/$usr || exit 680433d6423SLionel Sambuc 681433d6423SLionel Sambucif [ "$nohome" = 0 ] 682433d6423SLionel Sambucthen 683433d6423SLionel Sambuc fshome="/dev/$home /home $FSTYPE rw 0 2" 684433d6423SLionel Sambucelse fshome="" 685433d6423SLionel Sambucfi 686433d6423SLionel Sambuc 687433d6423SLionel Sambucecho "" 688433d6423SLionel Sambucecho " --- Step 7: Wait for files to be copied -------------------------------" 689433d6423SLionel Sambucecho "" 690433d6423SLionel Sambucecho "All files will now be copied to your hard disk. This may take a while." 691433d6423SLionel Sambucecho "" 692433d6423SLionel Sambuc 693433d6423SLionel Sambucmount /dev/$root /mnt >/dev/null || exit 694*69eead77SJean-Baptiste Boricmkdir -p /mnt/usr 695*69eead77SJean-Baptiste Boricmount /dev/$usr /mnt/usr >/dev/null || exit # Mount the intended /usr. 696*69eead77SJean-Baptiste Boricif [ "$nohome" = 0 ]; then 697*69eead77SJean-Baptiste Boric mkdir -p /mnt/home 698*69eead77SJean-Baptiste Boric mount /dev/$home /mnt/home >/dev/null || exit # Mount the intended /home 699*69eead77SJean-Baptiste Boricfi 700433d6423SLionel Sambuc 701433d6423SLionel Sambuc# Running from the installation CD. 702*69eead77SJean-Baptiste Boricfor set in /i386/binary/sets/*.tgz; do 703*69eead77SJean-Baptiste Boric echo "Extracting $(basename "$set")..." 704*69eead77SJean-Baptiste Boric COUNT_FILES=$(cat $(echo "$set" | sed -e "s/\.tgz/\.count/")) 705*69eead77SJean-Baptiste Boric (cd /mnt; pax -rz -f $set -v -pe 2>&1 | progressbar "$COUNT_FILES" || exit) 706*69eead77SJean-Baptiste Boricdone; 707*69eead77SJean-Baptiste Boric 708*69eead77SJean-Baptiste Boricecho "Creating device nodes..." 709*69eead77SJean-Baptiste Boric(cd /mnt/dev; MAKEDEV -s all) 710*69eead77SJean-Baptiste Boric 711*69eead77SJean-Baptiste Boric# Fix permissions 712*69eead77SJean-Baptiste Boricchmod $(stat -f %Lp /usr) /mnt/usr 713*69eead77SJean-Baptiste Boricchown $(stat -f %u /usr) /mnt/usr 714*69eead77SJean-Baptiste Boricchgrp $(stat -f %g /usr) /mnt/usr 715*69eead77SJean-Baptiste Boricif [ "$nohome" = 0 ]; then 716*69eead77SJean-Baptiste Boric chmod $(stat -f %Lp /home) /mnt/home 717*69eead77SJean-Baptiste Boric chown $(stat -f %u /home) /mnt/home 718*69eead77SJean-Baptiste Boric chgrp $(stat -f %g /home) /mnt/home 719*69eead77SJean-Baptiste Boricfi 720*69eead77SJean-Baptiste Boric 721433d6423SLionel Sambuccp /mnt/etc/motd.install /mnt/etc/motd 722433d6423SLionel Sambuc 723433d6423SLionel Sambuc# CD remnants that aren't for the installed system 724433d6423SLionel Sambucrm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null 725433d6423SLionel Sambucecho >/mnt/etc/fstab "/dev/$root / mfs rw 0 1 726433d6423SLionel Sambuc/dev/$usr /usr $FSTYPE rw 0 2 727433d6423SLionel Sambuc$fshome 728da21d850SDavid van Moolenbroeknone /sys devman rw,rslabel=devman 0 0 729da21d850SDavid van Moolenbroeknone /dev/pts ptyfs rw,rslabel=ptyfs 0 0" 730433d6423SLionel Sambuc 731433d6423SLionel Sambuc # National keyboard map. 732433d6423SLionel Sambuctest -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap 733433d6423SLionel Sambuc 734433d6423SLionel Sambuc# XXX we have to use "-f" here, because installboot worries about BPB, which 735433d6423SLionel Sambuc# we don't have... 736433d6423SLionel Sambucinstallboot_nbsd -f /dev/$primary /usr/mdec/bootxx_minixfs3 >/dev/null || exit 737433d6423SLionel Sambuc# give the install the boot loader 738433d6423SLionel Sambuccp /usr/mdec/boot_monitor /mnt/ 739433d6423SLionel Sambucminixdir=/mnt/boot/minix_default 740433d6423SLionel Sambucif [ ! -f $minixdir/kernel ] 741433d6423SLionel Sambucthen rm -rf $minixdir 74284bb300fSLionel Sambuc cp -r /mnt/boot/minix/.temp $minixdir 743433d6423SLionel Sambucfi 744433d6423SLionel Sambucif [ ! -e /mnt/boot/minix_latest ] 745433d6423SLionel Sambucthen ln -sf minix_default /mnt/boot/minix_latest 746433d6423SLionel Sambucfi 747433d6423SLionel Sambucchroot /mnt update_bootcfg 748433d6423SLionel Sambuc 749433d6423SLionel Sambuc# Save name of CD drive 75043eceae5SBen Grascddrive="`mount | fgrep ' /usr ' | awk '{ print $1 }' | sed 's/p.*//'`" 751433d6423SLionel Sambucecho "cddrive=$cddrive" >>/mnt/usr/etc/rc.package 752433d6423SLionel Sambuc 753433d6423SLionel Sambucbios="`echo $primary | sed -e 's/d./dX/g' -e 's/c.//g'`" 754433d6423SLionel Sambuc 755433d6423SLionel Sambucecho "Saving random data.." 756433d6423SLionel Sambucdd if=/dev/random of=/mnt/usr/adm/random.dat bs=1024 count=1 757433d6423SLionel Sambuc 758433d6423SLionel Sambuc# Networking. 759433d6423SLionel Sambucecho "" 760433d6423SLionel Sambucecho " --- Step 8: Select your Ethernet chip ---------------------------------" 761433d6423SLionel Sambucecho "" 762433d6423SLionel Sambuc 763433d6423SLionel Sambuc/bin/netconf -p /mnt || echo FAILED TO CONFIGURE NETWORK 764433d6423SLionel Sambuc 765*69eead77SJean-Baptiste BoricPACKAGES_DIR="/usr/packages/$(uname -v | cut -f2 -d' ')/$(uname -p)/All" 766*69eead77SJean-Baptiste Boricif [ -e "$PACKAGES_DIR" ] 767*69eead77SJean-Baptiste Boricthen 768*69eead77SJean-Baptiste Boric echo "Installing pkgin..." 769*69eead77SJean-Baptiste Boric 770*69eead77SJean-Baptiste Boric sh -c "cp $PACKAGES_DIR/pkgin-* $PACKAGES_DIR/pkg_install-* $PACKAGES_DIR/openssl-* /mnt/tmp && 771*69eead77SJean-Baptiste Boric chroot /mnt pkg_add /tmp/openssl-* /tmp/pkg_install-* /tmp/pkgin-*" 772*69eead77SJean-Baptiste Boric rm -f /mnt/tmp/* 773*69eead77SJean-Baptiste Boric 774*69eead77SJean-Baptiste Boric if [ -f "$PACKAGES_DIR/pkg_summary.bz2" ] 775*69eead77SJean-Baptiste Boric then 776*69eead77SJean-Baptiste Boric echo "" 777*69eead77SJean-Baptiste Boric echo "Packages are bundled on this installation media." 778*69eead77SJean-Baptiste Boric echo "They are available under the directory $PACKAGES_DIR" 779*69eead77SJean-Baptiste Boric echo "To install them after rebooting, mount this CD, set PKG_PATH to this directory" 780*69eead77SJean-Baptiste Boric echo "and use pkg_add." 781*69eead77SJean-Baptiste Boric echo "If you mount the CD at /mnt, PKG_PATH should be:" 782*69eead77SJean-Baptiste Boric echo "/mnt$PACKAGES_DIR" 783*69eead77SJean-Baptiste Boric echo "" 784*69eead77SJean-Baptiste Boric fi 785*69eead77SJean-Baptiste Boricfi 786*69eead77SJean-Baptiste Boric 787433d6423SLionel Sambucumount /dev/$usr && echo Unmounted $usr 788433d6423SLionel Sambucumount /dev/$root && echo Unmounted $root 789*69eead77SJean-Baptiste Boricif [ "$nohome" = 0 ]; then 790*69eead77SJean-Baptiste Boric umount /dev/$home && echo Unmounted $home 791*69eead77SJean-Baptiste Boricfi 792433d6423SLionel Sambuc 793433d6423SLionel Sambucecho " 794*69eead77SJean-Baptiste BoricPlease type 'shutdown -r now' to exit MINIX 3 and reboot. To boot into 795*69eead77SJean-Baptiste Boricyour new system, you might have to remove the installation media. 796433d6423SLionel Sambuc 7977785012bSLionel SambucThis ends the MINIX 3 setup script. You may want to take care of post 7987785012bSLionel Sambucinstallation steps, such as local testing and configuration. 7997785012bSLionel Sambuc 8007785012bSLionel SambucPlease consult the user manual for more information. 801433d6423SLionel Sambuc 802433d6423SLionel Sambuc" 803433d6423SLionel Sambuc 804