2005-04-21 16:53:53 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2006-04-04 11:43:26 +02:00
|
|
|
set -e
|
|
|
|
|
2011-04-30 21:25:05 +02:00
|
|
|
. release.functions
|
|
|
|
|
2013-01-23 09:13:24 +01:00
|
|
|
version_pretty="`sh ../sys/conf/osrelease.sh`"
|
2011-06-07 14:34:14 +02:00
|
|
|
version="`echo $version_pretty | tr . _`"
|
|
|
|
PACKAGEDIR=/usr/pkgsrc/packages/$version_pretty/`uname -m`
|
|
|
|
|
2007-02-19 17:40:33 +01:00
|
|
|
SRC=src
|
2013-02-13 20:15:02 +01:00
|
|
|
: ${REPO:=git://git.minix3.org/minix}
|
|
|
|
: ${GITBRANCH:=master}
|
2007-02-08 17:18:48 +01:00
|
|
|
|
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
|
|
|
|
2011-03-10 13:54:58 +01:00
|
|
|
PKG_ADD=/usr/pkg/sbin/pkg_add
|
2011-06-07 14:48:31 +02:00
|
|
|
PKG_INFO=/usr/pkg/sbin/pkg_info
|
2011-03-10 13:54:58 +01:00
|
|
|
|
|
|
|
if [ ! -x $PKG_ADD ]
|
|
|
|
then echo Please install pkg_install from pkgsrc.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2010-08-05 15:56:51 +02:00
|
|
|
# Packages we have to pre-install, and url to use
|
2011-06-07 14:34:14 +02:00
|
|
|
PACKAGEURL=ftp://ftp.minix3.org/pub/minix/packages/$version_pretty/`uname -m`/All/
|
2011-06-07 14:48:31 +02:00
|
|
|
PREINSTALLED_PACKAGES="
|
2011-08-15 23:46:23 +02:00
|
|
|
pkgin
|
|
|
|
pkg_install
|
|
|
|
bmake
|
|
|
|
binutils
|
|
|
|
clang
|
2011-06-07 14:48:31 +02:00
|
|
|
"
|
2011-09-01 00:00:42 +02:00
|
|
|
# pkg_tarup
|
2011-06-07 14:48:31 +02:00
|
|
|
|
|
|
|
PKG_ADD_URL=$PACKAGEURL
|
2010-08-05 15:56:51 +02:00
|
|
|
|
2010-04-27 00:07:21 +02:00
|
|
|
RELEASERC=$HOME/.releaserc
|
|
|
|
|
|
|
|
if [ -f $RELEASERC ]
|
|
|
|
then . $RELEASERC
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -- $* $RELOPTS
|
|
|
|
|
2012-11-23 21:35:59 +01:00
|
|
|
export RELEASEDIR=/usr/r-staging
|
2010-06-04 07:09:44 +02:00
|
|
|
RELEASEMNTDIR=/usr/r
|
|
|
|
|
2012-02-02 12:02:34 +01:00
|
|
|
IMAGE=/usr/mdec/bootxx_cd9660
|
2005-05-03 10:54:36 +02:00
|
|
|
ROOTIMAGE=rootimage
|
2005-07-24 03:18:09 +02:00
|
|
|
CDFILES=/usr/tmp/cdreleasefiles
|
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
|
2011-07-13 23:59:07 +02:00
|
|
|
JAILMODE=0
|
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
|
2011-11-15 00:24:37 +01:00
|
|
|
EXTRAS_INSTALL=0
|
|
|
|
EXTRAS_PATH=
|
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 ]
|
2011-04-30 21:25:05 +02:00
|
|
|
then LOCAL_REVTAG="`git describe --always`"
|
2010-11-11 03:00:12 +01:00
|
|
|
GITMODE=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2007-04-18 13:42:48 +02:00
|
|
|
FILENAMEOUT=""
|
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
while getopts "b:j:ls:pmMchu?f:L:e:" c
|
2005-08-16 14:09:20 +02:00
|
|
|
do
|
|
|
|
case "$c" in
|
|
|
|
\?)
|
2012-11-27 12:48:49 +01:00
|
|
|
echo "Usage: $0 [-l] [-p] [-c] [-h] [-m] [-M] [-u] [-f <filename>] [-s <username>] -j<jaildir> [-L <packageurl>] [-e <extras-path>]" >&2
|
2005-08-16 14:09:20 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
2012-02-20 23:46:01 +01:00
|
|
|
b)
|
|
|
|
GITBRANCH=$OPTARG
|
|
|
|
;;
|
2005-08-16 14:09:20 +02:00
|
|
|
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)
|
2012-11-27 12:48:49 +01:00
|
|
|
echo " * Copying, not using GIT"
|
2005-08-24 18:49:09 +02:00
|
|
|
COPY=1
|
|
|
|
;;
|
2006-04-10 16:18:54 +02:00
|
|
|
p)
|
|
|
|
PACKAGES=0
|
|
|
|
;;
|
2011-07-13 23:59:07 +02:00
|
|
|
j)
|
2011-07-22 22:10:21 +02:00
|
|
|
RELEASEDIR=$OPTARG
|
2011-07-13 23:59:07 +02:00
|
|
|
JAILMODE=1
|
|
|
|
;;
|
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
|
|
|
|
;;
|
2011-08-03 12:53:01 +02:00
|
|
|
l) PKG_ADD_URL=file://$PACKAGEDIR/All
|
|
|
|
;;
|
2011-08-15 23:40:14 +02:00
|
|
|
L) PKG_ADD_URL="$OPTARG"
|
|
|
|
CUSTOM_PACKAGES=1
|
2011-06-07 14:48:31 +02:00
|
|
|
;;
|
2011-11-15 00:24:37 +01:00
|
|
|
e) EXTRAS_INSTALL=1
|
|
|
|
EXTRAS_PATH="$OPTARG"
|
|
|
|
;;
|
2005-08-16 14:09:20 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2013-01-07 22:21:19 +01:00
|
|
|
RELEASEPACKAGE=${RELEASEDIR}/usr/install/packages
|
|
|
|
|
2011-04-30 21:25:05 +02:00
|
|
|
if [ $GITMODE -ne 1 -a $COPY -ne 1 ]
|
|
|
|
then echo "Need git to retrieve latest minix! Copying src instead!"
|
|
|
|
COPY=1
|
|
|
|
fi
|
|
|
|
|
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
|
2011-06-07 14:34:14 +02:00
|
|
|
retrieve $PACKAGEDIR/All $PACKAGELIST packages/`uname -p`/$VERSION_PRETTY
|
2009-03-19 15:14:57 +01: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
|
|
|
|
|
2011-07-13 23:59:07 +02:00
|
|
|
if [ $JAILMODE = 0 ]
|
|
|
|
then echo " * Cleanup old files"
|
|
|
|
umount $TMPDISKUSR || true
|
|
|
|
umount $TMPDISKROOT || true
|
|
|
|
umount $RELEASEMNTDIR/usr || true
|
|
|
|
umount $RELEASEMNTDIR || true
|
|
|
|
fi
|
2010-06-04 07:09:44 +02:00
|
|
|
|
2012-02-11 15:48:12 +01:00
|
|
|
rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image* || true
|
2005-07-24 03:18:09 +02:00
|
|
|
mkdir -p $CDFILES || exit
|
2010-06-04 07:09:44 +02:00
|
|
|
mkdir -p $RELEASEDIR $RELEASEMNTDIR
|
2006-03-15 16:34:12 +01:00
|
|
|
mkdir -p $RELEASEPACKAGE
|
2005-08-24 18:49:09 +02:00
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
|
|
|
echo " * Bootstrapping filesystem in $RELEASEDIR"
|
|
|
|
##########################################################################
|
2012-02-11 19:31:25 +01:00
|
|
|
CONFIGHEADER=$RELEASEDIR/usr/src/include/minix/sys_config.h
|
2010-11-11 03:00:12 +01:00
|
|
|
|
2011-04-30 21:25:05 +02:00
|
|
|
copy_local_packages
|
2006-03-15 16:34:12 +01:00
|
|
|
|
2011-04-30 21:25:05 +02:00
|
|
|
if [ "$COPY" -ne 1 ]
|
2005-08-24 18:49:09 +02:00
|
|
|
then
|
2012-02-20 23:46:01 +01:00
|
|
|
echo "Retrieving latest minix repo from $REPO branch $GITBRANCH."
|
2011-04-30 21:25:05 +02:00
|
|
|
srcdir=$RELEASEDIR/usr/src
|
2012-02-20 23:46:01 +01:00
|
|
|
git clone -b $GITBRANCH $REPO $srcdir
|
2011-04-30 21:25:05 +02:00
|
|
|
if [ "$REVTAG" ]
|
|
|
|
then echo "Doing checkout of $REVTAG."
|
|
|
|
(cd $srcdir && git checkout $REVTAG )
|
2012-02-21 01:20:00 +01:00
|
|
|
else REVTAG=`(cd $srcdir && git rev-parse --short HEAD)`
|
|
|
|
echo "Retrieved repository head in $srcdir is $REVTAG."
|
2009-10-19 17:46:27 +02:00
|
|
|
fi
|
2011-10-06 21:10:49 +02:00
|
|
|
if [ $MINIMAL -ne 0 ]
|
|
|
|
then rm -r $srcdir/.git
|
|
|
|
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
|
2011-07-20 11:47:09 +02:00
|
|
|
DATE=`date +%Y%m%d`
|
2011-04-30 21:25:05 +02:00
|
|
|
# output image name
|
|
|
|
if [ "$USB" -ne 0 ]; then
|
2011-07-20 11:47:09 +02:00
|
|
|
IMG=${IMG_BASE}_${DATE}_${REVTAG}.img
|
2011-04-30 21:25:05 +02:00
|
|
|
else
|
2011-07-20 11:47:09 +02:00
|
|
|
IMG=${IMG_BASE}_${DATE}_${REVTAG}.iso
|
2011-04-30 21:25:05 +02:00
|
|
|
fi
|
2010-01-18 15:10:04 +01:00
|
|
|
else
|
2013-01-07 22:21:19 +01:00
|
|
|
echo "First cleaning current sourcedir.."
|
|
|
|
( cd .. && make cleandir >/dev/null )
|
2011-04-30 21:25:05 +02:00
|
|
|
echo "Copying contents from current src dir."
|
2007-02-19 17:40:33 +01:00
|
|
|
srcdir=/usr/$SRC
|
2011-06-07 14:48:31 +02:00
|
|
|
( cd $srcdir && tar --exclude .svn -cf - . ) | ( cd $RELEASEDIR/usr && mkdir $SRC && cd $SRC && tar xf - )
|
2013-01-07 22:21:19 +01:00
|
|
|
echo "Copying done."
|
2007-02-19 17:40:33 +01:00
|
|
|
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
|
2007-02-19 17:40:33 +01:00
|
|
|
fi
|
|
|
|
|
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-08-05 15:56:51 +02:00
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
rm -f $RELEASEDIR/usr/$SRC/releasetools/revision
|
2010-08-05 15:56:51 +02:00
|
|
|
|
2010-09-10 19:00:30 +02:00
|
|
|
for p in $PREINSTALLED_PACKAGES
|
2011-06-07 14:48:31 +02:00
|
|
|
do echo " * Pre-installing: $p from $PKG_ADD_URL"
|
2011-08-15 23:40:14 +02:00
|
|
|
$PKG_ADD -f -P $RELEASEDIR $PKG_ADD_URL/$p
|
2010-09-10 19:00:30 +02:00
|
|
|
done
|
2010-08-05 15:56:51 +02:00
|
|
|
|
2011-08-15 23:40:14 +02:00
|
|
|
if [ "$CUSTOM_PACKAGES" ]
|
|
|
|
then echo $PKG_ADD_URL >$RELEASEDIR/usr/pkg/etc/pkgin/repositories.conf
|
|
|
|
fi
|
|
|
|
|
2012-02-15 01:19:12 +01:00
|
|
|
echo " * Resetting timestamps"
|
|
|
|
find $RELEASEDIR | xargs touch
|
2012-11-27 12:48:49 +01:00
|
|
|
|
|
|
|
##########################################################################
|
2012-11-23 21:35:59 +01:00
|
|
|
echo " * Build"
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
2012-11-23 21:35:59 +01:00
|
|
|
|
|
|
|
cd $RELEASEDIR/usr/src
|
|
|
|
make distribution DESTDIR=$RELEASEDIR CHECKFLIST=no
|
|
|
|
make -C releasetools do-hdboot DESTDIR=$RELEASEDIR MKINSTALLBOOT=yes
|
|
|
|
cp $RELEASEDIR/usr/mdec/boot_monitor $RELEASEDIR
|
|
|
|
cp $RELEASEDIR/boot/minix_latest/* $RELEASEDIR/boot/minix_default/
|
|
|
|
|
|
|
|
if [ $MAKEMAP -ne 0 ]; then
|
|
|
|
find . -type f -perm 755 | xargs nm -n 2> /dev/null > symbols.txt
|
|
|
|
fi
|
|
|
|
make cleandir
|
|
|
|
|
|
|
|
cd -
|
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
echo " * build done"
|
|
|
|
|
|
|
|
##########################################################################
|
2007-02-08 17:18:48 +01:00
|
|
|
echo " * Removing bootstrap files"
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
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/*
|
2011-07-13 23:59:07 +02:00
|
|
|
|
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"
|
2012-05-01 13:55:49 +02:00
|
|
|
rm -rf $RELEASEDIR/usr/man/man*/* \
|
2010-06-04 07:09:44 +02:00
|
|
|
$RELEASEDIR/usr/share/zoneinfo* $RELEASEDIR/usr/src
|
2012-06-18 17:13:26 +02:00
|
|
|
mkdir -p $RELEASEDIR/usr/src/releasetools
|
2010-05-10 20:02:15 +02:00
|
|
|
fi
|
2010-06-04 07:09:44 +02:00
|
|
|
|
2011-11-15 00:24:37 +01:00
|
|
|
if [ $EXTRAS_INSTALL -ne 0 ] ; then
|
|
|
|
echo " * Copying files from $EXTRAS_PATH"
|
|
|
|
cp -Rv $EXTRAS_PATH/* $RELEASEDIR
|
|
|
|
fi
|
|
|
|
|
2011-07-13 23:59:07 +02:00
|
|
|
# If we are making a jail, all is done!
|
|
|
|
if [ $JAILMODE = 1 ]
|
2011-07-22 22:10:21 +02:00
|
|
|
then echo "Created new minix install in $RELEASEDIR."
|
2011-07-13 23:59:07 +02:00
|
|
|
echo "Enter it by typing: "
|
2011-07-22 22:10:21 +02:00
|
|
|
echo "# chroot $RELEASEDIR /bin/sh"
|
2011-07-13 23:59:07 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
2005-09-09 18:05:23 +02:00
|
|
|
echo " * Counting files"
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
2012-03-04 00:53:03 +01:00
|
|
|
extrakb=`du -ks $RELEASEDIR/usr/install | awk '{ print $1 }'`
|
2006-04-10 16:18:54 +02:00
|
|
|
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
|
|
|
|
2011-11-09 16:34:47 +01:00
|
|
|
fstab_marker="# Poor man's File System Table."
|
2010-08-29 21:22:42 +02:00
|
|
|
echo " * Writing fstab"
|
|
|
|
if [ "$USB" -ne 0 ]
|
|
|
|
then
|
|
|
|
echo \
|
2011-11-09 16:34:47 +01:00
|
|
|
"$fstab_marker
|
|
|
|
root=/dev/c0d7p0s0
|
2010-08-29 21:22:42 +02:00
|
|
|
usr=/dev/c0d7p0s2
|
2011-11-09 16:34:47 +01:00
|
|
|
" > $RELEASEDIR/etc/fstab
|
2010-08-29 21:22:42 +02:00
|
|
|
elif [ "$HDEMU" -ne 0 ]
|
|
|
|
then
|
|
|
|
echo \
|
2011-11-09 16:34:47 +01:00
|
|
|
"$fstab_marker
|
|
|
|
root=/dev/c0d7p0s0
|
2010-08-29 21:22:42 +02:00
|
|
|
usr=/dev/c0d7p0s2
|
2011-11-09 16:34:47 +01:00
|
|
|
usr_roflag=\"-r\"" > $RELEASEDIR/etc/fstab
|
2010-08-29 21:22:42 +02:00
|
|
|
fi
|
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
2010-08-29 21:22:42 +02:00
|
|
|
echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
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
|
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
2010-06-04 07:09:44 +02:00
|
|
|
echo " * Copying files from staging to image"
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
2010-06-04 07:09:44 +02:00
|
|
|
synctree -f $RELEASEDIR $RELEASEMNTDIR > /dev/null || true
|
2012-10-16 19:34:18 +02:00
|
|
|
expr `df -k $TMPDISKUSR | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEMNTDIR/.usrkb
|
2010-06-04 07:09:44 +02:00
|
|
|
|
2010-08-29 21:22:42 +02:00
|
|
|
echo " * Unmounting $TMPDISKUSR from $RELEASEMNTDIR/usr"
|
|
|
|
umount $TMPDISKUSR || exit
|
|
|
|
|
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
|
|
|
|
2012-02-02 12:02:34 +01:00
|
|
|
echo " * Unmounting $TMPDISKROOT from $RELEASEMNTDIR"
|
|
|
|
umount $TMPDISKROOT || exit
|
|
|
|
rm -r $RELEASEMNTDIR
|
2010-01-18 15:10:04 +01:00
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
|
|
|
echo " * Generating image files"
|
|
|
|
##########################################################################
|
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
|
2012-02-02 12:02:34 +01:00
|
|
|
cp $RELEASEDIR/usr/mdec/boot_monitor $CDFILES/boot
|
2012-02-15 01:19:12 +01:00
|
|
|
cp -rf $RELEASEDIR/boot/minix_latest/* $CDFILES/
|
2012-02-17 00:06:42 +01:00
|
|
|
gzip -d $CDFILES/*gz
|
2012-02-02 12:02:34 +01:00
|
|
|
writeisofs -s0x0 -l MINIX -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
|
2011-07-20 10:19:28 +02:00
|
|
|
isobytes=`stat -f %z $IMG`
|
2006-03-13 16:40:23 +01:00
|
|
|
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
|
2012-02-02 12:02:34 +01:00
|
|
|
installboot_nbsd -m $IMG /usr/mdec/mbr
|
2006-03-13 16:40:23 +01:00
|
|
|
# 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
|
2012-02-02 12:02:34 +01:00
|
|
|
|
|
|
|
# Clean up: RELEASEDIR no longer needed
|
|
|
|
rm -r $RELEASEDIR
|
|
|
|
|
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
|
|
|
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
2010-06-04 07:09:44 +02:00
|
|
|
echo " * Freeing up memory used by ramdisks"
|
2012-11-27 12:48:49 +01:00
|
|
|
##########################################################################
|
2010-06-04 07:09:44 +02:00
|
|
|
ramdisk 1 $TMPDISKROOT
|
|
|
|
ramdisk 1 $TMPDISKUSR
|