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
="
40 PKG_ADD_URL
=$PACKAGEURL
42 RELEASERC
=$HOME/.releaserc
50 export RELEASEDIR
=/usr
/r-staging
53 IMAGE
=/usr
/mdec
/bootxx_cd9660
55 CDFILES
=/usr
/tmp
/cdreleasefiles
56 IMG_BASE
=minix
${version}_ide
69 if git
--version >/dev
/null
70 then if [ -d ..
/.git
]
71 then LOCAL_REVTAG
="`git describe --always`"
78 while getopts "b:j:lpmMch?f:L:e:" c
82 echo "Usage: $0 [-l] [-p] [-c] [-m] [-M] [-f <filename>] -j<jaildir> [-L <packageurl>] [-e <extras-path>]" >&2
89 echo " * Copying, not using GIT"
100 FILENAMEOUT
="$OPTARG"
107 l
) PKG_ADD_URL
=file://$PACKAGEDIR/All
109 L
) PKG_ADD_URL
="$OPTARG"
113 EXTRAS_PATH
="$OPTARG"
118 RELEASEPACKAGE
=${RELEASEDIR}/usr
/install
/packages
120 if [ $GITMODE -ne 1 -a $COPY -ne 1 ]
121 then echo "Need git to retrieve latest minix! Copying src instead!"
129 if [ $PACKAGES -ne 0 ]
130 then mkdir
-p $PACKAGEDIR/All || true
131 retrieve
$PACKAGEDIR/All
$PACKAGELIST packages
/`uname -p`/$VERSION_PRETTY
135 TMPDISKROOT
=/dev
/ram1
137 if [ ! -b $TMPDISKUSR -o ! $TMPDISKROOT ]
138 then echo "$TMPDISKUSR or $TMPDISKROOT is not a block device.."
142 if [ $TMPDISKUSR = $TMPDISKROOT ]
144 echo "Temporary devices can't be equal."
149 then echo " * Cleanup old files"
150 umount
$TMPDISKUSR || true
151 umount
$TMPDISKROOT || true
152 umount
$RELEASEMNTDIR/usr || true
153 umount
$RELEASEMNTDIR || true
156 rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image
* || true
157 mkdir
-p $CDFILES ||
exit
158 mkdir
-p $RELEASEDIR $RELEASEMNTDIR
159 mkdir
-p $RELEASEPACKAGE
161 ##########################################################################
162 echo " * Bootstrapping filesystem in $RELEASEDIR"
163 ##########################################################################
164 CONFIGHEADER
=$RELEASEDIR/usr
/src
/include
/minix
/sys_config.h
170 echo "Retrieving latest minix repo from $REPO branch $GITBRANCH."
171 srcdir
=$RELEASEDIR/usr
/src
172 git clone
-b $GITBRANCH $REPO $srcdir
174 then echo "Doing checkout of $REVTAG."
175 (cd $srcdir && git checkout
$REVTAG )
176 else REVTAG
=`(cd $srcdir && git rev-parse --short HEAD)`
177 echo "Retrieved repository head in $srcdir is $REVTAG."
179 if [ $MINIMAL -ne 0 ]
180 then rm -r $srcdir/.git
183 /* Added by release script */
184 #ifndef _VCS_REVISION
185 #define _VCS_REVISION \"$REVTAG\"
186 #endif" >>$CONFIGHEADER
189 IMG
=${IMG_BASE}_${DATE}_${REVTAG}.iso
191 echo "First cleaning current sourcedir.."
192 ( cd ..
&& make cleandir
>/dev
/null
)
193 echo "Copying contents from current src dir."
195 ( cd $srcdir && tar --exclude .git
-cf - .
) |
( cd $RELEASEDIR/usr
&& mkdir
$SRC && cd $SRC && tar xf
- )
198 IMG
=${IMG_BASE}_copy.iso
201 # Make sure the CD knows it's a CD, unless it's not
204 rm -f $RELEASEDIR/usr
/$SRC/releasetools
/revision
206 for p
in $PREINSTALLED_PACKAGES
207 do echo " * Pre-installing: $p from $PKG_ADD_URL"
208 $PKG_ADD -f -P $RELEASEDIR $PKG_ADD_URL/$p
211 if [ "$CUSTOM_PACKAGES" ]
212 then echo $PKG_ADD_URL >$RELEASEDIR/usr
/pkg
/etc
/pkgin
/repositories.conf
215 echo " * Resetting timestamps"
216 find $RELEASEDIR |
xargs touch
218 ##########################################################################
220 ##########################################################################
222 cd $RELEASEDIR/usr
/src
223 make distribution DESTDIR
=$RELEASEDIR SLOPPY_FLIST
=yes $BUILDOPTIONS
224 make -C releasetools do-hdboot DESTDIR
=$RELEASEDIR MKINSTALLBOOT
=yes
225 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$RELEASEDIR
226 cp $RELEASEDIR/boot
/minix_latest
/* $RELEASEDIR/boot
/minix_default
/
228 if [ $MAKEMAP -ne 0 ]; then
229 find .
-type f
-perm 755 |
xargs nm
-n 2> /dev
/null
> symbols.txt
237 ##########################################################################
238 echo " * Removing bootstrap files"
239 ##########################################################################
240 # The build process leaves some file in $SRC as bin.
241 chown
-R root
$RELEASEDIR/usr
/src
*
242 cp issue.
install $RELEASEDIR/etc
/issue
244 echo $version_pretty, GIT revision
$REVTAG, generated
`date` >$RELEASEDIR/etc
/version
245 rm -rf $RELEASEDIR/tmp
/*
247 if [ $MINIMAL -ne 0 ]
249 if [ "$MAKEMAP" -ne 0 ]
251 echo " * Copying symbol map to ${IMG}-symbols.txt"
252 cp $RELEASEDIR/usr
/src
/symbols.txt
${IMG}-symbols.txt
253 $ZIP -f ${IMG}-symbols.txt
256 echo " * Removing files to create minimal image"
257 rm -rf $RELEASEDIR/usr
/man
/man
*/* \
258 $RELEASEDIR/usr
/share
/zoneinfo
* $RELEASEDIR/usr
/src
259 mkdir
-p $RELEASEDIR/usr
/src
/releasetools
262 if [ $EXTRAS_INSTALL -ne 0 ] ; then
263 echo " * Copying files from $EXTRAS_PATH"
264 cp -Rv $EXTRAS_PATH/* $RELEASEDIR
267 # If we are making a jail, all is done!
269 then echo "Created new minix install in $RELEASEDIR."
270 echo "Enter it by typing: "
271 echo "# chroot $RELEASEDIR /bin/sh"
275 ##########################################################################
276 echo " * Counting files"
277 ##########################################################################
278 extrakb
=`du -ks $RELEASEDIR/usr/install | awk '{ print $1 }'`
279 find $RELEASEDIR/usr | fgrep
-v /install
/ |
wc -l >$RELEASEDIR/.usrfiles
280 find $RELEASEDIR -print -path $RELEASEDIR/usr
-prune |
wc -l >$RELEASEDIR/.rootfiles
282 ##########################################################################
283 echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
284 ##########################################################################
285 fitfs
$RELEASEDIR $TMPDISKROOT 64 256 "$ROOTMB"
287 ROOTSECTS
="`expr $blocks \* \( $BS / 512 \)`"
288 mount
$TMPDISKROOT $RELEASEMNTDIR ||
exit
290 echo " * Mounting $TMPDISKUSR as $RELEASEMNTDIR/usr"
291 fitfs
$RELEASEDIR/usr
$TMPDISKUSR 0 0 "$USRMB"
293 USRSECTS
="`expr $blocks \* \( $BS / 512 \)`"
294 mkdir
-m 755 $RELEASEMNTDIR/usr
295 mount
$TMPDISKUSR $RELEASEMNTDIR/usr ||
exit
297 ##########################################################################
298 echo " * Copying files from staging to image"
299 ##########################################################################
300 synctree
-f $RELEASEDIR $RELEASEMNTDIR > /dev
/null || true
301 expr `df -kP $TMPDISKUSR | tail -1 | awk '{ print $3 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
303 echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
304 umount
$TMPDISKUSR ||
exit
306 echo " * Making image bootable"
309 echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
310 umount
$TMPDISKROOT ||
exit
313 ##########################################################################
314 echo " * Generating image files"
315 ##########################################################################
316 dd if=$TMPDISKROOT of
=$ROOTIMAGE bs
=$BS count
=$ROOTBLOCKS
317 cp release
/cd
/* $CDFILES || true
318 echo "This is Minix version $version_pretty prepared `date`." >$CDFILES/VERSION.TXT
323 cp $RELEASEDIR/usr
/mdec
/boot_monitor
$CDFILES/boot
324 cp -rf $RELEASEDIR/boot
/minix_latest
/* $CDFILES/
326 writeisofs
-s0x0 -l MINIX
-B $bootimage $boottype $CDFILES $IMG ||
exit 1
328 echo "Appending Minix root and usr filesystem"
329 # Pad ISO out to cylinder boundary
330 isobytes
=`stat -f %z $IMG`
331 isosects
=`expr $isobytes / 512`
332 isopad
=`expr $secs - '(' $isosects % $secs ')'`
333 dd if=/dev
/zero count
=$isopad >>$IMG
335 isosects
=`expr $isosects + $isopad`
336 ( cat $IMG $ROOTIMAGE ;
337 dd if=$TMPDISKUSR bs
=$BS count
=$USRBLOCKS ) >m
339 # Make CD partition table
340 installboot_nbsd
-m $IMG /usr
/mdec
/mbr
341 # Make sure there is no hole..! Otherwise the ISO format is
343 partition
-m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
345 # Clean up: RELEASEDIR no longer needed
348 echo "${ZIP}ping $IMG"
351 if [ "$FILENAMEOUT" ]
352 then echo "$IMG" >$FILENAMEOUT
355 ##########################################################################
356 echo " * Freeing up memory used by ramdisks"
357 ##########################################################################
358 ramdisk
1 $TMPDISKROOT
359 ramdisk
1 $TMPDISKUSR