7 version_pretty
="`sh tell_config OS_RELEASE . OS_VERSION | tr -dc 0-9.`"
8 version
="`echo $version_pretty | tr . _`"
9 PACKAGEDIR
=/usr
/pkgsrc
/packages
/$version_pretty/`uname -m`
12 REPO
=git
://git.minix3.org
/minix
15 # List of packages included on installation media
16 PACKAGELIST
=packages.
install
20 PKG_ADD
=/usr
/pkg
/sbin
/pkg_add
21 PKG_INFO
=/usr
/pkg
/sbin
/pkg_info
24 then echo Please
install pkg_install from pkgsrc.
28 # Packages we have to pre-install, and url to use
29 PACKAGEURL
=ftp://ftp.minix3.org
/pub
/minix
/packages
/$version_pretty/`uname -m`/All
/
30 PREINSTALLED_PACKAGES
="
39 PKG_ADD_URL
=$PACKAGEURL
41 RELEASERC
=$HOME/.releaserc
49 export RELEASEDIR
=/usr
/r-staging
52 IMAGE
=/usr
/mdec
/bootxx_cd9660
54 CDFILES
=/usr
/tmp
/cdreleasefiles
55 sh tell_config OS_RELEASE . OS_VERSION
>/tmp
/rel.$$
56 IMG_BASE
=minix
${version}_ide
70 if git
--version >/dev
/null
71 then if [ -d ..
/.git
]
72 then LOCAL_REVTAG
="`git describe --always`"
79 while getopts "b:j:ls:pmMchu?f:L:e:" c
83 echo "Usage: $0 [-l] [-p] [-c] [-h] [-m] [-M] [-u] [-f <filename>] [-s <username>] -j<jaildir> [-L <packageurl>] [-e <extras-path>]" >&2
90 echo " * Making HD image"
91 IMG_BASE
=minix
${version}_bios
95 echo " * Copying, not using GIT"
106 echo " * Making live USB-stick image"
107 IMG_BASE
=minix
${version}_usb
112 FILENAMEOUT
="$OPTARG"
114 s
) USERNAME
="--username=$OPTARG"
121 l
) PKG_ADD_URL
=file://$PACKAGEDIR/All
123 L
) PKG_ADD_URL
="$OPTARG"
127 EXTRAS_PATH
="$OPTARG"
132 RELEASEPACKAGE
=${RELEASEDIR}/usr
/install
/packages
134 if [ $GITMODE -ne 1 -a $COPY -ne 1 ]
135 then echo "Need git to retrieve latest minix! Copying src instead!"
143 if [ $PACKAGES -ne 0 ]
144 then mkdir
-p $PACKAGEDIR/All || true
145 retrieve
$PACKAGEDIR/All
$PACKAGELIST packages
/`uname -p`/$VERSION_PRETTY
149 TMPDISKROOT
=/dev
/ram1
151 if [ ! -b $TMPDISKUSR -o ! $TMPDISKROOT ]
152 then echo "$TMPDISKUSR or $TMPDISKROOT is not a block device.."
156 if [ $TMPDISKUSR = $TMPDISKROOT ]
158 echo "Temporary devices can't be equal."
163 then echo " * Cleanup old files"
164 umount
$TMPDISKUSR || true
165 umount
$TMPDISKROOT || true
166 umount
$RELEASEMNTDIR/usr || true
167 umount
$RELEASEMNTDIR || true
170 rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image
* || true
171 mkdir
-p $CDFILES ||
exit
172 mkdir
-p $RELEASEDIR $RELEASEMNTDIR
173 mkdir
-p $RELEASEPACKAGE
175 ##########################################################################
176 echo " * Bootstrapping filesystem in $RELEASEDIR"
177 ##########################################################################
178 CONFIGHEADER
=$RELEASEDIR/usr
/src
/include
/minix
/sys_config.h
184 echo "Retrieving latest minix repo from $REPO branch $GITBRANCH."
185 srcdir
=$RELEASEDIR/usr
/src
186 git clone
-b $GITBRANCH $REPO $srcdir
188 then echo "Doing checkout of $REVTAG."
189 (cd $srcdir && git checkout
$REVTAG )
190 else REVTAG
=`(cd $srcdir && git rev-parse --short HEAD)`
191 echo "Retrieved repository head in $srcdir is $REVTAG."
193 if [ $MINIMAL -ne 0 ]
194 then rm -r $srcdir/.git
197 /* Added by release script */
198 #ifndef _VCS_REVISION
199 #define _VCS_REVISION \"$REVTAG\"
200 #endif" >>$CONFIGHEADER
203 if [ "$USB" -ne 0 ]; then
204 IMG
=${IMG_BASE}_${DATE}_${REVTAG}.img
206 IMG
=${IMG_BASE}_${DATE}_${REVTAG}.iso
209 echo "First cleaning current sourcedir.."
210 ( cd ..
&& make cleandir
>/dev
/null
)
211 echo "Copying contents from current src dir."
213 ( cd $srcdir && tar --exclude .svn
-cf - .
) |
( cd $RELEASEDIR/usr
&& mkdir
$SRC && cd $SRC && tar xf
- )
217 IMG
=${IMG_BASE}_copy.iso
220 # Make sure the CD knows it's a CD, unless it's not
222 then date >$RELEASEDIR/CD
225 rm -f $RELEASEDIR/usr
/$SRC/releasetools
/revision
227 for p
in $PREINSTALLED_PACKAGES
228 do echo " * Pre-installing: $p from $PKG_ADD_URL"
229 $PKG_ADD -f -P $RELEASEDIR $PKG_ADD_URL/$p
232 if [ "$CUSTOM_PACKAGES" ]
233 then echo $PKG_ADD_URL >$RELEASEDIR/usr
/pkg
/etc
/pkgin
/repositories.conf
236 echo " * Resetting timestamps"
237 find $RELEASEDIR |
xargs touch
239 ##########################################################################
241 ##########################################################################
243 cd $RELEASEDIR/usr
/src
244 make distribution DESTDIR
=$RELEASEDIR CHECKFLIST
=no
245 make -C releasetools do-hdboot DESTDIR
=$RELEASEDIR MKINSTALLBOOT
=yes
246 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$RELEASEDIR
247 cp $RELEASEDIR/boot
/minix_latest
/* $RELEASEDIR/boot
/minix_default
/
249 if [ $MAKEMAP -ne 0 ]; then
250 find .
-type f
-perm 755 |
xargs nm
-n 2> /dev
/null
> symbols.txt
258 ##########################################################################
259 echo " * Removing bootstrap files"
260 ##########################################################################
261 # The build process leaves some file in $SRC as bin.
262 chown
-R root
$RELEASEDIR/usr
/src
*
263 cp issue.
install $RELEASEDIR/etc
/issue
265 echo $version_pretty, SVN revision
$REVISION, generated
`date` >$RELEASEDIR/etc
/version
266 rm -rf $RELEASEDIR/tmp
/*
268 if [ $MINIMAL -ne 0 ]
270 if [ "$MAKEMAP" -ne 0 ]
272 echo " * Copying symbol map to ${IMG}-symbols.txt"
273 cp $RELEASEDIR/usr
/src
/symbols.txt
${IMG}-symbols.txt
274 $ZIP -f ${IMG}-symbols.txt
277 echo " * Removing files to create minimal image"
278 rm -rf $RELEASEDIR/usr
/man
/man
*/* \
279 $RELEASEDIR/usr
/share
/zoneinfo
* $RELEASEDIR/usr
/src
280 mkdir
-p $RELEASEDIR/usr
/src
/releasetools
283 if [ $EXTRAS_INSTALL -ne 0 ] ; then
284 echo " * Copying files from $EXTRAS_PATH"
285 cp -Rv $EXTRAS_PATH/* $RELEASEDIR
288 # If we are making a jail, all is done!
290 then echo "Created new minix install in $RELEASEDIR."
291 echo "Enter it by typing: "
292 echo "# chroot $RELEASEDIR /bin/sh"
296 ##########################################################################
297 echo " * Counting files"
298 ##########################################################################
299 extrakb
=`du -ks $RELEASEDIR/usr/install | awk '{ print $1 }'`
300 find $RELEASEDIR/usr | fgrep
-v /install
/ |
wc -l >$RELEASEDIR/.usrfiles
301 find $RELEASEDIR -print -path $RELEASEDIR/usr
-prune |
wc -l >$RELEASEDIR/.rootfiles
303 fstab_marker
="# Poor man's File System Table."
304 echo " * Writing fstab"
311 " > $RELEASEDIR/etc
/fstab
312 elif [ "$HDEMU" -ne 0 ]
318 usr_roflag=\"-r\"" > $RELEASEDIR/etc
/fstab
321 ##########################################################################
322 echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
323 ##########################################################################
324 fitfs
$RELEASEDIR $TMPDISKROOT 64 256 "$ROOTMB"
326 ROOTSECTS
="`expr $blocks \* \( $BS / 512 \)`"
327 mount
$TMPDISKROOT $RELEASEMNTDIR ||
exit
329 echo " * Mounting $TMPDISKUSR as $RELEASEMNTDIR/usr"
330 fitfs
$RELEASEDIR/usr
$TMPDISKUSR 0 0 "$USRMB"
332 USRSECTS
="`expr $blocks \* \( $BS / 512 \)`"
333 mkdir
-m 755 $RELEASEMNTDIR/usr
334 mount
$TMPDISKUSR $RELEASEMNTDIR/usr ||
exit
336 ##########################################################################
337 echo " * Copying files from staging to image"
338 ##########################################################################
339 synctree
-f $RELEASEDIR $RELEASEMNTDIR > /dev
/null || true
340 expr `df -k $TMPDISKUSR | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
342 echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
343 umount
$TMPDISKUSR ||
exit
345 echo " * Making image bootable"
349 elif [ "$HDEMU" -ne 0 ]
356 echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
357 umount
$TMPDISKROOT ||
exit
360 ##########################################################################
361 echo " * Generating image files"
362 ##########################################################################
363 dd if=$TMPDISKROOT of
=$ROOTIMAGE bs
=$BS count
=$ROOTBLOCKS
364 cp release
/cd
/* $CDFILES || true
365 echo "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
369 if [ "$HDEMU" -ne 0 ]; then
375 if [ "$USB" -ne 0 ]; then
378 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$CDFILES/boot
379 cp -rf $RELEASEDIR/boot
/minix_latest
/* $CDFILES/
381 writeisofs
-s0x0 -l MINIX
-B $bootimage $boottype $CDFILES $IMG ||
exit 1
383 if [ "$HDEMU" -eq 0 ]
385 echo "Appending Minix root and usr filesystem"
386 # Pad ISO out to cylinder boundary
387 isobytes
=`stat -f %z $IMG`
388 isosects
=`expr $isobytes / 512`
389 isopad
=`expr $secs - '(' $isosects % $secs ')'`
390 dd if=/dev
/zero count
=$isopad >>$IMG
392 isosects
=`expr $isosects + $isopad`
393 ( cat $IMG $ROOTIMAGE ;
394 dd if=$TMPDISKUSR bs
=$BS count
=$USRBLOCKS ) >m
396 # Make CD partition table
397 installboot_nbsd
-m $IMG /usr
/mdec
/mbr
398 # Make sure there is no hole..! Otherwise the ISO format is
400 partition
-m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
404 # Clean up: RELEASEDIR no longer needed
407 echo "${ZIP}ping $IMG"
410 if [ "$FILENAMEOUT" ]
411 then echo "$IMG" >$FILENAMEOUT
414 ##########################################################################
415 echo " * Freeing up memory used by ramdisks"
416 ##########################################################################
417 ramdisk
1 $TMPDISKROOT
418 ramdisk
1 $TMPDISKUSR