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}
13 : ${GITBRANCH:=master}
16 # Packages we have to pre-install, and url to use
17 : ${PACKAGEURL="http://www.minix3.org/pkgsrc/packages/$version_pretty/`uname -m`/All/"}
18 : ${PREINSTALLED_PACKAGES:="pkg_install pkgin"}
20 # List of packages included on installation media
21 PACKAGELIST
=packages.
install
25 PKG_ADD
=/usr
/pkg
/sbin
/pkg_add
26 PKG_INFO
=/usr
/pkg
/sbin
/pkg_info
29 then echo Please
install pkg_install from pkgsrc.
33 RELEASERC
=$HOME/.releaserc
41 export RELEASEDIR
=/usr
/r-staging
44 IMAGE
=/usr
/mdec
/bootxx_cd9660
46 CDFILES
=/usr
/tmp
/cdreleasefiles
47 IMG_BASE
=minix
${version}_ide
60 if git
--version >/dev
/null
61 then if [ -d ..
/.git
]
62 then LOCAL_REVTAG
="`git describe --always`"
69 while getopts "b:j:lpmMch?f:L:e:" c
73 echo "Usage: $0 [-l] [-p] [-c] [-m] [-M] [-f <filename>] -j<jaildir> [-L <packageurl>] [-e <extras-path>]" >&2
80 echo " * Copying, not using GIT"
98 l
) PACKAGEURL
=file://$PACKAGEDIR/All
100 L
) PACKAGEURL
="$OPTARG"
104 EXTRAS_PATH
="$OPTARG"
109 RELEASEPACKAGE
=${RELEASEDIR}/usr
/install
/packages
111 if [ $GITMODE -ne 1 -a $COPY -ne 1 ]
112 then echo "Need git to retrieve latest minix! Copying src instead!"
120 if [ $PACKAGES -ne 0 ]
121 then mkdir
-p $PACKAGEDIR/All || true
122 retrieve
$PACKAGEDIR/All
$PACKAGELIST packages
/`uname -p`/$VERSION_PRETTY
126 TMPDISKROOT
=/dev
/ram1
128 if [ ! -b $TMPDISKUSR -o ! $TMPDISKROOT ]
129 then echo "$TMPDISKUSR or $TMPDISKROOT is not a block device.."
133 if [ $TMPDISKUSR = $TMPDISKROOT ]
135 echo "Temporary devices can't be equal."
140 then echo " * Cleanup old files"
141 umount
$TMPDISKUSR || true
142 umount
$TMPDISKROOT || true
143 umount
$RELEASEMNTDIR/usr || true
144 umount
$RELEASEMNTDIR || true
147 rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image
* || true
148 mkdir
-p $CDFILES ||
exit
149 mkdir
-p $RELEASEDIR $RELEASEMNTDIR
150 mkdir
-p $RELEASEPACKAGE
152 ##########################################################################
153 echo " * Bootstrapping filesystem in $RELEASEDIR"
154 ##########################################################################
155 CONFIGHEADER
=$RELEASEDIR/usr
/src
/minix
/include
/minix
/sys_config.h
161 echo "Retrieving latest minix repo from $REPO branch $GITBRANCH."
162 srcdir
=$RELEASEDIR/usr
/src
163 git clone
-b $GITBRANCH $REPO $srcdir
164 echo "Triggering fetch scripts"
165 ( cd $srcdir && sh .
/gnu
/dist
/fetch.sh
)
166 ( cd $srcdir && sh .
/external
/gpl
3/binutils
/fetch.sh
)
168 then echo "Doing checkout of $REVTAG."
169 (cd $srcdir && git checkout
$REVTAG )
170 else REVTAG
=`(cd $srcdir && git rev-parse --short HEAD)`
171 echo "Retrieved repository head in $srcdir is $REVTAG."
173 if [ $MINIMAL -ne 0 ]
174 then rm -r $srcdir/.git
177 /* Added by release script */
178 #ifndef _VCS_REVISION
179 #define _VCS_REVISION \"$REVTAG\"
180 #endif" >>$CONFIGHEADER
183 IMG
=${IMG_BASE}_${DATE}_${REVTAG}.iso
185 echo "First cleaning current sourcedir.."
186 ( cd ..
&& make cleandir
>/dev
/null
)
187 echo "Copying contents from current src dir."
189 ( cd $srcdir && tar --exclude .git
-cf - .
) |
( cd $RELEASEDIR/usr
&& mkdir
$SRC && cd $SRC && tar xf
- )
192 IMG
=${IMG_BASE}_copy.iso
195 # Make sure the CD knows it's a CD, unless it's not
198 rm -f $RELEASEDIR/usr
/$SRC/releasetools
/revision
200 for p
in $PREINSTALLED_PACKAGES
201 do echo " * Pre-installing: $p from $PACKAGEURL"
202 $PKG_ADD -f -P $RELEASEDIR $PACKAGEURL/$p
205 if [ "$CUSTOM_PACKAGES" ]
206 then echo $PACKAGEURL >$RELEASEDIR/usr
/pkg
/etc
/pkgin
/repositories.conf
209 echo " * Resetting timestamps"
210 find $RELEASEDIR -print0 |
xargs -n1000 -0 touch
212 ##########################################################################
214 ##########################################################################
216 cd $RELEASEDIR/usr
/src
217 make distribution MKLIBCXX
=yes DESTDIR
=$RELEASEDIR SLOPPY_FLIST
=yes $BUILDOPTIONS
218 make -C releasetools do-hdboot DESTDIR
=$RELEASEDIR MKINSTALLBOOT
=yes
219 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$RELEASEDIR
220 cp $RELEASEDIR/boot
/minix_latest
/* $RELEASEDIR/boot
/minix_default
/
222 if [ $MAKEMAP -ne 0 ]; then
223 find .
-type f
-perm 755 |
xargs nm
-n 2> /dev
/null
> symbols.txt
231 ##########################################################################
232 echo " * Removing bootstrap files"
233 ##########################################################################
234 # The build process leaves some file in $SRC as bin.
235 chown
-R root
$RELEASEDIR/usr
/src
*
236 cp issue.
install $RELEASEDIR/etc
/issue
238 echo $version_pretty, GIT revision
$REVTAG, generated
`date` >$RELEASEDIR/etc
/version
239 rm -rf $RELEASEDIR/tmp
/*
241 if [ $MINIMAL -ne 0 ]
243 if [ "$MAKEMAP" -ne 0 ]
245 echo " * Copying symbol map to ${IMG}-symbols.txt"
246 cp $RELEASEDIR/usr
/src
/symbols.txt
${IMG}-symbols.txt
247 $ZIP -f ${IMG}-symbols.txt
250 echo " * Removing files to create minimal image"
251 rm -rf $RELEASEDIR/usr
/man
/man
*/* \
252 $RELEASEDIR/usr
/share
/zoneinfo
* $RELEASEDIR/usr
/src
253 mkdir
-p $RELEASEDIR/usr
/src
/releasetools
256 if [ $EXTRAS_INSTALL -ne 0 ] ; then
257 echo " * Copying files from $EXTRAS_PATH"
258 cp -Rv $EXTRAS_PATH/* $RELEASEDIR
261 echo " * Removing sources"
263 rm -rf $RELEASEDIR/usr
/src
# No space for /usr/src
264 rm -f $RELEASEDIR/SETS.
* # No need for those.
266 # If we are making a jail, all is done!
268 then echo "Created new minix install in $RELEASEDIR."
269 echo "Enter it by typing: "
270 echo "# chroot $RELEASEDIR /bin/sh"
274 ##########################################################################
275 echo " * Counting files"
276 ##########################################################################
277 extrakb
=`du -ks $RELEASEDIR/usr/install | awk '{ print $1 }'`
278 find $RELEASEDIR/usr | fgrep
-v /install
/ |
wc -l >$RELEASEDIR/.usrfiles
279 find $RELEASEDIR -print -path $RELEASEDIR/usr
-prune |
wc -l >$RELEASEDIR/.rootfiles
281 ##########################################################################
282 echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
283 ##########################################################################
284 fitfs
$RELEASEDIR $TMPDISKROOT 64 256 "$ROOTMB"
286 ROOTSECTS
="`expr $blocks \* \( $BS / 512 \)`"
287 mount
$TMPDISKROOT $RELEASEMNTDIR ||
exit
289 echo " * Mounting $TMPDISKUSR as $RELEASEMNTDIR/usr"
290 fitfs
$RELEASEDIR/usr
$TMPDISKUSR 0 0 "$USRMB"
292 USRSECTS
="`expr $blocks \* \( $BS / 512 \)`"
293 mkdir
-m 755 $RELEASEMNTDIR/usr
294 mount
$TMPDISKUSR $RELEASEMNTDIR/usr ||
exit
296 ##########################################################################
297 echo " * Copying files from staging to image"
298 ##########################################################################
299 synctree
-f $RELEASEDIR $RELEASEMNTDIR > /dev
/null || true
300 expr `df -kP $TMPDISKUSR | tail -1 | awk '{ print $3 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
302 echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
303 umount
$TMPDISKUSR ||
exit
305 echo " * Making image bootable"
308 echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
309 umount
$TMPDISKROOT ||
exit
312 ##########################################################################
313 echo " * Generating image files"
314 ##########################################################################
315 dd if=$TMPDISKROOT of
=$ROOTIMAGE bs
=$BS count
=$ROOTBLOCKS
316 cp release
/cd
/* $CDFILES || true
317 echo "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
322 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$CDFILES/boot
323 cp -rf $RELEASEDIR/boot
/minix_latest
/* $CDFILES/
325 writeisofs
-s0x0 -l MINIX
-B $bootimage $boottype $CDFILES $IMG ||
exit 1
327 echo "Appending Minix root and usr filesystem"
328 # Pad ISO out to cylinder boundary
329 isobytes
=`stat -f %z $IMG`
330 isosects
=`expr $isobytes / 512`
331 isopad
=`expr $secs - '(' $isosects % $secs ')'`
332 dd if=/dev
/zero count
=$isopad >>$IMG
334 isosects
=`expr $isosects + $isopad`
335 ( cat $IMG $ROOTIMAGE ;
336 dd if=$TMPDISKUSR bs
=$BS count
=$USRBLOCKS ) >m
338 # Make CD partition table
339 installboot_nbsd
-m $IMG /usr
/mdec
/mbr
340 # Make sure there is no hole..! Otherwise the ISO format is
342 partition
-m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
344 # Clean up: RELEASEDIR no longer needed
347 if [ "$FILENAMEOUT" ]
348 then echo "$IMG" >$FILENAMEOUT
351 ##########################################################################
352 echo " * Freeing up memory used by ramdisks"
353 ##########################################################################
354 ramdisk
1 $TMPDISKROOT
355 ramdisk
1 $TMPDISKUSR