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
51 RELEASEPACKAGE
=${RELEASEDIR}/usr
/install
/packages
53 IMAGE
=/usr
/mdec
/bootxx_cd9660
55 CDFILES
=/usr
/tmp
/cdreleasefiles
56 sh tell_config OS_RELEASE . OS_VERSION
>/tmp
/rel.$$
57 IMG_BASE
=minix
${version}_ide
71 if git
--version >/dev
/null
72 then if [ -d ..
/.git
]
73 then LOCAL_REVTAG
="`git describe --always`"
80 while getopts "b:j:ls:pmMchu?f:L:e:" c
84 echo "Usage: $0 [-l] [-p] [-c] [-h] [-m] [-M] [-u] [-f <filename>] [-s <username>] -j<jaildir> [-L <packageurl>] [-e <extras-path>]" >&2
91 echo " * Making HD image"
92 IMG_BASE
=minix
${version}_bios
96 echo " * Copying, not using GIT"
107 echo " * Making live USB-stick image"
108 IMG_BASE
=minix
${version}_usb
113 FILENAMEOUT
="$OPTARG"
115 s
) USERNAME
="--username=$OPTARG"
122 l
) PKG_ADD_URL
=file://$PACKAGEDIR/All
124 L
) PKG_ADD_URL
="$OPTARG"
128 EXTRAS_PATH
="$OPTARG"
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 "Copying contents from current src dir."
209 ( cd ..
&& make cleandir
)
211 ( cd $srcdir && tar --exclude .svn
-cf - .
) |
( cd $RELEASEDIR/usr
&& mkdir
$SRC && cd $SRC && tar xf
- )
214 IMG
=${IMG_BASE}_copy.iso
217 # Make sure the CD knows it's a CD, unless it's not
219 then date >$RELEASEDIR/CD
222 rm -f $RELEASEDIR/usr
/$SRC/releasetools
/revision
224 for p
in $PREINSTALLED_PACKAGES
225 do echo " * Pre-installing: $p from $PKG_ADD_URL"
226 $PKG_ADD -f -P $RELEASEDIR $PKG_ADD_URL/$p
229 if [ "$CUSTOM_PACKAGES" ]
230 then echo $PKG_ADD_URL >$RELEASEDIR/usr
/pkg
/etc
/pkgin
/repositories.conf
233 echo " * Resetting timestamps"
234 find $RELEASEDIR |
xargs touch
236 ##########################################################################
238 ##########################################################################
240 cd $RELEASEDIR/usr
/src
241 make distribution DESTDIR
=$RELEASEDIR CHECKFLIST
=no
242 make -C releasetools do-hdboot DESTDIR
=$RELEASEDIR MKINSTALLBOOT
=yes
243 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$RELEASEDIR
244 cp $RELEASEDIR/boot
/minix_latest
/* $RELEASEDIR/boot
/minix_default
/
246 if [ $MAKEMAP -ne 0 ]; then
247 find .
-type f
-perm 755 |
xargs nm
-n 2> /dev
/null
> symbols.txt
255 ##########################################################################
256 echo " * Removing bootstrap files"
257 ##########################################################################
258 # The build process leaves some file in $SRC as bin.
259 chown
-R root
$RELEASEDIR/usr
/src
*
260 cp issue.
install $RELEASEDIR/etc
/issue
262 echo $version_pretty, SVN revision
$REVISION, generated
`date` >$RELEASEDIR/etc
/version
263 rm -rf $RELEASEDIR/tmp
/*
265 if [ $MINIMAL -ne 0 ]
267 if [ "$MAKEMAP" -ne 0 ]
269 echo " * Copying symbol map to ${IMG}-symbols.txt"
270 cp $RELEASEDIR/usr
/src
/symbols.txt
${IMG}-symbols.txt
271 $ZIP -f ${IMG}-symbols.txt
274 echo " * Removing files to create minimal image"
275 rm -rf $RELEASEDIR/usr
/man
/man
*/* \
276 $RELEASEDIR/usr
/share
/zoneinfo
* $RELEASEDIR/usr
/src
277 mkdir
-p $RELEASEDIR/usr
/src
/releasetools
280 if [ $EXTRAS_INSTALL -ne 0 ] ; then
281 echo " * Copying files from $EXTRAS_PATH"
282 cp -Rv $EXTRAS_PATH/* $RELEASEDIR
285 # If we are making a jail, all is done!
287 then echo "Created new minix install in $RELEASEDIR."
288 echo "Enter it by typing: "
289 echo "# chroot $RELEASEDIR /bin/sh"
293 ##########################################################################
294 echo " * Counting files"
295 ##########################################################################
296 extrakb
=`du -ks $RELEASEDIR/usr/install | awk '{ print $1 }'`
297 find $RELEASEDIR/usr | fgrep
-v /install
/ |
wc -l >$RELEASEDIR/.usrfiles
298 find $RELEASEDIR -print -path $RELEASEDIR/usr
-prune |
wc -l >$RELEASEDIR/.rootfiles
300 fstab_marker
="# Poor man's File System Table."
301 echo " * Writing fstab"
308 " > $RELEASEDIR/etc
/fstab
309 elif [ "$HDEMU" -ne 0 ]
315 usr_roflag=\"-r\"" > $RELEASEDIR/etc
/fstab
318 ##########################################################################
319 echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
320 ##########################################################################
321 fitfs
$RELEASEDIR $TMPDISKROOT 64 256 "$ROOTMB"
323 ROOTSECTS
="`expr $blocks \* \( $BS / 512 \)`"
324 mount
$TMPDISKROOT $RELEASEMNTDIR ||
exit
326 echo " * Mounting $TMPDISKUSR as $RELEASEMNTDIR/usr"
327 fitfs
$RELEASEDIR/usr
$TMPDISKUSR 0 0 "$USRMB"
329 USRSECTS
="`expr $blocks \* \( $BS / 512 \)`"
330 mkdir
-m 755 $RELEASEMNTDIR/usr
331 mount
$TMPDISKUSR $RELEASEMNTDIR/usr ||
exit
333 ##########################################################################
334 echo " * Copying files from staging to image"
335 ##########################################################################
336 synctree
-f $RELEASEDIR $RELEASEMNTDIR > /dev
/null || true
337 expr `df -k $TMPDISKUSR | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
339 echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
340 umount
$TMPDISKUSR ||
exit
342 echo " * Making image bootable"
346 elif [ "$HDEMU" -ne 0 ]
353 echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
354 umount
$TMPDISKROOT ||
exit
357 ##########################################################################
358 echo " * Generating image files"
359 ##########################################################################
360 dd if=$TMPDISKROOT of
=$ROOTIMAGE bs
=$BS count
=$ROOTBLOCKS
361 cp release
/cd
/* $CDFILES || true
362 echo "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
366 if [ "$HDEMU" -ne 0 ]; then
372 if [ "$USB" -ne 0 ]; then
375 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$CDFILES/boot
376 cp -rf $RELEASEDIR/boot
/minix_latest
/* $CDFILES/
378 writeisofs
-s0x0 -l MINIX
-B $bootimage $boottype $CDFILES $IMG ||
exit 1
380 if [ "$HDEMU" -eq 0 ]
382 echo "Appending Minix root and usr filesystem"
383 # Pad ISO out to cylinder boundary
384 isobytes
=`stat -f %z $IMG`
385 isosects
=`expr $isobytes / 512`
386 isopad
=`expr $secs - '(' $isosects % $secs ')'`
387 dd if=/dev
/zero count
=$isopad >>$IMG
389 isosects
=`expr $isosects + $isopad`
390 ( cat $IMG $ROOTIMAGE ;
391 dd if=$TMPDISKUSR bs
=$BS count
=$USRBLOCKS ) >m
393 # Make CD partition table
394 installboot_nbsd
-m $IMG /usr
/mdec
/mbr
395 # Make sure there is no hole..! Otherwise the ISO format is
397 partition
-m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
401 # Clean up: RELEASEDIR no longer needed
404 echo "${ZIP}ping $IMG"
407 if [ "$FILENAMEOUT" ]
408 then echo "$IMG" >$FILENAMEOUT
411 ##########################################################################
412 echo " * Freeing up memory used by ramdisks"
413 ##########################################################################
414 ramdisk
1 $TMPDISKROOT
415 ramdisk
1 $TMPDISKUSR