From: Ben Gras Date: Thu, 8 Sep 2005 16:04:34 +0000 (+0000) Subject: more release and setup tweaks.. for /home this time X-Git-Tag: v3.1.0~148 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=9faf55f4f23e8d76c6585e14bf464785ebea4e0a;p=minix.git more release and setup tweaks.. for /home this time --- diff --git a/commands/scripts/setup.sh b/commands/scripts/setup.sh index a08a893ef..30ecc9d8c 100755 --- a/commands/scripts/setup.sh +++ b/commands/scripts/setup.sh @@ -4,7 +4,7 @@ # # Changes: # 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) # @@ -157,9 +157,10 @@ do 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 " " - 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 "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 "Unless you are an expert, you are advised to use the automated" echo "step-by-step help in setting up." @@ -167,12 +168,10 @@ do ok="" while [ "$ok" = "" ] do - echo "Press ENTER for automatic mode, or type 'expert', or" - echo -n "type 'reinstall': " + echo -n "Press ENTER for automatic mode, or type 'expert': " read mode if [ -z "$mode" ]; then auto="1"; 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 done @@ -183,7 +182,7 @@ do # Expert mode echo -n " 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: (1) Delete one or more partitions @@ -247,44 +246,69 @@ Please finish the name of the primary partition you have created: atnormalize 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 done # while step3 != ok # 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 ] then homesize="" while [ -z "$homesize" ] do + devsize="`devsize /dev/$primary`" + devsizemb="`expr $devsize / 1024 / 2`" + + # 10% of partition is default + defmb="`expr $devsizemb / 10`" + 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 if [ "$homesize" = "" ] ; then homesize=$defmb; fi echo -n "$homesize MB Ok? [Y] " @@ -301,13 +325,6 @@ else homemb="current size" 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 if [ ! "$auto" = "r" ] diff --git a/tools/release.sh b/tools/release.sh index b3be79fec..7db5a93ff 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,5 +1,7 @@ #!/bin/sh +secs=`expr 32 '*' 64` + make_hdimage() { dd if=$TMPDISK of=usrimage bs=$BS count=$USRBLOCKS @@ -17,8 +19,8 @@ make_hdimage() dd < tmpimage > subpart count=1 primsects=`expr 1 + $rootsects + $usrsects` - cyl=`expr '(' $primsects ')' / 32 / 64 + 1` - padsects=`expr $cyl \* 32 \* 64 - 1 - $primsects` + cyl=`expr '(' $primsects ')' / $secs + 1` + padsects=`expr $cyl \* $secs - 1 - $primsects` { dd < /dev/zero count=1 cat subpart @@ -59,22 +61,17 @@ ISO=minix.iso ISOGZ=minix.iso.gz RAM=/dev/ram 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 COPY=0 ALL=0 +QUICK=0 -while getopts "cha?" c +while getopts "chaq?" c do case "$c" in \?) - echo "Usage: $0 [-c] [-h]" >&2 + echo "Usage: $0 [-a] [-c] [-h]" >&2 exit 1 ;; h) @@ -89,9 +86,24 @@ do echo " * Including contrib" ALL=1 ;; + q) + echo " * Quick option (skip important bits" + QUICK=1 + ;; esac 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 ] then 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 mkdir -p $RELEASEDIR/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 -chown -R bin $RELEASEDIR/usr/lib - -if [ "$COPY" -ne 1 ] +if [ QUICK = 0 ] then - echo " * Doing new cvs export" - rm -rf src - cvs export -rHEAD src >/dev/null || exit 1 - srcdir=src - if [ "$ALL" = 0 ] + echo " * Transfering $COPYITEMS to $RELEASEDIR" + ( cd / && tar cf - $COPYITEMS ) | ( cd $RELEASEDIR && tar xf - ) || exit 1 + + # Make sure compilers and libraries are bin-owned + chown -R bin $RELEASEDIR/usr/lib + + if [ "$COPY" -ne 1 ] then - # No contrib stuff - rm -rf src/contrib + echo " * Doing new cvs export" + 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 -else - ( cd .. && make clean ) - srcdir=/usr/src -fi -echo " * Transfering source to $RELEASEDIR" + echo " * Transfering source to $RELEASEDIR" + + ( cd $srcdir && tar cf - . ) | ( cd $RELEASEDIR/usr && mkdir src && cd src && tar xf - ) -( 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 [ "$ALL" = 0 ] -then echo " * Removing temporary cvs source tree" - rm -rf src + 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 -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 $TMPDISK2 || exit umount $RAM || exit @@ -228,13 +246,20 @@ writeisofs -l MINIX -b $bootimage $h_opt $CDFILES $ISO || exit 1 if [ "$HDEMU" -eq 0 ] then 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` - 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 # Make CD partition table 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 echo " * gzipping $ISO" gzip -9 $ISO