more /home fixes

This commit is contained in:
Ben Gras 2005-09-09 12:22:19 +00:00
parent 3dacb3e88b
commit 852a2c9832

View File

@ -12,6 +12,8 @@ LOCALRC=/usr/etc/rc.local
MYLOCALRC=/mnt/etc/rc.local MYLOCALRC=/mnt/etc/rc.local
ROOTMB=16 ROOTMB=16
ROOTSECTS="`expr $ROOTMB '*' 1024 '*' 2`" ROOTSECTS="`expr $ROOTMB '*' 1024 '*' 2`"
USRKB="`cat /.usrkb`"
TOTALMB="`expr 3 + $USRKB / 1024 + $ROOTMB`"
PATH=/bin:/usr/bin PATH=/bin:/usr/bin
export PATH export PATH
@ -108,11 +110,11 @@ echo "MINIX 3 currently supports the following Ethernet cards. Please choose: "
echo "" echo ""
echo "0. No Ethernet card (no networking)" echo "0. No Ethernet card (no networking)"
echo "1. Intel Pro/100" echo "1. Intel Pro/100"
echo "2. Realtek 8139 based card" echo "2. 3Com 501 or 3Com 509 based card"
echo "3. Realtek 8029 based card (emulated by Qemu)" echo "3. Realtek 8139 based card"
echo "4. NE2000, 3com 503 or WD based card (emulated by Bochs)" echo "4. Realtek 8029 based card (also emulated by Qemu)"
echo "5. 3Com 501 or 3Com 509 based card" echo "5. NE2000, 3com 503 or WD based card (also emulated by Bochs)"
echo "6. AMD LANCE (emulated by VMWare)" echo "6. AMD LANCE (also emulated by VMWare)"
echo "7. Different Ethernet card (no networking)" echo "7. Different Ethernet card (no networking)"
echo "" echo ""
echo "You can always change your mind after the setup." echo "You can always change your mind after the setup."
@ -128,17 +130,17 @@ do
case "$eth" in case "$eth" in
0) step2="ok"; ;; 0) step2="ok"; ;;
1) step2="ok"; driver=fxp; ;; 1) step2="ok"; driver=fxp; ;;
2) step2="ok"; driver=rtl8139; ;; 2) step2="ok"; driver=dpeth; driverargs="#dpeth_arg='DPETH0=port:irq:memory'";
3) step2="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=pci'"; ;; echo ""
4) step2="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=240:9'"; echo "Note: After installing, edit $LOCALRC to the right configuration."
;;
3) step2="ok"; driver=rtl8139; ;;
4) step2="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=pci'"; ;;
5) step2="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=240:9'";
echo "" echo ""
echo "Note: After installing, edit $LOCALRC to the right configuration." echo "Note: After installing, edit $LOCALRC to the right configuration."
echo " chose option 4, the defaults for emulation by Bochs have been set." echo " chose option 4, the defaults for emulation by Bochs have been set."
;; ;;
5) step2="ok"; driver=dpeth; driverargs="#dpeth_arg='DPETH0=port:irq:memory'";
echo ""
echo "Note: After installing, edit $LOCALRC to the right configuration."
;;
6) driver="lance"; driverargs="LANCE0=on"; step2="ok"; ;; 6) driver="lance"; driverargs="LANCE0=on"; step2="ok"; ;;
7) step2="ok"; ;; 7) step2="ok"; ;;
*) warn "choose a number" *) warn "choose a number"
@ -151,15 +153,16 @@ step3=""
while [ "$step3" != ok ] while [ "$step3" != ok ]
do do
echo "" echo ""
echo " --- Step 2: Create a partition for MINIX 3, Or Reinstall ------------" echo " --- Step 3: Create or Select a partition for MINIX 3 -------------------"
echo "" echo ""
echo "Now you need to create a MINIX 3 partition on your hard disk." echo "Now you need to create a MINIX 3 partition on your hard disk."
echo "It has to have $TOTALMB MB at the very least."
echo "You can also select one that's already there." echo "You can also select one that's already there."
echo " " echo " "
echo "If you have an existing installation, reinstalling will let you" echo "If you have an existing installation, reinstalling will let you"
echo "keep your current partitioning and subpartitioning, and overwrite" echo "keep your current partitioning and subpartitioning, and overwrite"
echo "everything except your s3 subpartition (/home). If you want to" echo "everything except your s1 subpartition (/home). If you want to"
echo "reinstall, select your existing minix partition." echo "reinstall, select your existing minix partition."
echo " " echo " "
echo "Unless you are an expert, you are advised to use the automated" echo "Unless you are an expert, you are advised to use the automated"
@ -181,7 +184,8 @@ do
then then
# Expert mode # Expert mode
echo -n " echo -n "
MINIX needs one primary partition of about 250 MB for a full install. MINIX needs one primary partition of $TOTALMB MB for a full install,
plus what you want for /home.
The maximum file system currently supported is 4 GB. The maximum file system currently supported is 4 GB.
If there is no free space on your disk then you have to choose an option: If there is no free space on your disk then you have to choose an option:
@ -224,7 +228,7 @@ Please finish the name of the primary partition you have created:
then then
# Automatic mode # Automatic mode
PF="/tmp/pf" PF="/tmp/pf"
if autopart -f$PF if autopart -m$TOTALMB -f$PF
then if [ -s "$PF" ] then if [ -s "$PF" ]
then then
set `cat $PF` set `cat $PF`
@ -258,6 +262,15 @@ umount /dev/$root 2>/dev/null && echo "Unmounted $root for you."
umount /dev/$home 2>/dev/null && echo "Unmounted $home for you." umount /dev/$home 2>/dev/null && echo "Unmounted $home for you."
umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you." umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you."
devsize="`devsize /dev/$primary`"
devsizemb="`expr $devsize / 1024 / 2`"
if [ $devsizemb -lt $TOTALMB ]
then echo "The selected partition ($devsizemb MB) is too small."
echo "You'll need $TOTALMB MB at least."
exit 1
fi
TMPMP=/m TMPMP=/m
mkdir $TMPMP >/dev/null 2>&1 mkdir $TMPMP >/dev/null 2>&1
@ -265,55 +278,77 @@ confirm=""
while [ "$confirm" = "" ] while [ "$confirm" = "" ]
do do
auto=""
echo "" echo ""
if mount /dev/$home $TMPMP >/dev/null 2>&1 if mount /dev/$home $TMPMP >/dev/null 2>&1
then umount /dev/$home >/dev/null 2>&1 then umount /dev/$home >/dev/null 2>&1
echo "Reinstall?" echo "Reinstall?"
echo "" echo ""
echo "It seems like there is already a MINIX system there (in $home)." echo "You have selected an existing MINIX 3 partition."
echo "You can reinstall, which means your /home won't be touched." echo "Type F for full installation (to overwrite entire partition)"
echo "If you don't want to keep /home, you can \"mkfs /dev/$home\" after installing." echo "Type R for a reinstallation (existing /home will not be affected)"
echo "If you type N, I'll exit. "
echo "" echo ""
echo -n "Would you like to reinstall, keeping /home intact? [Y] " echo -n "(F)ull or (R)einstall? [R] "
auto="r" read conf
case "$conf" in
"") confirm="ok"; auto="r"; ;;
[Rr]*) confirm="ok"; auto="r"; ;;
[Ff]*) confirm="ok"; auto="" ;;
esac
else echo "Clean install?" else echo "Clean install?"
echo "" echo ""
echo "It seems like there is NO MINIX system in $home." echo "It seems like there is NO MINIX system already there,"
echo "or no /home filesystem in $home."
echo "Just in case there is something there you want to keep, I'll" echo "Just in case there is something there you want to keep, I'll"
echo "ask you this. If you type N, I'll exit to let you figure" echo "ask you this. If you type N, I'll exit to let you figure"
echo "out what is wrong." echo "out what is wrong."
echo "" echo ""
echo "Would you like to install, wiping everything " echo "Would you like to install, wiping everything "
echo -n "in /dev/$primary ? [Y] " echo -n "in /dev/$primary ? [Y] "
auto=""
read conf
case "$conf" in
"") confirm="ok"; ;;
[Yy]*) confirm="ok"; ;;
[Nn]*) exit 1; ;;
esac
fi fi
read conf
case "$conf" in
"") confirm="ok"; ;;
[Yy]*) confirm="ok"; ;;
[Nn]*) exit 1; ;;
esac
done done
nohome="0"
if [ ! "$auto" = r ] if [ ! "$auto" = r ]
then homesize="" then homesize=""
while [ -z "$homesize" ] while [ -z "$homesize" ]
do do
devsize="`devsize /dev/$primary`"
devsizemb="`expr $devsize / 1024 / 2`"
# 10% of partition is default # 10% of partition is default
defmb="`expr $devsizemb / 10`" defmb="`expr $devsizemb / 10`"
maxhome="`expr $devsizemb - $TOTALMB - 1`"
if [ $defmb -gt $maxhome ]
then
defmb=$maxhome
fi
echo "" echo ""
echo "How big do you want your /home to be, " echo "MINIX will take up $TOTALMB MB, without /home."
echo -n "in MB (total partition size is $devsizemb) ? [$defmb] " echo -n "How big do you want your /home to be in MB (0-$maxhome) ? [$defmb] "
read homesize read homesize
if [ "$homesize" = "" ] ; then homesize=$defmb; fi if [ "$homesize" = "" ] ; then homesize=$defmb; fi
echo -n "$homesize MB Ok? [Y] " if [ "$homesize" -lt 1 ]
read ok then nohome=1
[ "$ok" = Y -o "$ok" = y -o "$ok" = "" ] || homesize="" homesize=0
else
if [ "`expr $TOTALMB + $homesize`" -gt $devsizemb ]
then echo "That won't fit!"
else
echo -n "$homesize MB Ok? [Y] "
read ok
[ "$ok" = Y -o "$ok" = y -o "$ok" = "" ] || homesize=""
fi
fi
echo "" echo ""
done done
# Homesize in sectors # Homesize in sectors
@ -369,9 +404,13 @@ partition /dev/$primary 1 81:${ROOTSECTS}* 81:$homesize 81:0+ > /dev/null || exi
echo "Creating /dev/$root for / .." echo "Creating /dev/$root for / .."
mkfs -B $blocksizebytes /dev/$root || exit mkfs -B $blocksizebytes /dev/$root || exit
if [ ! "$auto" = r ] if [ "$nohome" = 0 ]
then echo "Creating /dev/$home for /home .." then
mkfs -B $blocksizebytes /dev/$home || exit if [ ! "$auto" = r ]
then echo "Creating /dev/$home for /home .."
mkfs -B $blocksizebytes /dev/$home || exit
fi
else echo "Skipping /home"
fi fi
echo "Creating /dev/$usr for /usr .." echo "Creating /dev/$usr for /usr .."
@ -389,9 +428,14 @@ echo ""
echo "Scanning /dev/$root for bad blocks:" echo "Scanning /dev/$root for bad blocks:"
readall -b /dev/$root | sh readall -b /dev/$root | sh
echo "" if [ "$nohome" = 0 ]
echo "Scanning /dev/$home for bad blocks:" then
readall -b /dev/$home | sh echo ""
echo "Scanning /dev/$home for bad blocks:"
readall -b /dev/$home | sh
fshome="home=/dev/$home"
else fshome=""
fi
echo "" echo ""
echo "Scanning /dev/$usr for bad blocks:" echo "Scanning /dev/$usr for bad blocks:"
@ -408,7 +452,7 @@ echo ""
mount /dev/$usr /mnt >/dev/null || exit # Mount the intended /usr. mount /dev/$usr /mnt >/dev/null || exit # Mount the intended /usr.
files="`find /usr | wc -l`" files="`cat /.usrfiles`"
cpdir -v /usr /mnt | progressbar "$files" || exit # Copy the usr floppy. cpdir -v /usr /mnt | progressbar "$files" || exit # Copy the usr floppy.
@ -423,7 +467,7 @@ umount /dev/$usr >/dev/null || exit # Unmount the intended /usr.
mount /dev/$root /mnt >/dev/null || exit mount /dev/$root /mnt >/dev/null || exit
# Running from the installation CD. # Running from the installation CD.
files="`find / -xdev | wc -l`" files="`cat /.rootfiles`"
cpdir -vx / /mnt | progressbar "$files" || exit cpdir -vx / /mnt | progressbar "$files" || exit
if [ -n "$driver" ] if [ -n "$driver" ]
@ -431,7 +475,7 @@ then echo "eth0 $driver 0 { default; };" >/mnt/etc/inet.conf
fi fi
# CD remnants that aren't for the installed system # CD remnants that aren't for the installed system
rm /mnt/etc/issue /mnt/CD 2>/dev/null rm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null
# Change /etc/fstab. (No swap.) # Change /etc/fstab. (No swap.)
# ${swap:+swap=/dev/$swap} # ${swap:+swap=/dev/$swap}
echo >/mnt/etc/fstab "\ echo >/mnt/etc/fstab "\
@ -439,7 +483,7 @@ echo >/mnt/etc/fstab "\
root=/dev/$root root=/dev/$root
usr=/dev/$usr usr=/dev/$usr
home=/dev/$home" $fshome"
# National keyboard map. # National keyboard map.
test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap
@ -459,7 +503,7 @@ sync
bios="`echo $primary | sed 's/d./dX/g'`" bios="`echo $primary | sed 's/d./dX/g'`"
if [ ! "$auto" = "r" ] if [ ! "$auto" = "r" ]
then if mount /dev/$home /home then if mount /dev/$home /home 2>/dev/null
then for u in bin ast then for u in bin ast
do if mkdir ~$u do if mkdir ~$u
then echo " * Creating home directory for $u in ~$u" then echo " * Creating home directory for $u in ~$u"