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 # List of packages included on installation media
17 PACKAGELIST
=packages.
install
21 PKG_ADD
=/usr
/pkg
/sbin
/pkg_add
22 PKG_INFO
=/usr
/pkg
/sbin
/pkg_info
25 then echo Please
install pkg_install from pkgsrc.
29 # Packages we have to pre-install, and url to use
30 PACKAGEURL
=ftp://ftp.minix3.org
/pub
/minix
/packages
/$version_pretty/`uname -m`/All
/
31 PREINSTALLED_PACKAGES
="
36 PKG_ADD_URL
=$PACKAGEURL
38 RELEASERC
=$HOME/.releaserc
46 export RELEASEDIR
=/usr
/r-staging
49 IMAGE
=/usr
/mdec
/bootxx_cd9660
51 CDFILES
=/usr
/tmp
/cdreleasefiles
52 IMG_BASE
=minix
${version}_ide
65 if git
--version >/dev
/null
66 then if [ -d ..
/.git
]
67 then LOCAL_REVTAG
="`git describe --always`"
74 while getopts "b:j:lpmMch?f:L:e:" c
78 echo "Usage: $0 [-l] [-p] [-c] [-m] [-M] [-f <filename>] -j<jaildir> [-L <packageurl>] [-e <extras-path>]" >&2
85 echo " * Copying, not using GIT"
103 l
) PKG_ADD_URL
=file://$PACKAGEDIR/All
105 L
) PKG_ADD_URL
="$OPTARG"
109 EXTRAS_PATH
="$OPTARG"
114 RELEASEPACKAGE
=${RELEASEDIR}/usr
/install
/packages
116 if [ $GITMODE -ne 1 -a $COPY -ne 1 ]
117 then echo "Need git to retrieve latest minix! Copying src instead!"
125 if [ $PACKAGES -ne 0 ]
126 then mkdir
-p $PACKAGEDIR/All || true
127 retrieve
$PACKAGEDIR/All
$PACKAGELIST packages
/`uname -p`/$VERSION_PRETTY
131 TMPDISKROOT
=/dev
/ram1
133 if [ ! -b $TMPDISKUSR -o ! $TMPDISKROOT ]
134 then echo "$TMPDISKUSR or $TMPDISKROOT is not a block device.."
138 if [ $TMPDISKUSR = $TMPDISKROOT ]
140 echo "Temporary devices can't be equal."
145 then echo " * Cleanup old files"
146 umount
$TMPDISKUSR || true
147 umount
$TMPDISKROOT || true
148 umount
$RELEASEMNTDIR/usr || true
149 umount
$RELEASEMNTDIR || true
152 rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image
* || true
153 mkdir
-p $CDFILES ||
exit
154 mkdir
-p $RELEASEDIR $RELEASEMNTDIR
155 mkdir
-p $RELEASEPACKAGE
157 ##########################################################################
158 echo " * Bootstrapping filesystem in $RELEASEDIR"
159 ##########################################################################
160 CONFIGHEADER
=$RELEASEDIR/usr
/src
/include
/minix
/sys_config.h
166 echo "Retrieving latest minix repo from $REPO branch $GITBRANCH."
167 srcdir
=$RELEASEDIR/usr
/src
168 git clone
-b $GITBRANCH $REPO $srcdir
169 echo "Triggering fetch scripts"
170 ( cd $srcdir && sh .
/gnu
/dist
/fetch.sh
)
171 ( cd $srcdir && sh .
/external
/gpl
3/binutils
/fetch.sh
)
173 then echo "Doing checkout of $REVTAG."
174 (cd $srcdir && git checkout
$REVTAG )
175 else REVTAG
=`(cd $srcdir && git rev-parse --short HEAD)`
176 echo "Retrieved repository head in $srcdir is $REVTAG."
178 if [ $MINIMAL -ne 0 ]
179 then rm -r $srcdir/.git
182 /* Added by release script */
183 #ifndef _VCS_REVISION
184 #define _VCS_REVISION \"$REVTAG\"
185 #endif" >>$CONFIGHEADER
188 IMG
=${IMG_BASE}_${DATE}_${REVTAG}.iso
190 echo "First cleaning current sourcedir.."
191 ( cd ..
&& make cleandir
>/dev
/null
)
192 echo "Copying contents from current src dir."
194 ( cd $srcdir && tar --exclude .git
-cf - .
) |
( cd $RELEASEDIR/usr
&& mkdir
$SRC && cd $SRC && tar xf
- )
197 IMG
=${IMG_BASE}_copy.iso
200 # Make sure the CD knows it's a CD, unless it's not
203 rm -f $RELEASEDIR/usr
/$SRC/releasetools
/revision
205 for p
in $PREINSTALLED_PACKAGES
206 do echo " * Pre-installing: $p from $PKG_ADD_URL"
207 $PKG_ADD -f -P $RELEASEDIR $PKG_ADD_URL/$p
210 if [ "$CUSTOM_PACKAGES" ]
211 then echo $PKG_ADD_URL >$RELEASEDIR/usr
/pkg
/etc
/pkgin
/repositories.conf
214 echo " * Resetting timestamps"
215 find $RELEASEDIR |
xargs touch
217 ##########################################################################
219 ##########################################################################
221 cd $RELEASEDIR/usr
/src
222 make build MKLIBCXX
=yes DESTDIR
=$RELEASEDIR SLOPPY_FLIST
=yes $BUILDOPTIONS
223 make -C releasetools do-hdboot DESTDIR
=$RELEASEDIR MKINSTALLBOOT
=yes
224 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$RELEASEDIR
225 cp $RELEASEDIR/boot
/minix_latest
/* $RELEASEDIR/boot
/minix_default
/
227 if [ $MAKEMAP -ne 0 ]; then
228 find .
-type f
-perm 755 |
xargs nm
-n 2> /dev
/null
> symbols.txt
236 ##########################################################################
237 echo " * Removing bootstrap files"
238 ##########################################################################
239 # The build process leaves some file in $SRC as bin.
240 chown
-R root
$RELEASEDIR/usr
/src
*
241 cp issue.
install $RELEASEDIR/etc
/issue
243 echo $version_pretty, GIT revision
$REVTAG, generated
`date` >$RELEASEDIR/etc
/version
244 rm -rf $RELEASEDIR/tmp
/*
246 if [ $MINIMAL -ne 0 ]
248 if [ "$MAKEMAP" -ne 0 ]
250 echo " * Copying symbol map to ${IMG}-symbols.txt"
251 cp $RELEASEDIR/usr
/src
/symbols.txt
${IMG}-symbols.txt
252 $ZIP -f ${IMG}-symbols.txt
255 echo " * Removing files to create minimal image"
256 rm -rf $RELEASEDIR/usr
/man
/man
*/* \
257 $RELEASEDIR/usr
/share
/zoneinfo
* $RELEASEDIR/usr
/src
258 mkdir
-p $RELEASEDIR/usr
/src
/releasetools
261 if [ $EXTRAS_INSTALL -ne 0 ] ; then
262 echo " * Copying files from $EXTRAS_PATH"
263 cp -Rv $EXTRAS_PATH/* $RELEASEDIR
266 echo " * Removing sources"
268 rm -rf $RELEASEDIR/usr
/src
# No space for /usr/src
270 # If we are making a jail, all is done!
272 then echo "Created new minix install in $RELEASEDIR."
273 echo "Enter it by typing: "
274 echo "# chroot $RELEASEDIR /bin/sh"
278 ##########################################################################
279 echo " * Counting files"
280 ##########################################################################
281 extrakb
=`du -ks $RELEASEDIR/usr/install | awk '{ print $1 }'`
282 find $RELEASEDIR/usr | fgrep
-v /install
/ |
wc -l >$RELEASEDIR/.usrfiles
283 find $RELEASEDIR -print -path $RELEASEDIR/usr
-prune |
wc -l >$RELEASEDIR/.rootfiles
285 ##########################################################################
286 echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
287 ##########################################################################
288 fitfs
$RELEASEDIR $TMPDISKROOT 64 256 "$ROOTMB"
290 ROOTSECTS
="`expr $blocks \* \( $BS / 512 \)`"
291 mount
$TMPDISKROOT $RELEASEMNTDIR ||
exit
293 echo " * Mounting $TMPDISKUSR as $RELEASEMNTDIR/usr"
294 fitfs
$RELEASEDIR/usr
$TMPDISKUSR 0 0 "$USRMB"
296 USRSECTS
="`expr $blocks \* \( $BS / 512 \)`"
297 mkdir
-m 755 $RELEASEMNTDIR/usr
298 mount
$TMPDISKUSR $RELEASEMNTDIR/usr ||
exit
300 ##########################################################################
301 echo " * Copying files from staging to image"
302 ##########################################################################
303 synctree
-f $RELEASEDIR $RELEASEMNTDIR > /dev
/null || true
304 expr `df -kP $TMPDISKUSR | tail -1 | awk '{ print $3 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
306 echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
307 umount
$TMPDISKUSR ||
exit
309 echo " * Making image bootable"
312 echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
313 umount
$TMPDISKROOT ||
exit
316 ##########################################################################
317 echo " * Generating image files"
318 ##########################################################################
319 dd if=$TMPDISKROOT of
=$ROOTIMAGE bs
=$BS count
=$ROOTBLOCKS
320 cp release
/cd
/* $CDFILES || true
321 echo "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
326 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$CDFILES/boot
327 cp -rf $RELEASEDIR/boot
/minix_latest
/* $CDFILES/
329 writeisofs
-s0x0 -l MINIX
-B $bootimage $boottype $CDFILES $IMG ||
exit 1
331 echo "Appending Minix root and usr filesystem"
332 # Pad ISO out to cylinder boundary
333 isobytes
=`stat -f %z $IMG`
334 isosects
=`expr $isobytes / 512`
335 isopad
=`expr $secs - '(' $isosects % $secs ')'`
336 dd if=/dev
/zero count
=$isopad >>$IMG
338 isosects
=`expr $isosects + $isopad`
339 ( cat $IMG $ROOTIMAGE ;
340 dd if=$TMPDISKUSR bs
=$BS count
=$USRBLOCKS ) >m
342 # Make CD partition table
343 installboot_nbsd
-m $IMG /usr
/mdec
/mbr
344 # Make sure there is no hole..! Otherwise the ISO format is
346 partition
-m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
348 # Clean up: RELEASEDIR no longer needed
351 echo "${ZIP}ping $IMG"
354 if [ "$FILENAMEOUT" ]
355 then echo "$IMG" >$FILENAMEOUT
358 ##########################################################################
359 echo " * Freeing up memory used by ramdisks"
360 ##########################################################################
361 ramdisk
1 $TMPDISKROOT
362 ramdisk
1 $TMPDISKUSR