more release and setup tweaks.. for /home this time

This commit is contained in:
Ben Gras 2005-09-08 16:04:34 +00:00
parent 119f9c714c
commit 9faf55f4f2
2 changed files with 141 additions and 99 deletions

View file

@ -4,7 +4,7 @@
# #
# Changes: # Changes:
# Aug 2005 robustness checks and beautifications (Jorrit N. Herder) # Aug 2005 robustness checks and beautifications (Jorrit N. Herder)
# Jul 2005 extended with autopart and networking (Ben J. Gras) # Jul 2005 extended with autopart and networking (Ben Gras)
# Dec 20, 1994 created (Kees J. Bot) # Dec 20, 1994 created (Kees J. Bot)
# #
@ -157,9 +157,10 @@ do
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 "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, 'reinstall'ing 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)." echo "everything except your s3 subpartition (/home). If you want to"
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"
echo "step-by-step help in setting up." echo "step-by-step help in setting up."
@ -167,12 +168,10 @@ do
ok="" ok=""
while [ "$ok" = "" ] while [ "$ok" = "" ]
do do
echo "Press ENTER for automatic mode, or type 'expert', or" echo -n "Press ENTER for automatic mode, or type 'expert': "
echo -n "type 'reinstall': "
read mode read mode
if [ -z "$mode" ]; then auto="1"; ok="yes"; fi if [ -z "$mode" ]; then auto="1"; ok="yes"; fi
if [ "$mode" = expert ]; then auto=""; ok="yes"; fi if [ "$mode" = expert ]; then auto=""; ok="yes"; fi
if [ "$mode" = reinstall ]; then auto="r"; ok="yes"; fi
if [ "$ok" != yes ]; then warn "try again"; fi if [ "$ok" != yes ]; then warn "try again"; fi
done done
@ -183,7 +182,7 @@ do
# 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 about 250 MB for a full install.
The maximum fill 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:
(1) Delete one or more partitions (1) Delete one or more partitions
@ -247,44 +246,69 @@ Please finish the name of the primary partition you have created:
atnormalize atnormalize
if [ -n "$primary" ]; then step3=ok; fi if [ -n "$primary" ]; then step3=ok; fi
else
# Reinstall mode
primary=""
while [ -z "$primary" ]
do
echo -n "
Please finish the name of the primary partition you have a MINIX install on:
/dev/"
read primary
done
echo ""
echo "This is the point of no return. You have selected to reinstall MINIX"
echo "on partition /dev/$primary. Please confirm that you want to use this"
echo "selection to reinstall MINIX. This will wipe out your s0 (root) and"
echo "s2 (/usr) filesystems."
echo ""
confirmation=""
while [ -z "$confirmation" -o "$confirmation" != yes -a "$confirmation" != no ]
do
echo -n "Are you sure you want to continue? Please enter 'yes' or 'no': "
read confirmation
if [ "$confirmation" = yes ]; then step3=ok; fi
done
biosdrivename="Actual BIOS device name unknown, due to reinstallation."
fi fi
fi fi
done # while step3 != ok done # while step3 != ok
# end Step 3 # end Step 3
defmb=200 root=${primary}s0
home=${primary}s1
usr=${primary}s2
umount /dev/$root 2>/dev/null && echo "Unmounted $root for you."
umount /dev/$home 2>/dev/null && echo "Unmounted $home for you."
umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you."
TMPMP=/m
mkdir $TMPMP >/dev/null 2>&1
confirm=""
while [ "$confirm" = "" ]
do
echo ""
if mount /dev/$home $TMPMP >/dev/null 2>&1
then umount /dev/$home >/dev/null 2>&1
echo "Reinstall?"
echo ""
echo "It seems like there is already a MINIX system there (in $home)."
echo "You can reinstall, which means your /home won't be touched."
echo "If you don't want to keep /home, you can \"mkfs /dev/$home\" after installing."
echo "If you type N, I'll exit. "
echo ""
echo -n "Would you like to reinstall, keeping /home intact? [Y] "
auto="r"
else echo "Clean install?"
echo ""
echo "It seems like there is NO MINIX system in $home."
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 "out what is wrong."
echo ""
echo "Would you like to install, wiping everything "
echo -n "in /dev/$primary ? [Y] "
auto=""
fi
read conf
case "$conf" in
"") confirm="ok"; ;;
[Yy]*) confirm="ok"; ;;
[Nn]*) exit 1; ;;
esac
done
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
defmb="`expr $devsizemb / 10`"
echo "" echo ""
echo -n "How big do you want your /home to be, in MB? [$defmb] " echo "How big do you want your /home to be, "
echo -n "in MB (total partition size is $devsizemb) ? [$defmb] "
read homesize read homesize
if [ "$homesize" = "" ] ; then homesize=$defmb; fi if [ "$homesize" = "" ] ; then homesize=$defmb; fi
echo -n "$homesize MB Ok? [Y] " echo -n "$homesize MB Ok? [Y] "
@ -301,13 +325,6 @@ else
homemb="current size" homemb="current size"
fi fi
root=${primary}s0
home=${primary}s1
usr=${primary}s2
umount /dev/$root 2>/dev/null && echo "Unmounted $root for you."
umount /dev/$home 2>/dev/null && echo "Unmounted $home for you."
umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you."
blockdefault=4 blockdefault=4
if [ ! "$auto" = "r" ] if [ ! "$auto" = "r" ]

