xref: /minix3/releasetools/release.sh (revision 426224bbc6f1079b3231b1284e88c9802cbea530)
17f99f3a2SThomas Veerman#!/bin/sh
27f99f3a2SThomas Veerman
37f99f3a2SThomas Veermanset -e
47f99f3a2SThomas Veerman
555f2063eSBen Gras. ./release.functions
67f99f3a2SThomas Veerman
740b67629SAntoine Lecaversion_pretty="`sh ../sys/conf/osrelease.sh`"
87f99f3a2SThomas Veermanversion="`echo $version_pretty | tr . _`"
97f99f3a2SThomas VeermanPACKAGEDIR=/usr/pkgsrc/packages/$version_pretty/`uname -m`
107f99f3a2SThomas Veerman
117f99f3a2SThomas VeermanSRC=src
1238c4489eSBen Gras: ${REPO:=git://git.minix3.org/minix}
1338c4489eSBen Gras: ${GITBRANCH:=master}
14bb65c813SLionel Sambuc: ${BUILDOPTIONS:=}
157f99f3a2SThomas Veerman
16*426224bbSLionel Sambuc# Packages we have to pre-install, and url to use
17*426224bbSLionel Sambuc: ${PACKAGEURL="http://www.minix3.org/pkgsrc/packages/$version_pretty/`uname -m`/All/"}
18*426224bbSLionel Sambuc: ${PREINSTALLED_PACKAGES:="pkg_install pkgin"}
19*426224bbSLionel Sambuc
207f99f3a2SThomas Veerman# List of packages included on installation media
217f99f3a2SThomas VeermanPACKAGELIST=packages.install
227f99f3a2SThomas Veermansecs=`expr 32 '*' 64`
237f99f3a2SThomas Veermanexport SHELL=/bin/sh
247f99f3a2SThomas Veerman
257f99f3a2SThomas VeermanPKG_ADD=/usr/pkg/sbin/pkg_add
267f99f3a2SThomas VeermanPKG_INFO=/usr/pkg/sbin/pkg_info
277f99f3a2SThomas Veerman
287f99f3a2SThomas Veermanif [ ! -x $PKG_ADD ]
297f99f3a2SThomas Veermanthen	echo Please install pkg_install from pkgsrc.
307f99f3a2SThomas Veerman	exit 1
317f99f3a2SThomas Veermanfi
327f99f3a2SThomas Veerman
337f99f3a2SThomas VeermanRELEASERC=$HOME/.releaserc
347f99f3a2SThomas Veerman
357f99f3a2SThomas Veermanif [ -f $RELEASERC ]
367f99f3a2SThomas Veermanthen	. $RELEASERC
377f99f3a2SThomas Veermanfi
387f99f3a2SThomas Veerman
397f99f3a2SThomas Veermanset -- $* $RELOPTS
407f99f3a2SThomas Veerman
41b0814fecSLionel Sambucexport RELEASEDIR=/usr/r-staging
427f99f3a2SThomas VeermanRELEASEMNTDIR=/usr/r
437f99f3a2SThomas Veerman
447f99f3a2SThomas VeermanIMAGE=/usr/mdec/bootxx_cd9660
457f99f3a2SThomas VeermanROOTIMAGE=rootimage
467f99f3a2SThomas VeermanCDFILES=/usr/tmp/cdreleasefiles
477f99f3a2SThomas VeermanIMG_BASE=minix${version}_ide
487f99f3a2SThomas VeermanBS=4096
497f99f3a2SThomas Veerman
507f99f3a2SThomas VeermanCOPY=0
517f99f3a2SThomas VeermanJAILMODE=0
527f99f3a2SThomas VeermanREVTAG=""
537f99f3a2SThomas VeermanPACKAGES=1
547f99f3a2SThomas VeermanMINIMAL=0
557f99f3a2SThomas VeermanMAKEMAP=0
567f99f3a2SThomas VeermanEXTRAS_INSTALL=0
577f99f3a2SThomas VeermanEXTRAS_PATH=
587f99f3a2SThomas Veerman
597f99f3a2SThomas Veerman# Do we have git?
607f99f3a2SThomas Veermanif git --version >/dev/null
617f99f3a2SThomas Veermanthen	if [ -d ../.git ]
627f99f3a2SThomas Veerman	then	LOCAL_REVTAG="`git describe --always`"
637f99f3a2SThomas Veerman		GITMODE=1
647f99f3a2SThomas Veerman	fi
657f99f3a2SThomas Veermanfi
667f99f3a2SThomas Veerman
677f99f3a2SThomas VeermanFILENAMEOUT=""
687f99f3a2SThomas Veerman
69be22a5eeSDavid van Moolenbroekwhile getopts "b:j:lpmMch?f:L:e:" c
707f99f3a2SThomas Veermando
717f99f3a2SThomas Veerman	case "$c" in
727f99f3a2SThomas Veerman	\?)
73be22a5eeSDavid van Moolenbroek		echo "Usage: $0 [-l] [-p] [-c] [-m] [-M] [-f <filename>] -j<jaildir> [-L <packageurl>] [-e <extras-path>]" >&2
747f99f3a2SThomas Veerman		exit 1
757f99f3a2SThomas Veerman	;;
767f99f3a2SThomas Veerman	b)
777f99f3a2SThomas Veerman		GITBRANCH=$OPTARG
787f99f3a2SThomas Veerman		;;
797f99f3a2SThomas Veerman	c)
803ba3608cSLionel Sambuc		echo " * Copying, not using GIT"
817f99f3a2SThomas Veerman		COPY=1
827f99f3a2SThomas Veerman		;;
837f99f3a2SThomas Veerman	p)
847f99f3a2SThomas Veerman		PACKAGES=0
857f99f3a2SThomas Veerman		;;
867f99f3a2SThomas Veerman	j)
877f99f3a2SThomas Veerman		RELEASEDIR=$OPTARG
887f99f3a2SThomas Veerman		JAILMODE=1
897f99f3a2SThomas Veerman		;;
907f99f3a2SThomas Veerman	f)
917f99f3a2SThomas Veerman		FILENAMEOUT="$OPTARG"
927f99f3a2SThomas Veerman		;;
937f99f3a2SThomas Veerman	m)	MINIMAL=1
947f99f3a2SThomas Veerman		PACKAGES=0
957f99f3a2SThomas Veerman		;;
967f99f3a2SThomas Veerman	M)	MAKEMAP=1
977f99f3a2SThomas Veerman		;;
98*426224bbSLionel Sambuc	l)	PACKAGEURL=file://$PACKAGEDIR/All
997f99f3a2SThomas Veerman		;;
100*426224bbSLionel Sambuc	L)	PACKAGEURL="$OPTARG"
1017f99f3a2SThomas Veerman		CUSTOM_PACKAGES=1
1027f99f3a2SThomas Veerman		;;
1037f99f3a2SThomas Veerman	e)	EXTRAS_INSTALL=1
1047f99f3a2SThomas Veerman		EXTRAS_PATH="$OPTARG"
1057f99f3a2SThomas Veerman		;;
1067f99f3a2SThomas Veerman	esac
1077f99f3a2SThomas Veermandone
1087f99f3a2SThomas Veerman
1094c3a751fSBen GrasRELEASEPACKAGE=${RELEASEDIR}/usr/install/packages
1104c3a751fSBen Gras
1117f99f3a2SThomas Veermanif [ $GITMODE -ne 1 -a $COPY -ne 1 ]
1127f99f3a2SThomas Veermanthen	echo "Need git to retrieve latest minix! Copying src instead!"
1137f99f3a2SThomas Veerman	COPY=1
1147f99f3a2SThomas Veermanfi
1157f99f3a2SThomas Veerman
1167f99f3a2SThomas Veermanif [ ! "$ZIP" ]
1177f99f3a2SThomas Veermanthen	ZIP=bzip2
1187f99f3a2SThomas Veermanfi
1197f99f3a2SThomas Veerman
1207f99f3a2SThomas Veermanif [ $PACKAGES -ne 0 ]
1217f99f3a2SThomas Veermanthen	mkdir -p $PACKAGEDIR/All || true
1227f99f3a2SThomas Veerman	retrieve $PACKAGEDIR/All $PACKAGELIST packages/`uname -p`/$VERSION_PRETTY
1237f99f3a2SThomas Veermanfi
1247f99f3a2SThomas Veerman
1257f99f3a2SThomas VeermanTMPDISKUSR=/dev/ram0
1267f99f3a2SThomas VeermanTMPDISKROOT=/dev/ram1
1277f99f3a2SThomas Veerman
1287f99f3a2SThomas Veermanif [ ! -b $TMPDISKUSR -o ! $TMPDISKROOT ]
1297f99f3a2SThomas Veermanthen	echo "$TMPDISKUSR or $TMPDISKROOT is not a block device.."
1307f99f3a2SThomas Veerman	exit 1
1317f99f3a2SThomas Veermanfi
1327f99f3a2SThomas Veerman
1337f99f3a2SThomas Veermanif [ $TMPDISKUSR = $TMPDISKROOT ]
1347f99f3a2SThomas Veermanthen
1357f99f3a2SThomas Veerman	echo "Temporary devices can't be equal."
1367f99f3a2SThomas Veerman	exit
1377f99f3a2SThomas Veermanfi
1387f99f3a2SThomas Veerman
1397f99f3a2SThomas Veermanif [ $JAILMODE = 0 ]
1407f99f3a2SThomas Veermanthen	echo " * Cleanup old files"
1417f99f3a2SThomas Veerman	umount $TMPDISKUSR || true
1427f99f3a2SThomas Veerman	umount $TMPDISKROOT || true
1437f99f3a2SThomas Veerman	umount $RELEASEMNTDIR/usr || true
1447f99f3a2SThomas Veerman	umount $RELEASEMNTDIR || true
1457f99f3a2SThomas Veermanfi
1467f99f3a2SThomas Veerman
1477f99f3a2SThomas Veermanrm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image* || true
1487f99f3a2SThomas Veermanmkdir -p $CDFILES || exit
1497f99f3a2SThomas Veermanmkdir -p $RELEASEDIR $RELEASEMNTDIR
1507f99f3a2SThomas Veermanmkdir -p $RELEASEPACKAGE
1517f99f3a2SThomas Veerman
1523ba3608cSLionel Sambuc##########################################################################
1533ba3608cSLionel Sambucecho " * Bootstrapping filesystem in $RELEASEDIR"
1543ba3608cSLionel Sambuc##########################################################################
155433d6423SLionel SambucCONFIGHEADER=$RELEASEDIR/usr/src/minix/include/minix/sys_config.h
1567f99f3a2SThomas Veerman
1577f99f3a2SThomas Veermancopy_local_packages
1587f99f3a2SThomas Veerman
1597f99f3a2SThomas Veermanif [ "$COPY" -ne 1 ]
1607f99f3a2SThomas Veermanthen
1617f99f3a2SThomas Veerman	echo "Retrieving latest minix repo from $REPO branch $GITBRANCH."
1627f99f3a2SThomas Veerman	srcdir=$RELEASEDIR/usr/src
1637f99f3a2SThomas Veerman	git clone -b $GITBRANCH $REPO $srcdir
164597efc6cSBen Gras	echo "Triggering fetch scripts"
165597efc6cSBen Gras	( cd $srcdir && sh ./gnu/dist/fetch.sh )
166597efc6cSBen Gras	( cd $srcdir && sh ./external/gpl3/binutils/fetch.sh )
1677f99f3a2SThomas Veerman	if [ "$REVTAG" ]
1687f99f3a2SThomas Veerman	then	echo "Doing checkout of $REVTAG."
1697f99f3a2SThomas Veerman		(cd $srcdir && git checkout $REVTAG )
1707f99f3a2SThomas Veerman	else	REVTAG=`(cd $srcdir && git rev-parse --short HEAD)`
1717f99f3a2SThomas Veerman		echo "Retrieved repository head in $srcdir is $REVTAG."
1727f99f3a2SThomas Veerman	fi
1737f99f3a2SThomas Veerman	if [ $MINIMAL -ne 0 ]
1747f99f3a2SThomas Veerman	then	rm -r $srcdir/.git
1757f99f3a2SThomas Veerman	fi
1767f99f3a2SThomas Veerman	echo "
1777f99f3a2SThomas Veerman/* Added by release script  */
1787f99f3a2SThomas Veerman#ifndef _VCS_REVISION
1797f99f3a2SThomas Veerman#define _VCS_REVISION \"$REVTAG\"
1807f99f3a2SThomas Veerman#endif" >>$CONFIGHEADER
1817f99f3a2SThomas Veerman	DATE=`date +%Y%m%d`
1827f99f3a2SThomas Veerman	# output image name
1837f99f3a2SThomas Veerman	IMG=${IMG_BASE}_${DATE}_${REVTAG}.iso
1847f99f3a2SThomas Veermanelse
1854c3a751fSBen Gras	echo "First cleaning current sourcedir.."
1864c3a751fSBen Gras	( cd .. && make cleandir >/dev/null )
1877f99f3a2SThomas Veerman	echo "Copying contents from current src dir."
1887f99f3a2SThomas Veerman	srcdir=/usr/$SRC
189be22a5eeSDavid van Moolenbroek	( cd $srcdir && tar --exclude .git -cf - .  ) | ( cd $RELEASEDIR/usr && mkdir $SRC && cd $SRC && tar xf - )
1904c3a751fSBen Gras	echo "Copying done."
1917f99f3a2SThomas Veerman	REVTAG=copy
1927f99f3a2SThomas Veerman	IMG=${IMG_BASE}_copy.iso
1937f99f3a2SThomas Veermanfi
1947f99f3a2SThomas Veerman
1957f99f3a2SThomas Veerman# Make sure the CD knows it's a CD, unless it's not
1969dfbfc9aSBen Grasdate >$RELEASEDIR/CD
1977f99f3a2SThomas Veerman
1983ba3608cSLionel Sambucrm -f $RELEASEDIR/usr/$SRC/releasetools/revision
1997f99f3a2SThomas Veerman
2007f99f3a2SThomas Veermanfor p in $PREINSTALLED_PACKAGES
201*426224bbSLionel Sambucdo	echo " * Pre-installing: $p from $PACKAGEURL"
202*426224bbSLionel Sambuc    $PKG_ADD -f -P $RELEASEDIR $PACKAGEURL/$p
2037f99f3a2SThomas Veermandone
2047f99f3a2SThomas Veerman
2057f99f3a2SThomas Veermanif [ "$CUSTOM_PACKAGES" ]
206*426224bbSLionel Sambucthen	echo $PACKAGEURL >$RELEASEDIR/usr/pkg/etc/pkgin/repositories.conf
2077f99f3a2SThomas Veermanfi
2087f99f3a2SThomas Veerman
2097f99f3a2SThomas Veermanecho " * Resetting timestamps"
21055f2063eSBen Grasfind $RELEASEDIR -print0 | xargs -n1000 -0 touch
2113ba3608cSLionel Sambuc
2123ba3608cSLionel Sambuc##########################################################################
213b0814fecSLionel Sambucecho " * Build"
2143ba3608cSLionel Sambuc##########################################################################
215b0814fecSLionel Sambuc
216b0814fecSLionel Sambuccd $RELEASEDIR/usr/src
217433d6423SLionel Sambucmake distribution MKLIBCXX=yes DESTDIR=$RELEASEDIR SLOPPY_FLIST=yes $BUILDOPTIONS
218b0814fecSLionel Sambucmake -C releasetools do-hdboot DESTDIR=$RELEASEDIR MKINSTALLBOOT=yes
219b0814fecSLionel Sambuccp $RELEASEDIR/usr/mdec/boot_monitor $RELEASEDIR
220b0814fecSLionel Sambuccp $RELEASEDIR/boot/minix_latest/* $RELEASEDIR/boot/minix_default/
221b0814fecSLionel Sambuc
222b0814fecSLionel Sambucif [ $MAKEMAP -ne 0 ]; then
223b0814fecSLionel Sambuc        find . -type f -perm 755 | xargs nm -n 2> /dev/null > symbols.txt
224b0814fecSLionel Sambucfi
225b0814fecSLionel Sambucmake cleandir
226b0814fecSLionel Sambuc
227b0814fecSLionel Sambuccd -
228b0814fecSLionel Sambuc
2293ba3608cSLionel Sambucecho " * build done"
2303ba3608cSLionel Sambuc
2313ba3608cSLionel Sambuc##########################################################################
2327f99f3a2SThomas Veermanecho " * Removing bootstrap files"
2333ba3608cSLionel Sambuc##########################################################################
2347f99f3a2SThomas Veerman# The build process leaves some file in $SRC as bin.
2357f99f3a2SThomas Veermanchown -R root $RELEASEDIR/usr/src*
2367f99f3a2SThomas Veermancp issue.install $RELEASEDIR/etc/issue
2377f99f3a2SThomas Veerman
238be22a5eeSDavid van Moolenbroekecho $version_pretty, GIT revision $REVTAG, generated `date` >$RELEASEDIR/etc/version
2397f99f3a2SThomas Veermanrm -rf $RELEASEDIR/tmp/*
2407f99f3a2SThomas Veerman
2417f99f3a2SThomas Veermanif [ $MINIMAL -ne 0 ]
2427f99f3a2SThomas Veermanthen
2437f99f3a2SThomas Veerman	if [ "$MAKEMAP" -ne 0 ]
2447f99f3a2SThomas Veerman	then
2457f99f3a2SThomas Veerman		echo " * Copying symbol map to ${IMG}-symbols.txt"
2467f99f3a2SThomas Veerman		cp $RELEASEDIR/usr/src/symbols.txt ${IMG}-symbols.txt
2477f99f3a2SThomas Veerman		$ZIP -f ${IMG}-symbols.txt
2487f99f3a2SThomas Veerman	fi
2497f99f3a2SThomas Veerman
2507f99f3a2SThomas Veerman	echo " * Removing files to create minimal image"
2517f99f3a2SThomas Veerman	rm -rf $RELEASEDIR/usr/man/man*/* 	\
2527f99f3a2SThomas Veerman		$RELEASEDIR/usr/share/zoneinfo* $RELEASEDIR/usr/src
2535b91b11bSThomas Veerman	mkdir -p $RELEASEDIR/usr/src/releasetools
2547f99f3a2SThomas Veermanfi
2557f99f3a2SThomas Veerman
2567f99f3a2SThomas Veermanif [ $EXTRAS_INSTALL -ne 0 ] ; then
2577f99f3a2SThomas Veerman    echo " * Copying files from $EXTRAS_PATH"
2587f99f3a2SThomas Veerman    cp -Rv $EXTRAS_PATH/* $RELEASEDIR
2597f99f3a2SThomas Veermanfi
2607f99f3a2SThomas Veerman
261597efc6cSBen Grasecho " * Removing sources"
262597efc6cSBen Gras
263597efc6cSBen Grasrm -rf $RELEASEDIR/usr/src # No space for /usr/src
264c48c7d47SLionel Sambucrm -f $RELEASEDIR/SETS.* # No need for those.
265597efc6cSBen Gras
2667f99f3a2SThomas Veerman# If we are making a jail, all is done!
2677f99f3a2SThomas Veermanif [ $JAILMODE = 1 ]
2687f99f3a2SThomas Veermanthen	echo "Created new minix install in $RELEASEDIR."
2697f99f3a2SThomas Veerman	echo "Enter it by typing: "
2707f99f3a2SThomas Veerman	echo "# chroot $RELEASEDIR /bin/sh"
2717f99f3a2SThomas Veerman	exit 0
2727f99f3a2SThomas Veermanfi
2737f99f3a2SThomas Veerman
2743ba3608cSLionel Sambuc##########################################################################
2757f99f3a2SThomas Veermanecho " * Counting files"
2763ba3608cSLionel Sambuc##########################################################################
2777f99f3a2SThomas Veermanextrakb=`du -ks $RELEASEDIR/usr/install | awk '{ print $1 }'`
2787f99f3a2SThomas Veermanfind $RELEASEDIR/usr | fgrep -v /install/ | wc -l >$RELEASEDIR/.usrfiles
2797f99f3a2SThomas Veermanfind $RELEASEDIR -print -path $RELEASEDIR/usr -prune | wc -l >$RELEASEDIR/.rootfiles
2807f99f3a2SThomas Veerman
2813ba3608cSLionel Sambuc##########################################################################
2827f99f3a2SThomas Veermanecho " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
2833ba3608cSLionel Sambuc##########################################################################
2847f99f3a2SThomas Veermanfitfs $RELEASEDIR $TMPDISKROOT 64 256 "$ROOTMB"
2857f99f3a2SThomas VeermanROOTBLOCKS=$blocks
2867f99f3a2SThomas VeermanROOTSECTS="`expr $blocks \* \( $BS / 512 \)`"
2877f99f3a2SThomas Veermanmount $TMPDISKROOT $RELEASEMNTDIR || exit
2887f99f3a2SThomas Veerman
2897f99f3a2SThomas Veermanecho " * Mounting $TMPDISKUSR as $RELEASEMNTDIR/usr"
2907f99f3a2SThomas Veermanfitfs $RELEASEDIR/usr $TMPDISKUSR 0 0 "$USRMB"
2917f99f3a2SThomas VeermanUSRBLOCKS=$blocks
2927f99f3a2SThomas VeermanUSRSECTS="`expr $blocks \* \( $BS / 512 \)`"
2937f99f3a2SThomas Veermanmkdir -m 755 $RELEASEMNTDIR/usr
2947f99f3a2SThomas Veermanmount $TMPDISKUSR $RELEASEMNTDIR/usr || exit
2957f99f3a2SThomas Veerman
2963ba3608cSLionel Sambuc##########################################################################
2977f99f3a2SThomas Veermanecho " * Copying files from staging to image"
2983ba3608cSLionel Sambuc##########################################################################
2997f99f3a2SThomas Veermansynctree -f $RELEASEDIR $RELEASEMNTDIR > /dev/null || true
300ac65742aSDavid van Moolenbroekexpr `df -kP $TMPDISKUSR | tail -1 | awk '{ print $3 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
3017f99f3a2SThomas Veerman
3027f99f3a2SThomas Veermanecho " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
3037f99f3a2SThomas Veermanumount $TMPDISKUSR || exit
3047f99f3a2SThomas Veerman
3057f99f3a2SThomas Veermanecho " * Making image bootable"
3069dfbfc9aSBen Grascd_root_changes
3077f99f3a2SThomas Veerman
3087f99f3a2SThomas Veermanecho " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
3097f99f3a2SThomas Veermanumount $TMPDISKROOT || exit
3107f99f3a2SThomas Veermanrm -r $RELEASEMNTDIR
3117f99f3a2SThomas Veerman
3123ba3608cSLionel Sambuc##########################################################################
3133ba3608cSLionel Sambucecho " * Generating image files"
3143ba3608cSLionel Sambuc##########################################################################
3157f99f3a2SThomas Veermandd if=$TMPDISKROOT of=$ROOTIMAGE bs=$BS count=$ROOTBLOCKS
3167f99f3a2SThomas Veermancp release/cd/* $CDFILES || true
3177f99f3a2SThomas Veermanecho "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
3187f99f3a2SThomas Veerman
3197f99f3a2SThomas Veermanboottype=-n
3207f99f3a2SThomas Veermanbootimage=$IMAGE
3217f99f3a2SThomas Veerman
3227f99f3a2SThomas Veermancp $RELEASEDIR/usr/mdec/boot_monitor $CDFILES/boot
3237f99f3a2SThomas Veermancp -rf $RELEASEDIR/boot/minix_latest/* $CDFILES/
3247f99f3a2SThomas Veermangzip -d $CDFILES/*gz
3257f99f3a2SThomas Veermanwriteisofs -s0x0 -l MINIX -B $bootimage $boottype $CDFILES $IMG || exit 1
3267f99f3a2SThomas Veerman
3277f99f3a2SThomas Veermanecho "Appending Minix root and usr filesystem"
3287f99f3a2SThomas Veerman# Pad ISO out to cylinder boundary
3297f99f3a2SThomas Veermanisobytes=`stat -f %z $IMG`
3307f99f3a2SThomas Veermanisosects=`expr $isobytes / 512`
3317f99f3a2SThomas Veermanisopad=`expr $secs - '(' $isosects % $secs ')'`
3327f99f3a2SThomas Veermandd if=/dev/zero count=$isopad >>$IMG
3337f99f3a2SThomas Veerman# number of sectors
3347f99f3a2SThomas Veermanisosects=`expr $isosects + $isopad`
3357f99f3a2SThomas Veerman( cat $IMG $ROOTIMAGE ;
3367f99f3a2SThomas Veerman	dd if=$TMPDISKUSR bs=$BS count=$USRBLOCKS ) >m
3377f99f3a2SThomas Veermanmv m $IMG
3387f99f3a2SThomas Veerman# Make CD partition table
3397f99f3a2SThomas Veermaninstallboot_nbsd -m $IMG /usr/mdec/mbr
3407f99f3a2SThomas Veerman# Make sure there is no hole..! Otherwise the ISO format is
3417f99f3a2SThomas Veerman# unreadable.
3427f99f3a2SThomas Veermanpartition -m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
3437f99f3a2SThomas Veerman
3447f99f3a2SThomas Veerman# Clean up: RELEASEDIR no longer needed
3457f99f3a2SThomas Veermanrm -r $RELEASEDIR
3467f99f3a2SThomas Veerman
3477f99f3a2SThomas Veermanif [ "$FILENAMEOUT" ]
3487f99f3a2SThomas Veermanthen	echo "$IMG" >$FILENAMEOUT
3497f99f3a2SThomas Veermanfi
3507f99f3a2SThomas Veerman
3513ba3608cSLionel Sambuc##########################################################################
3527f99f3a2SThomas Veermanecho " * Freeing up memory used by ramdisks"
3533ba3608cSLionel Sambuc##########################################################################
3547f99f3a2SThomas Veermanramdisk 1 $TMPDISKROOT
3557f99f3a2SThomas Veermanramdisk 1 $TMPDISKUSR
356