From: Ben Gras Date: Wed, 13 Jul 2011 21:59:07 +0000 (+0200) Subject: release.sh: jail install X-Git-Tag: v3.2.0~460 X-Git-Url: http://zhaoyanbai.com/repos/man.dnssec-coverage.html?a=commitdiff_plain;h=6cdcbc06d54ae92a81af4a0717f742a78948b55a;p=minix.git release.sh: jail install . Feature to do a 'release' into a permanent and usable FS hierarchy, usable with chroot . Just like the temporary staging hierarchy really . Useful to checking out and building the latest version of minix from a host minix; to (1) make an uptodate minix jail, and (2) make a sterile, reproducible jail environment, and (3) use as disposable environment in which moving /usr/pkg is ok (i.e. pkgsrc bulk builds) --- diff --git a/tools/release.sh b/tools/release.sh index b6dcca3ab..3ba2b148e 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -62,6 +62,7 @@ BS=4096 HDEMU=0 COPY=0 +JAILMODE=0 SVNREV="" REVTAG="" PACKAGES=1 @@ -78,11 +79,11 @@ fi FILENAMEOUT="" -while getopts "ls:pmMchu?r:f:" c +while getopts "j:ls:pmMchu?r:f:" c do case "$c" in \?) - echo "Usage: $0 [-l] [-p] [-c] [-h] [-m] [-M] [-r ] [-u] [-f ] [-s ]" >&2 + echo "Usage: $0 [-l] [-p] [-c] [-h] [-m] [-M] [-r ] [-u] [-f ] [-s ] -j" >&2 exit 1 ;; h) @@ -100,6 +101,24 @@ do r) SVNREV=-r$OPTARG ;; + j) + FINAL_JAILDIR=$OPTARG + + # Make sure no important directory will be wiped + if [ -d "$FINAL_JAILDIR" ] + then echo "$FINAL_JAILDIR exists." + exit 1 + fi + + # Sanity check name + if mkdir $FINAL_JAILDIR + then : + else echo "Could not create $FINAL_JAILDIR." + exit 1 + fi + rm -rf $FINAL_JAILDIR + JAILMODE=1 + ;; u) echo " * Making live USB-stick image" IMG_BASE=minix${version}_usb @@ -149,11 +168,13 @@ then exit fi -echo " * Cleanup old files" -umount $TMPDISKUSR || true -umount $TMPDISKROOT || true -umount $RELEASEMNTDIR/usr || true -umount $RELEASEMNTDIR || true +if [ $JAILMODE = 0 ] +then echo " * Cleanup old files" + umount $TMPDISKUSR || true + umount $TMPDISKROOT || true + umount $RELEASEMNTDIR/usr || true + umount $RELEASEMNTDIR || true +fi rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image* mkdir -p $CDFILES || exit @@ -259,6 +280,7 @@ cp issue.install $RELEASEDIR/etc/issue echo $version_pretty, SVN revision $REVISION, generated `date` >$RELEASEDIR/etc/version rm -rf $RELEASEDIR/tmp/* + if [ $MINIMAL -ne 0 ] then if [ "$MAKEMAP" -ne 0 ] @@ -275,6 +297,15 @@ then ln $RELEASEDIR/boot/image_big $RELEASEDIR/boot/image/$version fi +# If we are making a jail, all is done! +if [ $JAILMODE = 1 ] +then mv $RELEASEDIR $FINAL_JAILDIR + echo "Created new minix install in $FINAL_JAILDIR." + echo "Enter it by typing: " + echo "# chroot $FINAL_JAILDIR /bin/sh" + exit 0 +fi + echo " * Counting files" extrakb=`du -s $RELEASEDIR/usr/install | awk '{ print $1 }'` find $RELEASEDIR/usr | fgrep -v /install/ | wc -l >$RELEASEDIR/.usrfiles