7 version_pretty
="`sh ../sys/conf/osrelease.sh`"
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 IMG_BASE
=minix
${version}_ide
69 if git
--version >/dev
/null
70 then if [ -d ..
/.git
]
71 then LOCAL_REVTAG
="`git describe --always`"
78 while getopts "b:j:ls:pmMchu?f:L:e:" c
82 echo "Usage: $0 [-l] [-p] [-c] [-h] [-m] [-M] [-u] [-f <filename>] [-s <username>] -j<jaildir> [-L <packageurl>] [-e <extras-path>]" >&2
89 echo " * Making HD image"
90 IMG_BASE
=minix
${version}_bios
94 echo " * Copying, not using GIT"
105 echo " * Making live USB-stick image"
106 IMG_BASE
=minix
${version}_usb
111 FILENAMEOUT
="$OPTARG"
113 s
) USERNAME
="--username=$OPTARG"
120 l
) PKG_ADD_URL
=file://$PACKAGEDIR/All
122 L
) PKG_ADD_URL
="$OPTARG"
126 EXTRAS_PATH
="$OPTARG"
131 RELEASEPACKAGE
=${RELEASEDIR}/usr
/install
/packages
133 if [ $GITMODE -ne 1 -a $COPY -ne 1 ]
134 then echo "Need git to retrieve latest minix! Copying src instead!"
142 if [ $PACKAGES -ne 0 ]
143 then mkdir
-p $PACKAGEDIR/All || true
144 retrieve
$PACKAGEDIR/All
$PACKAGELIST packages
/`uname -p`/$VERSION_PRETTY
148 TMPDISKROOT
=/dev
/ram1
150 if [ ! -b $TMPDISKUSR -o ! $TMPDISKROOT ]
151 then echo "$TMPDISKUSR or $TMPDISKROOT is not a block device.."
155 if [ $TMPDISKUSR = $TMPDISKROOT ]
157 echo "Temporary devices can't be equal."
162 then echo " * Cleanup old files"
163 umount
$TMPDISKUSR || true
164 umount
$TMPDISKROOT || true
165 umount
$RELEASEMNTDIR/usr || true
166 umount
$RELEASEMNTDIR || true
169 rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image
* || true
170 mkdir
-p $CDFILES ||
exit
171 mkdir
-p $RELEASEDIR $RELEASEMNTDIR
172 mkdir
-p $RELEASEPACKAGE
174 ##########################################################################
175 echo " * Bootstrapping filesystem in $RELEASEDIR"
176 ##########################################################################
177 CONFIGHEADER
=$RELEASEDIR/usr
/src
/include
/minix
/sys_config.h
183 echo "Retrieving latest minix repo from $REPO branch $GITBRANCH."
184 srcdir
=$RELEASEDIR/usr
/src
185 git clone
-b $GITBRANCH $REPO $srcdir
187 then echo "Doing checkout of $REVTAG."
188 (cd $srcdir && git checkout
$REVTAG )
189 else REVTAG
=`(cd $srcdir && git rev-parse --short HEAD)`
190 echo "Retrieved repository head in $srcdir is $REVTAG."
192 if [ $MINIMAL -ne 0 ]
193 then rm -r $srcdir/.git
196 /* Added by release script */
197 #ifndef _VCS_REVISION
198 #define _VCS_REVISION \"$REVTAG\"
199 #endif" >>$CONFIGHEADER
202 if [ "$USB" -ne 0 ]; then
203 IMG
=${IMG_BASE}_${DATE}_${REVTAG}.img
205 IMG
=${IMG_BASE}_${DATE}_${REVTAG}.iso
208 echo "First cleaning current sourcedir.."
209 ( cd ..
&& make cleandir
>/dev
/null
)
210 echo "Copying contents from current src dir."
212 ( cd $srcdir && tar --exclude .svn
-cf - .
) |
( cd $RELEASEDIR/usr
&& mkdir
$SRC && cd $SRC && tar xf
- )
216 IMG
=${IMG_BASE}_copy.iso
219 # Make sure the CD knows it's a CD, unless it's not
221 then date >$RELEASEDIR/CD
224 rm -f $RELEASEDIR/usr
/$SRC/releasetools
/revision
226 for p
in $PREINSTALLED_PACKAGES
227 do echo " * Pre-installing: $p from $PKG_ADD_URL"
228 $PKG_ADD -f -P $RELEASEDIR $PKG_ADD_URL/$p
231 if [ "$CUSTOM_PACKAGES" ]
232 then echo $PKG_ADD_URL >$RELEASEDIR/usr
/pkg
/etc
/pkgin
/repositories.conf
235 echo " * Resetting timestamps"
236 find $RELEASEDIR |
xargs touch
238 ##########################################################################
240 ##########################################################################
242 cd $RELEASEDIR/usr
/src
243 make distribution DESTDIR
=$RELEASEDIR CHECKFLIST
=no
244 make -C releasetools do-hdboot DESTDIR
=$RELEASEDIR MKINSTALLBOOT
=yes
245 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$RELEASEDIR
246 cp $RELEASEDIR/boot
/minix_latest
/* $RELEASEDIR/boot
/minix_default
/
248 if [ $MAKEMAP -ne 0 ]; then
249 find .
-type f
-perm 755 |
xargs nm
-n 2> /dev
/null
> symbols.txt
257 ##########################################################################
258 echo " * Removing bootstrap files"
259 ##########################################################################
260 # The build process leaves some file in $SRC as bin.
261 chown
-R root
$RELEASEDIR/usr
/src
*
262 cp issue.
install $RELEASEDIR/etc
/issue
264 echo $version_pretty, SVN revision
$REVISION, generated
`date` >$RELEASEDIR/etc
/version
265 rm -rf $RELEASEDIR/tmp
/*
267 if [ $MINIMAL -ne 0 ]
269 if [ "$MAKEMAP" -ne 0 ]
271 echo " * Copying symbol map to ${IMG}-symbols.txt"
272 cp $RELEASEDIR/usr
/src
/symbols.txt
${IMG}-symbols.txt
273 $ZIP -f ${IMG}-symbols.txt
276 echo " * Removing files to create minimal image"
277 rm -rf $RELEASEDIR/usr
/man
/man
*/* \
278 $RELEASEDIR/usr
/share
/zoneinfo
* $RELEASEDIR/usr
/src
279 mkdir
-p $RELEASEDIR/usr
/src
/releasetools
282 if [ $EXTRAS_INSTALL -ne 0 ] ; then
283 echo " * Copying files from $EXTRAS_PATH"
284 cp -Rv $EXTRAS_PATH/* $RELEASEDIR
287 # If we are making a jail, all is done!
289 then echo "Created new minix install in $RELEASEDIR."
290 echo "Enter it by typing: "
291 echo "# chroot $RELEASEDIR /bin/sh"
295 ##########################################################################
296 echo " * Counting files"
297 ##########################################################################
298 extrakb
=`du -ks $RELEASEDIR/usr/install | awk '{ print $1 }'`
299 find $RELEASEDIR/usr | fgrep
-v /install
/ |
wc -l >$RELEASEDIR/.usrfiles
300 find $RELEASEDIR -print -path $RELEASEDIR/usr
-prune |
wc -l >$RELEASEDIR/.rootfiles
302 fstab_marker
="# Poor man's File System Table."
303 echo " * Writing fstab"
310 " > $RELEASEDIR/etc
/fstab
311 elif [ "$HDEMU" -ne 0 ]
317 usr_roflag=\"-r\"" > $RELEASEDIR/etc
/fstab
320 ##########################################################################
321 echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
322 ##########################################################################
323 fitfs
$RELEASEDIR $TMPDISKROOT 64 256 "$ROOTMB"
325 ROOTSECTS
="`expr $blocks \* \( $BS / 512 \)`"
326 mount
$TMPDISKROOT $RELEASEMNTDIR ||
exit
328 echo " * Mounting $TMPDISKUSR as $RELEASEMNTDIR/usr"
329 fitfs
$RELEASEDIR/usr
$TMPDISKUSR 0 0 "$USRMB"
331 USRSECTS
="`expr $blocks \* \( $BS / 512 \)`"
332 mkdir
-m 755 $RELEASEMNTDIR/usr
333 mount
$TMPDISKUSR $RELEASEMNTDIR/usr ||
exit
335 ##########################################################################
336 echo " * Copying files from staging to image"
337 ##########################################################################
338 synctree
-f $RELEASEDIR $RELEASEMNTDIR > /dev
/null || true
339 expr `df -k $TMPDISKUSR | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
341 echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
342 umount
$TMPDISKUSR ||
exit
344 echo " * Making image bootable"
348 elif [ "$HDEMU" -ne 0 ]
355 echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
356 umount
$TMPDISKROOT ||
exit
359 ##########################################################################
360 echo " * Generating image files"
361 ##########################################################################
362 dd if=$TMPDISKROOT of
=$ROOTIMAGE bs
=$BS count
=$ROOTBLOCKS
363 cp release
/cd
/* $CDFILES || true
364 echo "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
368 if [ "$HDEMU" -ne 0 ]; then
374 if [ "$USB" -ne 0 ]; then
377 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$CDFILES/boot
378 cp -rf $RELEASEDIR/boot
/minix_latest
/* $CDFILES/
380 writeisofs
-s0x0 -l MINIX
-B $bootimage $boottype $CDFILES $IMG ||
exit 1
382 if [ "$HDEMU" -eq 0 ]
384 echo "Appending Minix root and usr filesystem"
385 # Pad ISO out to cylinder boundary
386 isobytes
=`stat -f %z $IMG`
387 isosects
=`expr $isobytes / 512`
388 isopad
=`expr $secs - '(' $isosects % $secs ')'`
389 dd if=/dev
/zero count
=$isopad >>$IMG
391 isosects
=`expr $isosects + $isopad`
392 ( cat $IMG $ROOTIMAGE ;
393 dd if=$TMPDISKUSR bs
=$BS count
=$USRBLOCKS ) >m
395 # Make CD partition table
396 installboot_nbsd
-m $IMG /usr
/mdec
/mbr
397 # Make sure there is no hole..! Otherwise the ISO format is
399 partition
-m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
403 # Clean up: RELEASEDIR no longer needed
406 echo "${ZIP}ping $IMG"
409 if [ "$FILENAMEOUT" ]
410 then echo "$IMG" >$FILENAMEOUT
413 ##########################################################################
414 echo " * Freeing up memory used by ramdisks"
415 ##########################################################################
416 ramdisk
1 $TMPDISKROOT
417 ramdisk
1 $TMPDISKUSR