2005-04-21 16:53:53 +02:00
#!/bin/sh
2006-04-04 11:43:26 +02:00
set -e
2007-02-08 17:18:48 +01:00
XBIN = usr/xbin
2007-02-19 17:40:33 +01:00
SRC = src
2007-02-08 17:18:48 +01:00
2010-09-20 13:07:53 +02:00
PACKAGEDIR = /usr/pkgsrc/packages/` uname -r` /` uname -m`
2009-05-30 11:31:19 +02:00
# List of packages included on installation media
PACKAGELIST = packages.install
2005-09-08 18:04:34 +02:00
secs = ` expr 32 '*' 64`
2006-03-26 20:08:08 +02:00
export SHELL = /bin/sh
2005-09-08 18:04:34 +02:00
2010-08-05 15:56:51 +02:00
# Packages we have to pre-install, and url to use
2011-02-09 17:48:10 +01:00
PREINSTALLED_PACKAGES = "pkgin-0.3.3.4.tgz pkg_install-20101212 bmake-20100808"
2010-08-05 15:56:51 +02:00
PACKAGEURL = ftp://ftp.minix3.org/pub/minix/packages/` uname -r` /` uname -m` /All/
2010-04-27 00:07:21 +02:00
RELEASERC = $HOME /.releaserc
if [ -f $RELEASERC ]
then . $RELEASERC
fi
set -- $* $RELOPTS
2009-09-30 15:11:22 +02:00
# SVN trunk repo
TRUNK = https://gforge.cs.vu.nl/svn/minix/trunk
2005-08-16 14:09:20 +02:00
make_hdimage( )
{
2010-06-04 07:09:44 +02:00
dd if = $TMPDISKUSR of = usrimage bs = $BS count = $USRBLOCKS
2005-08-16 14:09:20 +02:00
rootsize = ` stat -size rootimage`
usrsize = ` stat -size usrimage`
rootsects = ` expr $rootsize / 512`
usrsects = ` expr $usrsize / 512`
# installboot -m needs at least 1KB
dd < /dev/zero >tmpimage count = 2
partition -fm tmpimage 2 81:$rootsects * 0:0 81:$usrsects
installboot -m tmpimage /usr/mdec/masterboot
dd < tmpimage > subpart count = 1
primsects = ` expr 1 + $rootsects + $usrsects `
2005-09-08 18:04:34 +02:00
cyl = ` expr '(' $primsects ')' / $secs + 1`
padsects = ` expr $cyl \* $secs - 1 - $primsects `
2005-08-16 14:09:20 +02:00
{ dd < /dev/zero count = 1
cat subpart
cat rootimage
cat usrimage
dd < /dev/zero count = $padsects
} > hdimage
partition -m hdimage 81:` expr $primsects + $padsects ` *
installboot -m hdimage /usr/mdec/masterboot
}
2009-09-30 15:11:22 +02:00
retrieve( )
{
dir = $1
list = ` pwd ` /$2
2010-09-10 19:00:30 +02:00
url = ${ PACKAGEURL }
2009-09-30 15:11:22 +02:00
(
cd $dir || exit 1
echo " * Updating $dir
from $url
with $list "
2010-09-10 19:00:30 +02:00
files = ` awk <$list '{ print "' $url '/" $1 ".tgz" }' `
fetch -r $files || true
2009-09-30 15:11:22 +02:00
)
}
2010-08-29 21:22:42 +02:00
cd_root_changes( )
{
edparams $TMPDISKROOT ' unset bootopts;
unset servers;
unset rootdev;
unset leader;
unset image;
disable = inet;
bootcd = 1;
cdproberoot = 1;
ata_id_timeout = 2;
bootbig( 1, Regular MINIX 3) { unset image; boot }
leader( ) { echo \n --- Welcome to MINIX 3. This is the boot monitor. ---\n \n Choose an option from the menu or press ESC if you need to do anything special.\n Otherwise I will boot with my defaults in 10 seconds.\n \n } ; main( ) { trap 10000 boot; menu; } ;
save'
}
2005-08-16 14:09:20 +02:00
hdemu_root_changes( )
{
2010-06-04 07:09:44 +02:00
$RELEASEDIR /usr/bin/installboot -d $TMPDISKROOT \
2005-08-16 14:09:20 +02:00
$RELEASEDIR /usr/mdec/bootblock boot/boot
echo \
2006-03-10 15:11:19 +01:00
' bootcd = 2
2005-08-16 14:09:20 +02:00
disable = inet
2006-04-03 16:31:59 +02:00
bios_wini = yes
2005-08-16 14:09:20 +02:00
bios_remap_first = 1
ramimagedev = c0d7p0s0
2006-06-20 12:13:56 +02:00
bootbig( 1, Regular MINIX 3) { image = /boot/image_big; boot }
2006-03-10 15:11:19 +01:00
main( ) { trap 10000 boot ; menu; }
2010-06-04 07:09:44 +02:00
save' | $RELEASEDIR /usr/bin/edparams $TMPDISKROOT
2005-08-16 14:09:20 +02:00
}
2006-03-13 16:40:23 +01:00
usb_root_changes( )
{
2010-06-04 07:09:44 +02:00
$RELEASEDIR /usr/bin/installboot -d $TMPDISKROOT \
2006-03-13 16:40:23 +01:00
$RELEASEDIR /usr/mdec/bootblock boot/boot
echo \
' bios_wini = yes
bios_remap_first = 1
rootdev = c0d7p0s0
2010-08-29 21:22:42 +02:00
bootbig( 1, Regular MINIX 3) { image = /boot/image_big; boot }
leader( ) { echo \n --- Welcome to MINIX 3. This is the boot monitor. ---\n \n Choose an option from the menu or press ESC if you need to do anything special.\n Otherwise I will boot with my defaults in 10 seconds.\n \n } ; main( ) { trap 10000 boot; menu; } ;
2010-06-04 07:09:44 +02:00
save' | $RELEASEDIR /usr/bin/edparams $TMPDISKROOT
2006-03-13 16:40:23 +01:00
}
2005-08-16 14:09:20 +02:00
2010-06-04 07:09:44 +02:00
fitfs( )
{
path = " $1 "
ramdisk = " $2 "
extra_inodes = " $3 "
extra_zones = " $4 "
mbsdefault = " $5 "
# Determine number of inodes
inodes = ` find $path | egrep -v ^$path /usr | wc -l`
inodes = " `expr $inodes + $extra_inodes ` "
2010-06-10 13:14:04 +02:00
# Determine number of data zones
zonekbs = ` du -Fs $path | cut -d' ' -f1`
zonekbsignore = 0
[ ! -d $path /usr ] || zonekbsignore = ` du -Fs $path /usr | cut -d" " -f1`
zones = " `expr \( $zonekbs - $zonekbsignore \) / \( $BS / 1024 \) + $extra_zones ` "
2010-06-04 07:09:44 +02:00
# Determine file system size
BSBITS = " `expr $BS \* 8` "
imap_blocks = " `expr \( $inodes + $BSBITS - 1 \) / $BSBITS ` "
inode_blocks = " `expr \( $inodes \* 64 + $BS - 1 \) / $BS ` "
zmap_blocks = " `expr \( $zones + $BSBITS - 1 \) / $BSBITS ` "
blocks = " `expr 1 + 1 + $imap_blocks + $zmap_blocks + $inode_blocks + $zones ` "
kbs = " `expr $blocks \* \( $BS / 1024 \)` "
# Apply default if higher
if [ -n " $mbsdefault " ]
then
kbsdefault = " `expr $mbsdefault \* 1024` "
if [ " $kbs " -lt " $kbsdefault " ]
then kbs = $kbsdefault
else echo " warning: ${ mbsdefault } mb is too small, using ${ kbs } kb "
fi
fi
# Create a filesystem on the target ramdisk
ramdisk $kbs $ramdisk
2010-08-05 14:35:00 +02:00
mkfs.mfs -B $BS -i $inodes $ramdisk
2010-06-04 07:09:44 +02:00
}
RELEASEDIR = /usr/r-staging
RELEASEMNTDIR = /usr/r
2006-03-15 16:34:12 +01:00
RELEASEPACKAGE = ${ RELEASEDIR } /usr/install/packages
2010-06-04 07:09:44 +02:00
2010-04-27 00:07:21 +02:00
IMAGE = ../boot/cdbootblock
2005-05-03 10:54:36 +02:00
ROOTIMAGE = rootimage
2005-07-24 03:18:09 +02:00
CDFILES = /usr/tmp/cdreleasefiles
2005-09-11 18:36:17 +02:00
sh tell_config OS_RELEASE . OS_VERSION >/tmp/rel.$$
2005-09-12 17:44:05 +02:00
version_pretty = ` sed 's/[" ]//g;/^$/d' </tmp/rel.$$ `
2005-09-11 18:36:17 +02:00
version = ` sed 's/[" ]//g;/^$/d' </tmp/rel.$$ | tr . _`
2007-02-19 17:40:33 +01:00
IMG_BASE = minix${ version } _ide
2005-08-10 17:14:02 +02:00
BS = 4096
2005-08-16 14:09:20 +02:00
HDEMU = 0
2005-08-24 18:49:09 +02:00
COPY = 0
2006-12-22 17:43:30 +01:00
SVNREV = ""
2007-02-19 17:40:33 +01:00
REVTAG = ""
2006-04-10 16:18:54 +02:00
PACKAGES = 1
2010-05-10 20:02:15 +02:00
MINIMAL = 0
2010-05-17 18:52:48 +02:00
MAKEMAP = 0
2005-08-16 14:09:20 +02:00
2010-11-11 03:00:12 +01:00
# Do we have git?
if git --version >/dev/null
then if [ -d ../.git ]
then REVTAG = "`git describe --always`"
echo " git mode; building $REVTAG "
GITMODE = 1
fi
fi
2007-04-18 13:42:48 +02:00
FILENAMEOUT = ""
2010-05-17 18:52:48 +02:00
while getopts "s:pmMchu?r:f:" c
2005-08-16 14:09:20 +02:00
do
case " $c " in
\? )
2010-05-17 18:52:48 +02:00
echo " Usage: $0 [-p] [-c] [-h] [-m] [-M] [-r <tag>] [-u] [-f <filename>] [-s <username>] " >& 2
2005-08-16 14:09:20 +02:00
exit 1
; ;
h)
2005-09-01 17:26:12 +02:00
echo " * Making HD image"
2007-02-19 17:40:33 +01:00
IMG_BASE = minix${ version } _bios
2005-08-16 14:09:20 +02:00
HDEMU = 1
2005-08-24 18:49:09 +02:00
; ;
c)
2006-12-22 17:43:30 +01:00
echo " * Copying, not SVN"
2005-08-24 18:49:09 +02:00
COPY = 1
; ;
2006-04-10 16:18:54 +02:00
p)
PACKAGES = 0
; ;
2005-09-29 15:02:41 +02:00
r)
2006-12-22 17:43:30 +01:00
SVNREV = -r$OPTARG
2005-09-29 15:02:41 +02:00
; ;
2006-03-13 16:40:23 +01:00
u)
echo " * Making live USB-stick image"
2007-02-19 17:40:33 +01:00
IMG_BASE = minix${ version } _usb
2006-03-13 16:40:23 +01:00
HDEMU = 1
USB = 1
; ;
2007-04-18 13:42:48 +02:00
f)
FILENAMEOUT = " $OPTARG "
; ;
s) USERNAME = " --username= $OPTARG "
; ;
2010-05-10 20:02:15 +02:00
m) MINIMAL = 1
PACKAGES = 0
; ;
2010-05-17 18:52:48 +02:00
M) MAKEMAP = 1
; ;
2005-08-16 14:09:20 +02:00
esac
done
2010-05-10 20:02:15 +02:00
if [ ! " $ZIP " ]
2010-06-17 14:00:55 +02:00
then ZIP = bzip2
2010-05-10 20:02:15 +02:00
fi
2009-09-30 15:11:22 +02:00
if [ $PACKAGES -ne 0 ]
2010-09-10 19:00:30 +02:00
then mkdir -p $PACKAGEDIR /All || true
retrieve $PACKAGEDIR /All $PACKAGELIST packages/` uname -p` /` uname -r`
2009-03-19 15:14:57 +01:00
fi
2005-08-24 18:49:09 +02:00
if [ " $COPY " -ne 1 ]
then
2006-12-22 17:43:30 +01:00
echo "Note: this script wants to do svn operations."
2005-08-24 18:49:09 +02:00
fi
2010-06-04 07:09:44 +02:00
TMPDISKUSR = /dev/ram0
TMPDISKROOT = /dev/ram1
2006-02-15 12:05:47 +01:00
2010-06-04 07:09:44 +02:00
if [ ! -b $TMPDISKUSR -o ! $TMPDISKROOT ]
then echo " $TMPDISKUSR or $TMPDISKROOT is not a block device.. "
2006-02-15 12:05:47 +01:00
exit 1
fi
2010-06-04 07:09:44 +02:00
if [ $TMPDISKUSR = $TMPDISKROOT ]
2006-01-17 16:14:56 +01:00
then
echo "Temporary devices can't be equal."
exit
fi
2005-07-24 03:18:09 +02:00
echo " * Cleanup old files"
2010-06-04 07:09:44 +02:00
umount $TMPDISKUSR || true
umount $TMPDISKROOT || true
umount $RELEASEMNTDIR /usr || true
umount $RELEASEMNTDIR || true
2010-05-10 20:02:15 +02:00
rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image*
2005-07-24 03:18:09 +02:00
mkdir -p $CDFILES || exit
2010-06-04 07:09:44 +02:00
mkdir -p $RELEASEDIR $RELEASEMNTDIR
2005-05-04 15:47:05 +02:00
mkdir -m 755 $RELEASEDIR /usr
mkdir -m 1777 $RELEASEDIR /tmp
2005-04-21 16:53:53 +02:00
mkdir -p $RELEASEDIR /tmp
mkdir -p $RELEASEDIR /usr/tmp
2007-02-08 17:18:48 +01:00
mkdir -p $RELEASEDIR /$XBIN
2007-02-08 18:41:40 +01:00
mkdir -p $RELEASEDIR /usr/bin
2007-02-08 17:18:48 +01:00
mkdir -p $RELEASEDIR /bin
2006-03-15 16:34:12 +01:00
mkdir -p $RELEASEPACKAGE
2005-08-24 18:49:09 +02:00
2007-02-08 17:18:48 +01:00
echo " * Transfering bootstrap dirs to $RELEASEDIR "
2010-08-05 14:35:00 +02:00
cp -p /bin/* /usr/bin/* /sbin/* $RELEASEDIR /$XBIN
2007-02-08 17:18:48 +01:00
cp -rp /usr/lib $RELEASEDIR /usr
2010-05-12 18:28:54 +02:00
cp -rp /bin/sh /bin/echo $RELEASEDIR /bin
cp -rp /usr/bin/make /usr/bin/install /usr/bin/yacc /usr/bin/lex /usr/bin/asmconv $RELEASEDIR /usr/bin
2005-09-24 13:28:22 +02:00
2011-02-09 17:48:10 +01:00
CONFIGHEADER = $RELEASEDIR /usr/src/common/include/minix/sys_config.h
2010-11-11 03:00:12 +01:00
2010-09-10 19:00:30 +02:00
if [ -d $PACKAGEDIR -a -f $PACKAGELIST -a $PACKAGES -ne 0 ]
then
index = pkg_summary
indexpath = $PACKAGEDIR /.index
if [ ! -d $indexpath ]
then mkdir $indexpath
fi
if [ ! -d $indexpath ]
then echo " Couldn't create $indexpath . "
exit 1
fi
echo "" >$PACKAGEDIR /All/$index
echo " * Transfering $PACKAGEDIR to $RELEASEPACKAGE "
2009-05-30 11:31:19 +02:00
for p in ` cat $PACKAGELIST `
2010-09-10 19:00:30 +02:00
do if [ -f $PACKAGEDIR /All/$p .tgz ]
2009-05-30 11:31:19 +02:00
then
2010-09-10 19:00:30 +02:00
# Copy package and create package's index
(
cd $PACKAGEDIR /All
cp $p .tgz $RELEASEPACKAGE /
f = $p .tgz
indexname = $indexpath /$f .$index
pkg_info -X $f >$indexname
if [ ! -f $indexname ]
then echo Missing $indexname .
exit 1
fi
if [ " `wc -l $indexname ` " -lt 3 ]
then $indexname is too short.
rm $indexname
exit 1
fi
cat $indexname >>$PACKAGEDIR /All/$index
)
2009-05-30 11:31:19 +02:00
else
2010-09-10 19:00:30 +02:00
echo " Can't copy $PACKAGEDIR / $p .tgz. Missing. "
2009-05-30 11:31:19 +02:00
fi
done
2010-09-10 19:00:30 +02:00
bzip2 -f $PACKAGEDIR /All/$index
cp $PACKAGEDIR /All/$index .bz2 $RELEASEPACKAGE /
2006-03-15 16:34:12 +01:00
fi
2010-05-12 18:28:54 +02:00
# Make sure compilers and libraries are root-owned
chown -R root $RELEASEDIR /usr/lib
2005-09-24 13:28:22 +02:00
chmod -R u+w $RELEASEDIR /usr/lib
2010-11-11 03:00:12 +01:00
if [ " $COPY " -ne 1 -a " $GITMODE " -ne 1 ]
2005-08-24 18:49:09 +02:00
then
2006-12-22 17:43:30 +01:00
echo " * Doing new svn export"
2009-10-19 17:46:27 +02:00
TOOLSREPO = " `svn info | grep '^URL: ' | awk '{ print $2 }'` "
REPO = " `echo $TOOLSREPO | sed 's/.tools $//'` "
BRANCHNAME = " `echo $REPO | awk -F/ '{ print $NF }'` "
2007-04-18 13:42:48 +02:00
REVISION = " `svn info $USERNAME $SVNREV $REPO | grep '^Revision: ' | awk '{ print $2 }'` "
2007-02-19 17:40:33 +01:00
echo " Doing export of revision $REVISION from $REPO . "
2009-10-19 17:46:27 +02:00
( cd $RELEASEDIR /usr && svn -q $USERNAME export -r$REVISION $REPO $SRC )
if [ $BRANCHNAME = src ]
then REVTAG = r$REVISION
else REVTAG = branch-$BRANCHNAME -r$REVISION
fi
2007-03-21 14:35:06 +01:00
echo "
/* Added by release script */
2010-11-11 03:00:12 +01:00
#ifndef _VCS_REVISION
#define _VCS_REVISION \"$REVTAG\"
#endif" >>$CONFIGHEADER
2007-03-21 14:35:06 +01:00
2010-01-18 15:10:04 +01:00
# output image name
if [ " $USB " -ne 0 ] ; then
IMG = ${ IMG_BASE } _${ REVTAG } .img
else
IMG = ${ IMG_BASE } _${ REVTAG } .iso
fi
2010-11-11 03:00:12 +01:00
elif [ " $COPY " -eq 1 ]
then
2006-01-12 15:50:05 +01:00
( cd .. && make depend && make clean )
2007-02-19 17:40:33 +01:00
srcdir = /usr/$SRC
( cd $srcdir && tar cf - . ) | ( cd $RELEASEDIR /usr && mkdir $SRC && cd $SRC && tar xf - )
REVTAG = copy
2009-05-15 15:02:23 +02:00
REVISION = unknown
2010-01-18 15:10:04 +01:00
IMG = ${ IMG_BASE } _copy.iso
2010-11-11 03:00:12 +01:00
elif [ " $GITMODE " -eq 1 ]
then
srcdir = $RELEASEDIR /usr/src
git clone file://.. $srcdir
( cd $srcdir && git checkout $REVTAG && rm -r .git )
echo "
/* Added by release script */
#ifndef _VCS_REVISION
#define _VCS_REVISION \"$REVTAG\"
#endif" >>$CONFIGHEADER
2007-02-19 17:40:33 +01:00
fi
2005-09-24 13:28:22 +02:00
echo " * Fixups for owners and modes of dirs and files"
2010-05-12 18:28:54 +02:00
chown -R root $RELEASEDIR /usr/$SRC
2007-02-19 17:40:33 +01:00
chmod -R u+w $RELEASEDIR /usr/$SRC
find $RELEASEDIR /usr/$SRC -type d | xargs chmod 755
find $RELEASEDIR /usr/$SRC -type f | xargs chmod 644
find $RELEASEDIR /usr/$SRC -name configure | xargs chmod 755
find $RELEASEDIR /usr/$SRC /commands -name build | xargs chmod 755
2005-09-24 13:28:22 +02:00
# Bug tracking system not for on cd
2007-02-19 17:40:33 +01:00
rm -rf $RELEASEDIR /usr/$SRC /doc/bugs
2005-09-24 13:28:22 +02:00
2006-06-20 12:13:56 +02:00
# Make sure the CD knows it's a CD, unless it's not
if [ " $USB " -eq 0 ]
then date >$RELEASEDIR /CD
fi
2010-06-25 21:33:56 +02:00
echo " * Bootstrap /usr/share/mk files"
# Need /usr/share/mk in the new system to invoke make. Real ownerships
# and permissions will be set by its own src/share/mk/Makefile.
mkdir -p $RELEASEDIR /usr/share/mk
chmod 755 $RELEASEDIR /usr/share/mk
cp $RELEASEDIR /usr/src/share/mk/* $RELEASEDIR /usr/share/mk/
chown -R root $RELEASEDIR /usr/share/mk
2007-07-17 16:36:42 +02:00
cp chrootmake.sh $RELEASEDIR /usr/$SRC /tools/chrootmake.sh
2010-08-05 15:56:51 +02:00
echo " * Make hierarchy"
chroot $RELEASEDIR " PATH=/ $XBIN sh -x /usr/ $SRC /tools/chrootmake.sh etcfiles " || exit 1
2010-09-10 19:00:30 +02:00
for p in $PREINSTALLED_PACKAGES
2011-02-09 17:48:10 +01:00
do echo " * Pre-installing: $p from $PACKAGEURL "
2010-09-10 19:00:30 +02:00
pkg_add -P $RELEASEDIR $PACKAGEURL /$p
done
2010-08-05 15:56:51 +02:00
echo " * Chroot build"
2010-05-17 18:52:48 +02:00
chroot $RELEASEDIR " PATH=/ $XBIN MAKEMAP= $MAKEMAP sh -x /usr/ $SRC /tools/chrootmake.sh " || exit 1
2007-07-17 16:36:42 +02:00
# Copy built images for cd booting
cp $RELEASEDIR /boot/image_big image
2005-09-24 13:28:22 +02:00
echo " * Chroot build done"
2007-02-08 17:18:48 +01:00
echo " * Removing bootstrap files"
rm -rf $RELEASEDIR /$XBIN
2010-05-12 18:28:54 +02:00
# The build process leaves some file in $SRC as bin.
chown -R root $RELEASEDIR /usr/src*
2005-09-24 13:28:22 +02:00
cp issue.install $RELEASEDIR /etc/issue
2009-05-15 15:02:23 +02:00
echo $version_pretty , SVN revision $REVISION , generated ` date` >$RELEASEDIR /etc/version
2010-06-04 07:09:44 +02:00
rm -rf $RELEASEDIR /tmp/*
2010-05-10 20:02:15 +02:00
if [ $MINIMAL -ne 0 ]
then
2010-05-17 18:52:48 +02:00
if [ " $MAKEMAP " -ne 0 ]
then
echo " * Copying symbol map to ${ IMG } -symbols.txt "
cp $RELEASEDIR /usr/src/symbols.txt ${ IMG } -symbols.txt
$ZIP -f ${ IMG } -symbols.txt
fi
2010-05-10 20:02:15 +02:00
echo " * Removing files to create minimal image"
rm -rf $RELEASEDIR /boot/image/* $RELEASEDIR /usr/man/man*/* \
2010-06-04 07:09:44 +02:00
$RELEASEDIR /usr/share/zoneinfo* $RELEASEDIR /usr/src
2010-05-10 20:02:15 +02:00
mkdir -p $RELEASEDIR /usr/src/tools
ln $RELEASEDIR /boot/image_big $RELEASEDIR /boot/image/$version
fi
2010-06-04 07:09:44 +02:00
2005-09-09 18:05:23 +02:00
echo " * Counting files"
2006-04-10 16:18:54 +02:00
extrakb = ` du -s $RELEASEDIR /usr/install | awk '{ print $1 }' `
find $RELEASEDIR /usr | fgrep -v /install/ | wc -l >$RELEASEDIR /.usrfiles
2010-09-20 13:07:53 +02:00
find $RELEASEDIR -print -path $RELEASEDIR /usr -prune | wc -l >$RELEASEDIR /.rootfiles
2010-06-04 07:09:44 +02:00
2010-08-29 21:22:42 +02:00
echo " * Writing fstab"
if [ " $USB " -ne 0 ]
then
echo \
' root = /dev/c0d7p0s0
usr = /dev/c0d7p0s2
' > $RELEASEDIR /etc/fstab
elif [ " $HDEMU " -ne 0 ]
then
echo \
' root = /dev/c0d7p0s0
usr = /dev/c0d7p0s2
usr_roflag = "-r" ' > $RELEASEDIR /etc/fstab
fi
echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR "
2010-06-04 07:09:44 +02:00
fitfs $RELEASEDIR $TMPDISKROOT 64 256 " $ROOTMB "
ROOTBLOCKS = $blocks
ROOTSECTS = " `expr $blocks \* \( $BS / 512 \)` "
mount $TMPDISKROOT $RELEASEMNTDIR || exit
echo " * Mounting $TMPDISKUSR as $RELEASEMNTDIR /usr "
fitfs $RELEASEDIR /usr $TMPDISKUSR 0 0 " $USRMB "
USRBLOCKS = $blocks
USRSECTS = " `expr $blocks \* \( $BS / 512 \)` "
mkdir -m 755 $RELEASEMNTDIR /usr
mount $TMPDISKUSR $RELEASEMNTDIR /usr || exit
echo " * Copying files from staging to image"
synctree -f $RELEASEDIR $RELEASEMNTDIR > /dev/null || true
expr ` df $TMPDISKUSR | tail -1 | awk '{ print $4 }' ` - $extrakb >$RELEASEMNTDIR /.usrkb
2010-08-29 21:22:42 +02:00
echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR /usr "
umount $TMPDISKUSR || exit
echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR "
umount $TMPDISKROOT || exit
rm -r $RELEASEMNTDIR
2010-06-04 07:09:44 +02:00
echo " * Making image bootable"
if [ " $USB " -ne 0 ]
2010-05-10 20:02:15 +02:00
then
2010-06-04 07:09:44 +02:00
usb_root_changes
elif [ " $HDEMU " -ne 0 ]
then
hdemu_root_changes
2010-08-29 21:22:42 +02:00
else
cd_root_changes
2010-05-10 20:02:15 +02:00
fi
2006-01-17 16:14:56 +01:00
2010-08-29 21:22:42 +02:00
# Clean up: RELEASEDIR no longer needed
rm -r $RELEASEDIR
2010-01-18 15:10:04 +01:00
2005-04-21 16:53:53 +02:00
( cd ../boot && make)
2010-06-04 07:09:44 +02:00
dd if = $TMPDISKROOT of = $ROOTIMAGE bs = $BS count = $ROOTBLOCKS
2006-04-04 11:46:54 +02:00
cp release/cd/* $CDFILES || true
2006-03-19 21:57:22 +01:00
echo " This is Minix version $version_pretty prepared `date`. " >$CDFILES /VERSION.TXT
2005-08-16 14:09:20 +02:00
2010-01-18 15:10:04 +01:00
boottype = -n
2005-08-16 14:09:20 +02:00
bootimage = $IMAGE
if [ " $HDEMU " -ne 0 ] ; then
make_hdimage
2010-01-18 15:10:04 +01:00
boottype = '-h'
2005-08-16 14:09:20 +02:00
bootimage = hdimage
fi
2006-03-13 16:40:23 +01:00
if [ " $USB " -ne 0 ] ; then
mv $bootimage $IMG
else
2010-04-27 00:07:21 +02:00
cp ../boot/boot $CDFILES
writeisofs -s0x0 -l MINIX -a boot -b $bootimage $boottype $CDFILES $IMG || exit 1
2006-03-13 16:40:23 +01:00
if [ " $HDEMU " -eq 0 ]
then
echo "Appending Minix root and usr filesystem"
# Pad ISO out to cylinder boundary
isobytes = ` stat -size $IMG `
isosects = ` expr $isobytes / 512`
isopad = ` expr $secs - '(' $isosects % $secs ')' `
dd if = /dev/zero count = $isopad >>$IMG
# number of sectors
isosects = ` expr $isosects + $isopad `
( cat $IMG $ROOTIMAGE ;
2010-06-04 07:09:44 +02:00
dd if = $TMPDISKUSR bs = $BS count = $USRBLOCKS ) >m
2006-03-13 16:40:23 +01:00
mv m $IMG
# Make CD partition table
installboot -m $IMG /usr/mdec/masterboot
# Make sure there is no hole..! Otherwise the ISO format is
# unreadable.
partition -m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
fi
2005-08-16 14:09:20 +02:00
fi
2010-08-29 21:22:42 +02:00
echo " ${ ZIP } ping $IMG "
$ZIP -f $IMG
2007-04-18 13:42:48 +02:00
if [ " $FILENAMEOUT " ]
then echo " $IMG " >$FILENAMEOUT
fi
2010-06-04 07:09:44 +02:00
echo " * Freeing up memory used by ramdisks"
ramdisk 1 $TMPDISKROOT
ramdisk 1 $TMPDISKUSR