View file

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
secs=`expr 32 '*' 64`
make_hdimage() make_hdimage()
{ {
dd if=$TMPDISK of=usrimage bs=$BS count=$USRBLOCKS dd if=$TMPDISK of=usrimage bs=$BS count=$USRBLOCKS
@ -17,8 +19,8 @@ make_hdimage()
dd < tmpimage > subpart count=1 dd < tmpimage > subpart count=1
primsects=`expr 1 + $rootsects + $usrsects` primsects=`expr 1 + $rootsects + $usrsects`
cyl=`expr '(' $primsects ')' / 32 / 64 + 1` cyl=`expr '(' $primsects ')' / $secs + 1`
padsects=`expr $cyl \* 32 \* 64 - 1 - $primsects` padsects=`expr $cyl \* $secs - 1 - $primsects`
{ dd < /dev/zero count=1 { dd < /dev/zero count=1
cat subpart cat subpart
@ -59,22 +61,17 @@ ISO=minix.iso
ISOGZ=minix.iso.gz ISOGZ=minix.iso.gz
RAM=/dev/ram RAM=/dev/ram
BS=4096 BS=4096
USRMB=300
USRBLOCKS="`expr $USRMB \* 1024 \* 1024 / $BS`"
USRSECTS="`expr $USRMB \* 1024 \* 2`"
ROOTMB=2
ROOTSECTS="`expr $ROOTMB \* 1024 \* 2`"
ROOTBLOCKS="`expr $ROOTMB \* 1024 \* 1024 / $BS`"
HDEMU=0 HDEMU=0
COPY=0 COPY=0
ALL=0 ALL=0
QUICK=0
while getopts "cha?" c while getopts "chaq?" c
do do
case "$c" in case "$c" in
\?) \?)
echo "Usage: $0 [-c] [-h]" >&2 echo "Usage: $0 [-a] [-c] [-h]" >&2
exit 1 exit 1
;; ;;
h) h)
@ -89,9 +86,24 @@ do
echo " * Including contrib" echo " * Including contrib"
ALL=1 ALL=1
;; ;;
q)
echo " * Quick option (skip important bits"
QUICK=1
;;
esac esac
done done
if [ $QUICK = 0 ]
then USRMB=300
else USRMB=30
fi
USRBLOCKS="`expr $USRMB \* 1024 \* 1024 / $BS`"
USRSECTS="`expr $USRMB \* 1024 \* 2`"
ROOTMB=2
ROOTSECTS="`expr $ROOTMB \* 1024 \* 2`"
ROOTBLOCKS="`expr $ROOTMB \* 1024 \* 1024 / $BS`"
if [ "$COPY" -ne 1 ] if [ "$COPY" -ne 1 ]
then then
echo "Note: this script wants to do cvs operations, so it's necessary" echo "Note: this script wants to do cvs operations, so it's necessary"
@ -150,57 +162,63 @@ echo " * Mounting $TMPDISK as $RELEASEDIR/usr"
mount $TMPDISK $RELEASEDIR/usr || exit mount $TMPDISK $RELEASEDIR/usr || exit
mkdir -p $RELEASEDIR/tmp mkdir -p $RELEASEDIR/tmp
mkdir -p $RELEASEDIR/usr/tmp mkdir -p $RELEASEDIR/usr/tmp
echo " * Transfering $COPYITEMS to $RELEASEDIR"
( cd / && tar cf - $COPYITEMS ) | ( cd $RELEASEDIR && tar xf - ) || exit 1
# Make sure compilers and libraries are bin-owned if [ QUICK = 0 ]
chown -R bin $RELEASEDIR/usr/lib
if [ "$COPY" -ne 1 ]
then then
echo " * Doing new cvs export" echo " * Transfering $COPYITEMS to $RELEASEDIR"
rm -rf src ( cd / && tar cf - $COPYITEMS ) | ( cd $RELEASEDIR && tar xf - ) || exit 1
cvs export -rHEAD src >/dev/null || exit 1
srcdir=src # Make sure compilers and libraries are bin-owned
if [ "$ALL" = 0 ] chown -R bin $RELEASEDIR/usr/lib
if [ "$COPY" -ne 1 ]
then then
# No contrib stuff echo " * Doing new cvs export"
rm -rf src/contrib rm -rf src
cvs export -rHEAD src >/dev/null || exit 1
srcdir=src
if [ "$ALL" = 0 ]
then
# No contrib stuff
rm -rf src/contrib
fi
else
( cd .. && make clean )
srcdir=/usr/src
fi fi
else
( cd .. && make clean ) echo " * Transfering source to $RELEASEDIR"
srcdir=/usr/src
( cd $srcdir && tar cf - . ) | ( cd $RELEASEDIR/usr && mkdir src && cd src && tar xf - )
if [ "$ALL" = 0 ]
then echo " * Removing temporary cvs source tree"
rm -rf src
fi
echo " * Fixups for owners and modes of dirs and files"
chown -R bin $RELEASEDIR/usr/src
find $RELEASEDIR/usr/src -type d | xargs chmod 755
find $RELEASEDIR/usr/src -type f | xargs chmod 644
# Bug tracking system not for on cd
rm -rf $RELEASEDIR/usr/src/doc/bugs
# Make sure the CD knows it's a CD
date >$RELEASEDIR/CD
echo " * Chroot build"
chroot $RELEASEDIR '/bin/sh -x /usr/src/tools/chrootmake.sh' || exit 1
echo " * Chroot build done"
# The build process leaves some file in src as root.
chown -R bin $RELEASEDIR/usr/src
cp issue.install $RELEASEDIR/etc/issue
if [ "$HDEMU" -ne 0 ]; then hdemu_root_changes; fi
echo "Temporary filesystems still mounted. Make changes, or press RETURN"
echo -n "to continue making the image.."
read xyzzy
fi fi
echo " * Transfering source to $RELEASEDIR"
( cd $srcdir && tar cf - . ) | ( cd $RELEASEDIR/usr && mkdir src && cd src && tar xf - )
if [ "$ALL" = 0 ]
then echo " * Removing temporary cvs source tree"
rm -rf src
fi
echo " * Fixups for owners and modes of dirs and files"
chown -R bin $RELEASEDIR/usr/src
find $RELEASEDIR/usr/src -type d | xargs chmod 755
find $RELEASEDIR/usr/src -type f | xargs chmod 644
# Bug tracking system not for on cd
rm -rf $RELEASEDIR/usr/src/doc/bugs
# Make sure the CD knows it's a CD
date >$RELEASEDIR/CD
echo " * Chroot build"
chroot $RELEASEDIR '/bin/sh -x /usr/src/tools/chrootmake.sh' || exit 1
echo " * Chroot build done"
# The build process leaves some file in src as root.
chown -R bin $RELEASEDIR/usr/src
cp issue.install $RELEASEDIR/etc/issue
if [ "$HDEMU" -ne 0 ]; then hdemu_root_changes; fi
echo "Temporary filesystems still mounted. Make changes, or press RETURN"
echo -n "to continue making the image.."
read xyzzy
umount $TMPDISK || exit umount $TMPDISK || exit
umount $TMPDISK2 || exit umount $TMPDISK2 || exit
umount $RAM || exit umount $RAM || exit
@ -228,13 +246,20 @@ writeisofs -l MINIX -b $bootimage $h_opt $CDFILES $ISO || exit 1
if [ "$HDEMU" -eq 0 ] if [ "$HDEMU" -eq 0 ]
then then
echo "Appending Minix root and usr filesystem" echo "Appending Minix root and usr filesystem"
( cat $ISO $ROOTIMAGE ; dd if=$TMPDISK bs=$BS count=$USRBLOCKS ) >m # Pad ISO out to cylinder boundary
isobytes=`stat -size $ISO` isobytes=`stat -size $ISO`
isosects=`expr $isobytes / 512 - 1` isosects=`expr $isobytes / 512`
isopad=`expr $secs - '(' $isosects % $secs ')'`
dd if=/dev/zero count=$isopad >>$ISO
# number of sectors
isosects=`expr $isosects + $isopad`
( cat $ISO $ROOTIMAGE ; dd if=$TMPDISK bs=$BS count=$USRBLOCKS ) >m
mv m $ISO mv m $ISO
# Make CD partition table # Make CD partition table
installboot -m $ISO /usr/mdec/masterboot installboot -m $ISO /usr/mdec/masterboot
partition -m $ISO 81:$isosects 81:$ROOTSECTS 81:$USRSECTS # Make sure there is no hole..! Otherwise the ISO format is
# unreadable.
partition -m $ISO 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
fi fi
echo " * gzipping $ISO" echo " * gzipping $ISO"
gzip -9 $ISO gzip -9 $ISO