Added -u option for making USB-stick images.
This commit is contained in:
parent
5731e07839
commit
5ceb98e9ee
1 changed files with 69 additions and 32 deletions
101
tools/release.sh
101
tools/release.sh
|
@ -53,7 +53,22 @@ usr=/dev/c0d7p0s2
|
||||||
usr_roflag="-r"' > $RELEASEDIR/etc/fstab
|
usr_roflag="-r"' > $RELEASEDIR/etc/fstab
|
||||||
}
|
}
|
||||||
|
|
||||||
HDEMU=1
|
usb_root_changes()
|
||||||
|
{
|
||||||
|
$RELEASEDIR/usr/bin/installboot -d $TMPDISK3 \
|
||||||
|
$RELEASEDIR/usr/mdec/bootblock boot/boot
|
||||||
|
echo \
|
||||||
|
'bios_wini=yes
|
||||||
|
disable=inet
|
||||||
|
bios_remap_first=1
|
||||||
|
rootdev=c0d7p0s0
|
||||||
|
save' | $RELEASEDIR/usr/bin/edparams $TMPDISK3
|
||||||
|
|
||||||
|
echo \
|
||||||
|
'root=/dev/c0d7p0s0
|
||||||
|
usr=/dev/c0d7p0s2
|
||||||
|
' > $RELEASEDIR/etc/fstab
|
||||||
|
}
|
||||||
|
|
||||||
COPYITEMS="usr/bin bin usr/lib"
|
COPYITEMS="usr/bin bin usr/lib"
|
||||||
RELEASEDIR=/usr/r
|
RELEASEDIR=/usr/r
|
||||||
|
@ -63,23 +78,23 @@ CDFILES=/usr/tmp/cdreleasefiles
|
||||||
sh tell_config OS_RELEASE . OS_VERSION >/tmp/rel.$$
|
sh tell_config OS_RELEASE . OS_VERSION >/tmp/rel.$$
|
||||||
version_pretty=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$`
|
version_pretty=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$`
|
||||||
version=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$ | tr . _`
|
version=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$ | tr . _`
|
||||||
ISO=minix${version}_`date +%Y%m%d-%H%M%S`
|
IMG_BASE=minix${version}_`date +%Y%m%d-%H%M%S`
|
||||||
BS=4096
|
BS=4096
|
||||||
|
|
||||||
HDEMU=0
|
HDEMU=0
|
||||||
COPY=0
|
COPY=0
|
||||||
CVSTAG=HEAD
|
CVSTAG=HEAD
|
||||||
|
|
||||||
while getopts "ch?" c
|
while getopts "chu?" c
|
||||||
do
|
do
|
||||||
case "$c" in
|
case "$c" in
|
||||||
\?)
|
\?)
|
||||||
echo "Usage: $0 [-c] [-h] [-r <tag>]" >&2
|
echo "Usage: $0 [-c] [-h] [-r <tag>] [-u]" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
echo " * Making HD image"
|
echo " * Making HD image"
|
||||||
ISO=${ISO}_bios
|
IMG_BASE=${IMG_BASE}_bios
|
||||||
HDEMU=1
|
HDEMU=1
|
||||||
;;
|
;;
|
||||||
c)
|
c)
|
||||||
|
@ -89,14 +104,24 @@ do
|
||||||
r)
|
r)
|
||||||
CVSTAG=$OPTARG
|
CVSTAG=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
u)
|
||||||
|
echo " * Making live USB-stick image"
|
||||||
|
IMG_BASE=${IMG_BASE}_USB
|
||||||
|
HDEMU=1
|
||||||
|
USB=1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
ISO=${ISO}.iso
|
if [ "$USB" -ne 0 ]; then
|
||||||
ISOBZ=${ISO}.bz2
|
IMG=${IMG_BASE}.img
|
||||||
echo "Making $ISOBZ"
|
else
|
||||||
|
IMG=${IMG_BASE}.iso
|
||||||
|
fi
|
||||||
|
IMGBZ=${IMG}.bz2
|
||||||
|
echo "Making $IMGBZ"
|
||||||
|
|
||||||
USRMB=60
|
USRMB=80
|
||||||
|
|
||||||
USRBLOCKS="`expr $USRMB \* 1024 \* 1024 / $BS`"
|
USRBLOCKS="`expr $USRMB \* 1024 \* 1024 / $BS`"
|
||||||
USRSECTS="`expr $USRMB \* 1024 \* 2`"
|
USRSECTS="`expr $USRMB \* 1024 \* 2`"
|
||||||
|
@ -189,7 +214,7 @@ echo " * Ready to go, press RETURN if you're sure.."
|
||||||
read xyzzy
|
read xyzzy
|
||||||
|
|
||||||
echo " * Cleanup old files"
|
echo " * Cleanup old files"
|
||||||
rm -rf $RELEASEDIR $ISO $IMAGE $ROOTIMAGE $ISOBZ $CDFILES image*
|
rm -rf $RELEASEDIR $IMG $IMAGE $ROOTIMAGE $IMGBZ $CDFILES image*
|
||||||
mkdir -p $CDFILES || exit
|
mkdir -p $CDFILES || exit
|
||||||
mkdir -p $RELEASEDIR
|
mkdir -p $RELEASEDIR
|
||||||
mkfs -B $BS -b $ROOTBLOCKS $TMPDISK3 || exit
|
mkfs -B $BS -b $ROOTBLOCKS $TMPDISK3 || exit
|
||||||
|
@ -242,7 +267,13 @@ echo " * Chroot build done"
|
||||||
chown -R bin $RELEASEDIR/usr/src*
|
chown -R bin $RELEASEDIR/usr/src*
|
||||||
cp issue.install $RELEASEDIR/etc/issue
|
cp issue.install $RELEASEDIR/etc/issue
|
||||||
|
|
||||||
if [ "$HDEMU" -ne 0 ]; then hdemu_root_changes; fi
|
if [ "$USB" -ne 0 ]
|
||||||
|
then
|
||||||
|
usb_root_changes
|
||||||
|
elif [ "$HDEMU" -ne 0 ]
|
||||||
|
then
|
||||||
|
hdemu_root_changes
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Temporary filesystems still mounted. Make changes, or press RETURN"
|
echo "Temporary filesystems still mounted. Make changes, or press RETURN"
|
||||||
echo -n "to continue making the image.."
|
echo -n "to continue making the image.."
|
||||||
|
@ -300,27 +331,33 @@ if [ "$HDEMU" -ne 0 ]; then
|
||||||
h_opt='-h'
|
h_opt='-h'
|
||||||
bootimage=hdimage
|
bootimage=hdimage
|
||||||
fi
|
fi
|
||||||
writeisofs -l MINIX -b $bootimage $h_opt $CDFILES $ISO || exit 1
|
|
||||||
|
|
||||||
if [ "$HDEMU" -eq 0 ]
|
if [ "$USB" -ne 0 ]; then
|
||||||
then
|
mv $bootimage $IMG
|
||||||
echo "Appending Minix root and usr filesystem"
|
else
|
||||||
# Pad ISO out to cylinder boundary
|
writeisofs -l MINIX -b $bootimage $h_opt $CDFILES $IMG || exit 1
|
||||||
isobytes=`stat -size $ISO`
|
|
||||||
isosects=`expr $isobytes / 512`
|
if [ "$HDEMU" -eq 0 ]
|
||||||
isopad=`expr $secs - '(' $isosects % $secs ')'`
|
then
|
||||||
dd if=/dev/zero count=$isopad >>$ISO
|
echo "Appending Minix root and usr filesystem"
|
||||||
# number of sectors
|
# Pad ISO out to cylinder boundary
|
||||||
isosects=`expr $isosects + $isopad`
|
isobytes=`stat -size $IMG`
|
||||||
( cat $ISO $ROOTIMAGE ; dd if=$TMPDISK bs=$BS count=$USRBLOCKS ) >m
|
isosects=`expr $isobytes / 512`
|
||||||
mv m $ISO
|
isopad=`expr $secs - '(' $isosects % $secs ')'`
|
||||||
# Make CD partition table
|
dd if=/dev/zero count=$isopad >>$IMG
|
||||||
installboot -m $ISO /usr/mdec/masterboot
|
# number of sectors
|
||||||
# Make sure there is no hole..! Otherwise the ISO format is
|
isosects=`expr $isosects + $isopad`
|
||||||
# unreadable.
|
( cat $IMG $ROOTIMAGE ;
|
||||||
partition -m $ISO 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
|
dd if=$TMPDISK bs=$BS count=$USRBLOCKS ) >m
|
||||||
|
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
|
||||||
fi
|
fi
|
||||||
echo " * bzipping $ISO"
|
echo " * bzipping $IMG"
|
||||||
bzip2 $ISO
|
bzip2 $IMG
|
||||||
ls -al $ISOBZ
|
ls -al $IMGBZ
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue