5 PATH
=$PATH:/usr
/local
/bin
10 # size of /tmp during build
13 PACKAGEDIR
=/usr
/bigports
/Packages
14 PACKAGESOURCEDIR
=/usr
/bigports
/Sources
15 # List of packages included on installation media
16 PACKAGELIST
=packages.
install
17 # List of package source included on installation media
18 PACKAGESOURCELIST
=package_sources.
install
23 TRUNK
=https
://gforge.cs.vu.nl
/svn
/minix
/trunk
27 dd if=$TMPDISK1 of
=usrimage bs
=$BS count
=$USRBLOCKS
29 rootsize
=`stat -size rootimage`
30 usrsize
=`stat -size usrimage`
32 rootsects
=`expr $rootsize / 512`
33 usrsects
=`expr $usrsize / 512`
35 # installboot -m needs at least 1KB
36 dd < /dev
/zero
>tmpimage count
=2
37 partition
-fm tmpimage
2 81:$rootsects* 0:0 81:$usrsects
38 installboot
-m tmpimage
/usr
/mdec
/masterboot
39 dd < tmpimage
> subpart count
=1
41 primsects
=`expr 1 + $rootsects + $usrsects`
42 cyl
=`expr '(' $primsects ')' / $secs + 1`
43 padsects
=`expr $cyl \* $secs - 1 - $primsects`
45 { dd < /dev
/zero count
=1
49 dd < /dev
/zero count
=$padsects
51 partition
-m hdimage
81:`expr $primsects + $padsects`*
52 installboot
-m hdimage
/usr
/mdec
/masterboot
59 url
=http
://www.minix3.org
/$3
63 echo " * Updating $dir
66 files
=`awk <$list '{ print "'$url'/" $1 ".tar.bz2" }'`
67 wget
-c $url/List
$files || true
73 $RELEASEDIR/usr
/bin
/installboot
-d $TMPDISK3 \
74 $RELEASEDIR/usr
/mdec
/bootblock boot
/boot
81 bootbig(1, Regular MINIX 3) { image=/boot/image_big; boot }
82 main() { trap 10000 boot ; menu; }
83 save' |
$RELEASEDIR/usr
/bin
/edparams
$TMPDISK3
88 usr_roflag="-r"' > $RELEASEDIR/etc
/fstab
93 $RELEASEDIR/usr
/bin
/installboot
-d $TMPDISK3 \
94 $RELEASEDIR/usr
/mdec
/bootblock boot
/boot
99 save' |
$RELEASEDIR/usr
/bin
/edparams
$TMPDISK3
104 ' > $RELEASEDIR/etc
/fstab
108 RELEASEPACKAGE
=${RELEASEDIR}/usr
/install
/packages
109 RELEASEPACKAGESOURCES
=${RELEASEDIR}/usr
/install
/package-sources
112 CDFILES
=/usr
/tmp
/cdreleasefiles
113 sh tell_config OS_RELEASE . OS_VERSION
>/tmp
/rel.$$
114 version_pretty
=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$`
115 version
=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$ | tr . _`
116 IMG_BASE
=minix
${version}_ide
127 while getopts "s:pchu?r:f:" c
131 echo "Usage: $0 [-p] [-c] [-h] [-r <tag>] [-u] [-f <filename>] [-s <username>]" >&2
135 echo " * Making HD image"
136 IMG_BASE
=minix
${version}_bios
140 echo " * Copying, not SVN"
150 echo " * Making live USB-stick image"
151 IMG_BASE
=minix
${version}_usb
156 FILENAMEOUT
="$OPTARG"
158 s
) USERNAME
="--username=$OPTARG"
167 if [ $PACKAGES -ne 0 ]
168 then mkdir
-p $PACKAGEDIR || true
169 mkdir
-p $PACKAGESOURCEDIR || true
170 rm -f $PACKAGEDIR/List
171 retrieve
$PACKAGEDIR $PACKAGELIST packages
/`uname -p`/`uname -r`.
`uname -v`
172 retrieve
$PACKAGESOURCEDIR $PACKAGESOURCELIST software
177 USRKB
=$
(($USRMB*1024))
178 USRBLOCKS
=$
(($USRMB * 1024 * 1024 / $BS))
179 USRSECTS
=$
(($USRMB * 1024 * 2))
181 ROOTSECTS
=$
(($ROOTKB * 2))
182 ROOTBLOCKS
=$
(($ROOTKB * 1024 / $BS))
186 echo "Note: this script wants to do svn operations."
193 if [ ! -b $TMPDISK1 -o ! -b $TMPDISK2 -o ! $TMPDISK3 ]
194 then echo "$TMPDISK1, $TMPDISK2 or $TMPDISK3 is not a block device.."
198 umount
$TMPDISK1 || true
199 umount
$TMPDISK2 || true
200 umount
$TMPDISK3 || true
202 ramdisk
$USRKB $TMPDISK1
203 ramdisk
$TMPKB $TMPDISK2
204 ramdisk
$ROOTKB $TMPDISK3
206 if [ $TMPDISK1 = $TMPDISK2 -o $TMPDISK1 = $TMPDISK3 -o $TMPDISK2 = $TMPDISK3 ]
208 echo "Temporary devices can't be equal."
212 echo " * Cleanup old files"
213 rm -rf $RELEASEDIR $IMG $ROOTIMAGE $CDFILES image
*
214 mkdir
-p $CDFILES ||
exit
216 mkfs
-i 2000 -B $BS -b $ROOTBLOCKS $TMPDISK3 ||
exit
217 mkfs
-B 1024 -b $TMPKB $TMPDISK2 ||
exit
218 echo " * mounting $TMPDISK3 as $RELEASEDIR"
219 mount
$TMPDISK3 $RELEASEDIR ||
exit
220 mkdir
-m 755 $RELEASEDIR/usr
221 mkdir
-m 1777 $RELEASEDIR/tmp
222 mount
$TMPDISK2 $RELEASEDIR/tmp
224 mkfs
-B $BS -i 30000 -b $USRBLOCKS $TMPDISK1 ||
exit
225 echo " * Mounting $TMPDISK1 as $RELEASEDIR/usr"
226 mount
$TMPDISK1 $RELEASEDIR/usr ||
exit
227 mkdir
-p $RELEASEDIR/tmp
228 mkdir
-p $RELEASEDIR/usr
/tmp
229 mkdir
-p $RELEASEDIR/$XBIN
230 mkdir
-p $RELEASEDIR/usr
/bin
231 mkdir
-p $RELEASEDIR/bin
232 mkdir
-p $RELEASEPACKAGE
233 mkdir
-p $RELEASEPACKAGESOURCES
235 echo " * Transfering bootstrap dirs to $RELEASEDIR"
236 cp -p /bin
/* /usr
/bin
/* $RELEASEDIR/$XBIN
237 cp -rp /usr
/lib
$RELEASEDIR/usr
238 cp -rp /bin
/bigsh
/bin
/sh
/bin
/echo $RELEASEDIR/bin
239 cp -rp /usr
/bin
/make /usr
/bin
/install /usr
/bin
/yacc /usr
/bin
/flex
/usr
/bin
/asmconv
$RELEASEDIR/usr
/bin
241 if [ -d $PACKAGEDIR -a -d $PACKAGESOURCEDIR -a -f $PACKAGELIST -a -f $PACKAGESOURCELIST -a $PACKAGES -ne 0 ]
242 then echo " * Transfering $PACKAGEDIR to $RELEASEPACKAGE"
243 : >$RELEASEPACKAGE/List
244 for p
in `cat $PACKAGELIST`
245 do if [ -f $PACKAGEDIR/$p.
tar.bz2
]
247 cp $PACKAGEDIR/$p.
tar.bz2
$RELEASEPACKAGE/
248 grep "^$p|" $PACKAGEDIR/List
>>$RELEASEPACKAGE/List ||
echo "$p not found in List"
250 echo "Can't copy $PACKAGEDIR/$p.tar.bz2. Missing."
254 echo " * Transfering $PACKAGESOURCEDIR to $RELEASEPACKAGESOURCES"
255 for p
in `cat $PACKAGESOURCELIST`
257 if [ -f $PACKAGESOURCEDIR/$p.
tar.bz2
]
259 cp $PACKAGESOURCEDIR/$p.
tar.bz2
$RELEASEPACKAGESOURCES/
261 echo "Can't copy $PACKAGESOURCEDIR/$p.tar.bz2. Missing."
266 # Make sure compilers and libraries are bin-owned
267 chown
-R bin
$RELEASEDIR/usr
/lib
268 chmod -R u
+w
$RELEASEDIR/usr
/lib
272 echo " * Doing new svn export"
273 TOOLSREPO
="`svn info | grep '^URL: ' | awk '{ print $2 }'`"
274 REPO
="`echo $TOOLSREPO | sed 's/.tools$//'`"
275 BRANCHNAME
="`echo $REPO | awk -F/ '{ print $NF }'`"
276 REVISION
="`svn info $USERNAME $SVNREV $REPO | grep '^Revision: ' | awk '{ print $2 }'`"
277 echo "Doing export of revision $REVISION from $REPO."
278 ( cd $RELEASEDIR/usr
&& svn
-q $USERNAME export -r$REVISION $REPO $SRC )
279 if [ $BRANCHNAME = src
]
280 then REVTAG
=r
$REVISION
281 else REVTAG
=branch-
$BRANCHNAME-r$REVISION
286 /* Added by release script */
287 #ifndef _SVN_REVISION
288 #define _SVN_REVISION \"$REVTAG\"
289 #endif" >>$RELEASEDIR/usr
/src
/include
/minix
/sys_config.h
292 if [ "$USB" -ne 0 ]; then
293 IMG
=${IMG_BASE}_
${REVTAG}.img
295 IMG
=${IMG_BASE}_
${REVTAG}.iso
299 ( cd ..
&& make depend
&& make clean
)
301 ( cd $srcdir && tar cf
- .
) |
( cd $RELEASEDIR/usr
&& mkdir
$SRC && cd $SRC && tar xf
- )
304 IMG
=${IMG_BASE}_copy.iso
307 echo " * Fixups for owners and modes of dirs and files"
308 chown
-R bin
$RELEASEDIR/usr
/$SRC
309 chmod -R u
+w
$RELEASEDIR/usr
/$SRC
310 find $RELEASEDIR/usr
/$SRC -type d |
xargs chmod 755
311 find $RELEASEDIR/usr
/$SRC -type f |
xargs chmod 644
312 find $RELEASEDIR/usr
/$SRC -name configure |
xargs chmod 755
313 find $RELEASEDIR/usr
/$SRC/commands
-name build |
xargs chmod 755
314 # Bug tracking system not for on cd
315 rm -rf $RELEASEDIR/usr
/$SRC/doc
/bugs
317 # Make sure the CD knows it's a CD, unless it's not
319 then date >$RELEASEDIR/CD
321 echo " * Bootstrap /etc/mk files"
322 # Need /etc/mk in the new system to invoke make. Real ownerships
323 # and permissions will be set by its own src/etc/Makefile.
324 # They have to be owned by bin so that the new make can do its work.
325 mkdir
-p $RELEASEDIR/etc
/mk
326 chmod 755 $RELEASEDIR/etc
/mk
327 cp $RELEASEDIR/usr
/src
/etc
/mk
/* $RELEASEDIR/etc
/mk
/
328 chown
-R bin
$RELEASEDIR/etc
/mk
329 echo " * Chroot build"
330 cp chrootmake.sh
$RELEASEDIR/usr
/$SRC/tools
/chrootmake.sh
331 chroot
$RELEASEDIR "PATH=/$XBIN sh -x /usr/$SRC/tools/chrootmake.sh" ||
exit 1
332 # Copy built images for cd booting
333 cp $RELEASEDIR/boot
/image_big image
334 echo " * Chroot build done"
335 echo " * Removing bootstrap files"
336 rm -rf $RELEASEDIR/$XBIN
337 # The build process leaves some file in $SRC as root.
338 chown
-R bin
$RELEASEDIR/usr
/src
*
339 cp issue.
install $RELEASEDIR/etc
/issue
344 elif [ "$HDEMU" -ne 0 ]
349 echo $version_pretty, SVN revision
$REVISION, generated
`date` >$RELEASEDIR/etc
/version
350 echo " * Counting files"
351 extrakb
=`du -s $RELEASEDIR/usr/install | awk '{ print $1 }'`
352 expr `df $TMPDISK1 | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEDIR/.usrkb
353 find $RELEASEDIR/usr | fgrep
-v /install
/ |
wc -l >$RELEASEDIR/.usrfiles
354 find $RELEASEDIR -xdev |
wc -l >$RELEASEDIR/.rootfiles
355 echo " * Zeroing remainder of temporary areas"
358 cp /dev
/zero
$RELEASEDIR/usr
/.x
2>/dev
/null || true
359 rm $RELEASEDIR/usr
/.x
360 cp /dev
/zero
$RELEASEDIR/.x
2>/dev
/null || true
363 umount
$TMPDISK1 ||
exit
364 umount
$TMPDISK2 ||
exit
365 umount
$TMPDISK3 ||
exit
367 # Boot monitor variables for boot CD
368 edparams
$TMPDISK3 'unset bootopts;
377 bootbig(1, Regular MINIX 3) { unset image; boot }
378 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; };
382 dd if=$TMPDISK3 of
=$ROOTIMAGE bs
=$BS count
=$ROOTBLOCKS
383 cp release
/cd
/* $CDFILES || true
384 echo "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
388 if [ "$HDEMU" -ne 0 ]; then
394 if [ "$USB" -ne 0 ]; then
397 writeisofs
-s0x1000 -l MINIX
-b $bootimage $boottype $CDFILES $IMG ||
exit 1
399 if [ "$HDEMU" -eq 0 ]
401 echo "Appending Minix root and usr filesystem"
402 # Pad ISO out to cylinder boundary
403 isobytes
=`stat -size $IMG`
404 isosects
=`expr $isobytes / 512`
405 isopad
=`expr $secs - '(' $isosects % $secs ')'`
406 dd if=/dev
/zero count
=$isopad >>$IMG
408 isosects
=`expr $isosects + $isopad`
409 ( cat $IMG $ROOTIMAGE ;
410 dd if=$TMPDISK1 bs
=$BS count
=$USRBLOCKS ) >m
412 # Make CD partition table
413 installboot
-m $IMG /usr
/mdec
/masterboot
414 # Make sure there is no hole..! Otherwise the ISO format is
416 partition
-m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
420 if [ "$FILENAMEOUT" ]
421 then echo "$IMG" >$FILENAMEOUT