8 PACKAGEDIR
=/usr
/pkgsrc
/packages
/`uname -r`/`uname -m`
9 # List of packages included on installation media
10 PACKAGELIST
=packages.
install
14 PKG_ADD
=/usr
/pkg
/sbin
/pkg_add
17 then echo Please
install pkg_install from pkgsrc.
21 # Packages we have to pre-install, and url to use
22 PREINSTALLED_PACKAGES
="pkgin-0.3.3.4.tgz pkg_install-20101212 bmake-20100808"
23 PACKAGEURL
=ftp://ftp.minix3.org
/pub
/minix
/packages
/`uname -r`/`uname -m`/All
/
25 RELEASERC
=$HOME/.releaserc
34 TRUNK
=https
://gforge.cs.vu.nl
/svn
/minix
/trunk
38 dd if=$TMPDISKUSR of
=usrimage bs
=$BS count
=$USRBLOCKS
40 rootsize
=`stat -size rootimage`
41 usrsize
=`stat -size usrimage`
43 rootsects
=`expr $rootsize / 512`
44 usrsects
=`expr $usrsize / 512`
46 # installboot -m needs at least 1KB
47 dd < /dev
/zero
>tmpimage count
=2
48 partition
-fm tmpimage
2 81:$rootsects* 0:0 81:$usrsects
49 installboot
-m tmpimage
/usr
/mdec
/masterboot
50 dd < tmpimage
> subpart count
=1
52 primsects
=`expr 1 + $rootsects + $usrsects`
53 cyl
=`expr '(' $primsects ')' / $secs + 1`
54 padsects
=`expr $cyl \* $secs - 1 - $primsects`
56 { dd < /dev
/zero count
=1
60 dd < /dev
/zero count
=$padsects
62 partition
-m hdimage
81:`expr $primsects + $padsects`*
63 installboot
-m hdimage
/usr
/mdec
/masterboot
73 echo " * Updating $dir
76 files
=`awk <$list '{ print "'$url'/" $1 ".tgz" }'`
77 fetch
-r $files || true
83 edparams
$TMPDISKROOT 'unset bootopts;
92 bootbig(1, Regular MINIX 3) { unset image; boot }
93 leader() { echo \n--- Welcome to MINIX 3. This is the boot monitor. ---\n\nChoose an option from the menu or press ESC if you need to do anything special.\nOtherwise I will boot with my defaults in 10 seconds.\n\n }; main(){trap 10000 boot; menu; };
99 $RELEASEDIR/usr
/bin
/installboot
-d $TMPDISKROOT \
100 $RELEASEDIR/usr
/mdec
/bootblock boot
/boot
107 bootbig(1, Regular MINIX 3) { image=/boot/image_big; boot }
108 main() { trap 10000 boot ; menu; }
109 save' |
$RELEASEDIR/usr
/bin
/edparams
$TMPDISKROOT
114 $RELEASEDIR/usr
/bin
/installboot
-d $TMPDISKROOT \
115 $RELEASEDIR/usr
/mdec
/bootblock boot
/boot
120 bootbig(1, Regular MINIX 3) { image=/boot/image_big; boot }
121 leader() { echo \n--- Welcome to MINIX 3. This is the boot monitor. ---\n\nChoose an option from the menu or press ESC if you need to do anything special.\nOtherwise I will boot with my defaults in 10 seconds.\n\n }; main(){trap 10000 boot; menu; };
122 save' |
$RELEASEDIR/usr
/bin
/edparams
$TMPDISKROOT
133 # Determine number of inodes
134 inodes
=`find $path | egrep -v ^$path/usr | wc -l`
135 inodes
="`expr $inodes + $extra_inodes`"
137 # Determine number of data zones
138 zonekbs
=`du -Fs $path | cut -d' ' -f1`
140 [ ! -d $path/usr
] || zonekbsignore
=`du -Fs $path/usr | cut -d" " -f1`
141 zones
="`expr \( $zonekbs - $zonekbsignore \) / \( $BS / 1024 \) + $extra_zones`"
143 # Determine file system size
144 BSBITS
="`expr $BS \* 8`"
145 imap_blocks
="`expr \( $inodes + $BSBITS - 1 \) / $BSBITS`"
146 inode_blocks
="`expr \( $inodes \* 64 + $BS - 1 \) / $BS`"
147 zmap_blocks
="`expr \( $zones + $BSBITS - 1 \) / $BSBITS`"
148 blocks
="`expr 1 + 1 + $imap_blocks + $zmap_blocks + $inode_blocks + $zones`"
149 kbs
="`expr $blocks \* \( $BS / 1024 \)`"
151 # Apply default if higher
152 if [ -n "$mbsdefault" ]
154 kbsdefault
="`expr $mbsdefault \* 1024`"
155 if [ "$kbs" -lt "$kbsdefault" ]
157 else echo "warning: ${mbsdefault}mb is too small, using ${kbs}kb"
161 # Create a filesystem on the target ramdisk
162 ramdisk
$kbs $ramdisk
163 mkfs.mfs
-B $BS -i $inodes $ramdisk
166 RELEASEDIR
=/usr
/r-staging
168 RELEASEPACKAGE
=${RELEASEDIR}/usr
/install
/packages
170 IMAGE
=..
/boot
/cdbootblock
/cdbootblock
172 CDFILES
=/usr
/tmp
/cdreleasefiles
173 sh tell_config OS_RELEASE . OS_VERSION
>/tmp
/rel.$$
174 version_pretty
=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$`
175 version
=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$ | tr . _`
176 IMG_BASE
=minix
${version}_ide
188 if git
--version >/dev
/null
189 then if [ -d ..
/.git
]
190 then REVTAG
="`git describe --always`"
191 echo "git mode; building $REVTAG"
198 while getopts "s:pmMchu?r:f:" c
202 echo "Usage: $0 [-p] [-c] [-h] [-m] [-M] [-r <tag>] [-u] [-f <filename>] [-s <username>]" >&2
206 echo " * Making HD image"
207 IMG_BASE
=minix
${version}_bios
211 echo " * Copying, not SVN"
221 echo " * Making live USB-stick image"
222 IMG_BASE
=minix
${version}_usb
227 FILENAMEOUT
="$OPTARG"
229 s
) USERNAME
="--username=$OPTARG"
243 if [ $PACKAGES -ne 0 ]
244 then mkdir
-p $PACKAGEDIR/All || true
245 retrieve
$PACKAGEDIR/All
$PACKAGELIST packages
/`uname -p`/`uname -r`
250 echo "Note: this script wants to do svn operations."
254 TMPDISKROOT
=/dev
/ram1
256 if [ ! -b $TMPDISKUSR -o ! $TMPDISKROOT ]
257 then echo "$TMPDISKUSR or $TMPDISKROOT is not a block device.."
261 if [ $TMPDISKUSR = $TMPDISKROOT ]
263 echo "Temporary devices can't be equal."
267 echo " * Cleanup old files"
268 umount
$TMPDISKUSR || true
269 umount
$TMPDISKROOT || true
270 umount
$RELEASEMNTDIR/usr || true
271 umount
$RELEASEMNTDIR || true
273 rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image
*
274 mkdir
-p $CDFILES ||
exit
275 mkdir
-p $RELEASEDIR $RELEASEMNTDIR
276 mkdir
-m 755 $RELEASEDIR/usr
277 mkdir
-m 1777 $RELEASEDIR/tmp
279 mkdir
-p $RELEASEDIR/tmp
280 mkdir
-p $RELEASEDIR/usr
/tmp
281 mkdir
-p $RELEASEDIR/$XBIN
282 mkdir
-p $RELEASEDIR/usr
/bin
283 mkdir
-p $RELEASEDIR/bin
284 mkdir
-p $RELEASEPACKAGE
286 echo " * Transfering bootstrap dirs to $RELEASEDIR"
287 cp -p /bin
/* /usr
/bin
/* /sbin
/* $RELEASEDIR/$XBIN
288 cp -rp /usr
/lib
$RELEASEDIR/usr
289 cp -rp /bin
/sh
/bin
/echo $RELEASEDIR/bin
290 cp -rp /usr
/bin
/make /usr
/bin
/install /usr
/bin
/yacc /usr
/bin
/lex /usr
/bin
/asmconv
$RELEASEDIR/usr
/bin
292 CONFIGHEADER
=$RELEASEDIR/usr
/src
/common
/include
/minix
/sys_config.h
294 if [ -d $PACKAGEDIR -a -f $PACKAGELIST -a $PACKAGES -ne 0 ]
297 indexpath
=$PACKAGEDIR/.index
299 if [ ! -d $indexpath ]
300 then mkdir
$indexpath
302 if [ ! -d $indexpath ]
303 then echo "Couldn't create $indexpath."
307 echo "" >$PACKAGEDIR/All
/$index
309 echo " * Transfering $PACKAGEDIR to $RELEASEPACKAGE"
310 for p
in `cat $PACKAGELIST`
311 do if [ -f $PACKAGEDIR/All
/$p.tgz
]
313 # Copy package and create package's index
316 cp $p.tgz
$RELEASEPACKAGE/
319 indexname
=$indexpath/$f.
$index
320 pkg_info
-X $f >$indexname
322 if [ ! -f $indexname ]
323 then echo Missing
$indexname.
327 if [ "`wc -l $indexname`" -lt 3 ]
328 then $indexname is too short.
333 cat $indexname >>$PACKAGEDIR/All
/$index
336 echo "Can't copy $PACKAGEDIR/$p.tgz. Missing."
340 bzip2 -f $PACKAGEDIR/All
/$index
341 cp $PACKAGEDIR/All
/$index.bz2
$RELEASEPACKAGE/
344 # Make sure compilers and libraries are root-owned
345 chown
-R root
$RELEASEDIR/usr
/lib
346 chmod -R u
+w
$RELEASEDIR/usr
/lib
348 if [ "$COPY" -ne 1 -a "$GITMODE" -ne 1 ]
350 echo " * Doing new svn export"
351 TOOLSREPO
="`svn info | grep '^URL: ' | awk '{ print $2 }'`"
352 REPO
="`echo $TOOLSREPO | sed 's/.tools$//'`"
353 BRANCHNAME
="`echo $REPO | awk -F/ '{ print $NF }'`"
354 REVISION
="`svn info $USERNAME $SVNREV $REPO | grep '^Revision: ' | awk '{ print $2 }'`"
355 echo "Doing export of revision $REVISION from $REPO."
356 ( cd $RELEASEDIR/usr
&& svn
-q $USERNAME export -r$REVISION $REPO $SRC )
357 if [ $BRANCHNAME = src
]
358 then REVTAG
=r
$REVISION
359 else REVTAG
=branch-
$BRANCHNAME-r$REVISION
364 /* Added by release script */
365 #ifndef _VCS_REVISION
366 #define _VCS_REVISION \"$REVTAG\"
367 #endif" >>$CONFIGHEADER
370 if [ "$USB" -ne 0 ]; then
371 IMG
=${IMG_BASE}_
${REVTAG}.img
373 IMG
=${IMG_BASE}_
${REVTAG}.iso
376 elif [ "$COPY" -eq 1 ]
378 ( cd ..
&& make depend
&& make clean
)
380 ( cd $srcdir && tar cf
- .
) |
( cd $RELEASEDIR/usr
&& mkdir
$SRC && cd $SRC && tar xf
- )
383 IMG
=${IMG_BASE}_copy.iso
384 elif [ "$GITMODE" -eq 1 ]
386 srcdir
=$RELEASEDIR/usr
/src
387 git clone
file://..
$srcdir
388 ( cd $srcdir && git checkout
$REVTAG && rm -r .git
)
391 /* Added by release script */
392 #ifndef _VCS_REVISION
393 #define _VCS_REVISION \"$REVTAG\"
394 #endif" >>$CONFIGHEADER
398 echo " * Fixups for owners and modes of dirs and files"
399 chown
-R root
$RELEASEDIR/usr
/$SRC
400 chmod -R u
+w
$RELEASEDIR/usr
/$SRC
401 find $RELEASEDIR/usr
/$SRC -type d |
xargs chmod 755
402 find $RELEASEDIR/usr
/$SRC -type f |
xargs chmod 644
403 find $RELEASEDIR/usr
/$SRC -name configure |
xargs chmod 755
404 find $RELEASEDIR/usr
/$SRC/commands
-name build |
xargs chmod 755
405 # Bug tracking system not for on cd
406 rm -rf $RELEASEDIR/usr
/$SRC/doc
/bugs
408 # Make sure the CD knows it's a CD, unless it's not
410 then date >$RELEASEDIR/CD
412 echo " * Bootstrap /usr/share/mk files"
413 # Need /usr/share/mk in the new system to invoke make. Real ownerships
414 # and permissions will be set by its own src/share/mk/Makefile.
415 mkdir
-p $RELEASEDIR/usr
/share
/mk
416 chmod 755 $RELEASEDIR/usr
/share
/mk
417 cp $RELEASEDIR/usr
/src
/share
/mk
/* $RELEASEDIR/usr
/share
/mk
/
418 chown
-R root
$RELEASEDIR/usr
/share
/mk
419 cp chrootmake.sh
$RELEASEDIR/usr
/$SRC/tools
/chrootmake.sh
421 echo " * Make hierarchy"
422 chroot
$RELEASEDIR "PATH=/$XBIN sh -x /usr/$SRC/tools/chrootmake.sh etcfiles" ||
exit 1
424 for p
in $PREINSTALLED_PACKAGES
425 do echo " * Pre-installing: $p from $PACKAGEURL"
426 $PKG_ADD -P $RELEASEDIR $PACKAGEURL/$p
429 echo " * Chroot build"
430 chroot
$RELEASEDIR "PATH=/$XBIN MAKEMAP=$MAKEMAP sh -x /usr/$SRC/tools/chrootmake.sh" ||
exit 1
431 # Copy built images for cd booting
432 cp $RELEASEDIR/boot
/image_big image
433 echo " * Chroot build done"
434 echo " * Removing bootstrap files"
435 rm -rf $RELEASEDIR/$XBIN
436 # The build process leaves some file in $SRC as bin.
437 chown
-R root
$RELEASEDIR/usr
/src
*
438 cp issue.
install $RELEASEDIR/etc
/issue
440 echo $version_pretty, SVN revision
$REVISION, generated
`date` >$RELEASEDIR/etc
/version
441 rm -rf $RELEASEDIR/tmp
/*
442 if [ $MINIMAL -ne 0 ]
444 if [ "$MAKEMAP" -ne 0 ]
446 echo " * Copying symbol map to ${IMG}-symbols.txt"
447 cp $RELEASEDIR/usr
/src
/symbols.txt
${IMG}-symbols.txt
448 $ZIP -f ${IMG}-symbols.txt
451 echo " * Removing files to create minimal image"
452 rm -rf $RELEASEDIR/boot
/image
/* $RELEASEDIR/usr
/man
/man
*/* \
453 $RELEASEDIR/usr
/share
/zoneinfo
* $RELEASEDIR/usr
/src
454 mkdir
-p $RELEASEDIR/usr
/src
/tools
455 ln $RELEASEDIR/boot
/image_big
$RELEASEDIR/boot
/image
/$version
458 echo " * Counting files"
459 extrakb
=`du -s $RELEASEDIR/usr/install | awk '{ print $1 }'`
460 find $RELEASEDIR/usr | fgrep
-v /install
/ |
wc -l >$RELEASEDIR/.usrfiles
461 find $RELEASEDIR -print -path $RELEASEDIR/usr
-prune |
wc -l >$RELEASEDIR/.rootfiles
463 echo " * Writing fstab"
469 ' > $RELEASEDIR/etc
/fstab
470 elif [ "$HDEMU" -ne 0 ]
475 usr_roflag="-r"' > $RELEASEDIR/etc
/fstab
478 echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
479 fitfs
$RELEASEDIR $TMPDISKROOT 64 256 "$ROOTMB"
481 ROOTSECTS
="`expr $blocks \* \( $BS / 512 \)`"
482 mount
$TMPDISKROOT $RELEASEMNTDIR ||
exit
484 echo " * Mounting $TMPDISKUSR as $RELEASEMNTDIR/usr"
485 fitfs
$RELEASEDIR/usr
$TMPDISKUSR 0 0 "$USRMB"
487 USRSECTS
="`expr $blocks \* \( $BS / 512 \)`"
488 mkdir
-m 755 $RELEASEMNTDIR/usr
489 mount
$TMPDISKUSR $RELEASEMNTDIR/usr ||
exit
491 echo " * Copying files from staging to image"
492 synctree
-f $RELEASEDIR $RELEASEMNTDIR > /dev
/null || true
493 expr `df $TMPDISKUSR | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
495 echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
496 umount
$TMPDISKUSR ||
exit
497 echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
498 umount
$TMPDISKROOT ||
exit
501 echo " * Making image bootable"
505 elif [ "$HDEMU" -ne 0 ]
512 # Clean up: RELEASEDIR no longer needed
516 dd if=$TMPDISKROOT of
=$ROOTIMAGE bs
=$BS count
=$ROOTBLOCKS
517 cp release
/cd
/* $CDFILES || true
518 echo "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
522 if [ "$HDEMU" -ne 0 ]; then
528 if [ "$USB" -ne 0 ]; then
531 cp ..
/boot
/boot
/boot
$CDFILES
532 writeisofs
-s0x0 -l MINIX
-a boot
-b $bootimage $boottype $CDFILES $IMG ||
exit 1
534 if [ "$HDEMU" -eq 0 ]
536 echo "Appending Minix root and usr filesystem"
537 # Pad ISO out to cylinder boundary
538 isobytes
=`stat -size $IMG`
539 isosects
=`expr $isobytes / 512`
540 isopad
=`expr $secs - '(' $isosects % $secs ')'`
541 dd if=/dev
/zero count
=$isopad >>$IMG
543 isosects
=`expr $isosects + $isopad`
544 ( cat $IMG $ROOTIMAGE ;
545 dd if=$TMPDISKUSR bs
=$BS count
=$USRBLOCKS ) >m
547 # Make CD partition table
548 installboot
-m $IMG /usr
/mdec
/masterboot
549 # Make sure there is no hole..! Otherwise the ISO format is
551 partition
-m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
554 echo "${ZIP}ping $IMG"
557 if [ "$FILENAMEOUT" ]
558 then echo "$IMG" >$FILENAMEOUT
561 echo " * Freeing up memory used by ramdisks"
562 ramdisk
1 $TMPDISKROOT
563 ramdisk
1 $TMPDISKUSR