New options for release script: -m to make tiny image, ZIP to set compressor
This commit is contained in:
parent
d3e991a7b6
commit
d4188dcd5c
1 changed files with 48 additions and 17 deletions
|
@ -113,6 +113,7 @@ usr=/dev/c0d7p0s2
|
||||||
}
|
}
|
||||||
|
|
||||||
RELEASEDIR=/usr/r
|
RELEASEDIR=/usr/r
|
||||||
|
RELEASEMNTDIR=$RELEASEDIR
|
||||||
RELEASEPACKAGE=${RELEASEDIR}/usr/install/packages
|
RELEASEPACKAGE=${RELEASEDIR}/usr/install/packages
|
||||||
RELEASEPACKAGESOURCES=${RELEASEDIR}/usr/install/package-sources
|
RELEASEPACKAGESOURCES=${RELEASEDIR}/usr/install/package-sources
|
||||||
IMAGE=../boot/cdbootblock
|
IMAGE=../boot/cdbootblock
|
||||||
|
@ -129,14 +130,16 @@ COPY=0
|
||||||
SVNREV=""
|
SVNREV=""
|
||||||
REVTAG=""
|
REVTAG=""
|
||||||
PACKAGES=1
|
PACKAGES=1
|
||||||
|
MINIMAL=0
|
||||||
|
ROOTKB=8192
|
||||||
|
|
||||||
FILENAMEOUT=""
|
FILENAMEOUT=""
|
||||||
|
|
||||||
while getopts "s:pchu?r:f:" c
|
while getopts "s:pmchu?r:f:" c
|
||||||
do
|
do
|
||||||
case "$c" in
|
case "$c" in
|
||||||
\?)
|
\?)
|
||||||
echo "Usage: $0 [-p] [-c] [-h] [-r <tag>] [-u] [-f <filename>] [-s <username>]" >&2
|
echo "Usage: $0 [-p] [-c] [-h] [-m] [-r <tag>] [-u] [-f <filename>] [-s <username>]" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
|
@ -165,6 +168,14 @@ do
|
||||||
;;
|
;;
|
||||||
s) USERNAME="--username=$OPTARG"
|
s) USERNAME="--username=$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
m) MINIMAL=1
|
||||||
|
PACKAGES=0
|
||||||
|
RELEASEDIR=/usr/r-staging
|
||||||
|
RELEASEPACKAGE=${RELEASEDIR}/usr/install/packages
|
||||||
|
RELEASEPACKAGESOURCES=${RELEASEDIR}/usr/install/package-sources
|
||||||
|
ROOTKB=4096
|
||||||
|
[ ! "$USRMB" ] && USRMB=22
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -172,6 +183,10 @@ if [ ! "$USRMB" ]
|
||||||
then USRMB=600
|
then USRMB=600
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! "$ZIP" ]
|
||||||
|
then ZIP=gzip
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $PACKAGES -ne 0 ]
|
if [ $PACKAGES -ne 0 ]
|
||||||
then mkdir -p $PACKAGEDIR || true
|
then mkdir -p $PACKAGEDIR || true
|
||||||
mkdir -p $PACKAGESOURCEDIR || true
|
mkdir -p $PACKAGESOURCEDIR || true
|
||||||
|
@ -185,7 +200,6 @@ echo $USRMB MB
|
||||||
USRKB=$(($USRMB*1024))
|
USRKB=$(($USRMB*1024))
|
||||||
USRBLOCKS=$(($USRMB * 1024 * 1024 / $BS))
|
USRBLOCKS=$(($USRMB * 1024 * 1024 / $BS))
|
||||||
USRSECTS=$(($USRMB * 1024 * 2))
|
USRSECTS=$(($USRMB * 1024 * 2))
|
||||||
ROOTKB=8192
|
|
||||||
ROOTSECTS=$(($ROOTKB * 2))
|
ROOTSECTS=$(($ROOTKB * 2))
|
||||||
ROOTBLOCKS=$(($ROOTKB * 1024 / $BS))
|
ROOTBLOCKS=$(($ROOTKB * 1024 / $BS))
|
||||||
|
|
||||||
|
@ -218,20 +232,22 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " * Cleanup old files"
|
echo " * Cleanup old files"
|
||||||
rm -rf $RELEASEDIR $IMG $ROOTIMAGE $CDFILES image*
|
rm -rf $RELEASEDIR $RELEASEMNTDIR $IMG $ROOTIMAGE $CDFILES image*
|
||||||
mkdir -p $CDFILES || exit
|
mkdir -p $CDFILES || exit
|
||||||
mkdir -p $RELEASEDIR
|
mkdir -p $RELEASEDIR
|
||||||
|
[ "$RELEASEDIR" = "$RELEASEMNTDIR" ] || mkdir -p $RELEASEMNTDIR
|
||||||
mkfs -i 2000 -B $BS -b $ROOTBLOCKS $TMPDISK3 || exit
|
mkfs -i 2000 -B $BS -b $ROOTBLOCKS $TMPDISK3 || exit
|
||||||
mkfs -B 1024 -b $TMPKB $TMPDISK2 || exit
|
mkfs -B 1024 -b $TMPKB $TMPDISK2 || exit
|
||||||
echo " * mounting $TMPDISK3 as $RELEASEDIR"
|
echo " * mounting $TMPDISK3 as $RELEASEMNTDIR"
|
||||||
mount $TMPDISK3 $RELEASEDIR || exit
|
mount $TMPDISK3 $RELEASEMNTDIR || exit
|
||||||
mkdir -m 755 $RELEASEDIR/usr
|
mkdir -m 755 $RELEASEDIR/usr
|
||||||
|
[ "$RELEASEDIR" = "$RELEASEMNTDIR" ] || mkdir -m 755 $RELEASEMNTDIR/usr
|
||||||
mkdir -m 1777 $RELEASEDIR/tmp
|
mkdir -m 1777 $RELEASEDIR/tmp
|
||||||
mount $TMPDISK2 $RELEASEDIR/tmp
|
mount $TMPDISK2 $RELEASEDIR/tmp
|
||||||
|
|
||||||
mkfs -B $BS -i 30000 -b $USRBLOCKS $TMPDISK1 || exit
|
mkfs -B $BS -i 30000 -b $USRBLOCKS $TMPDISK1 || exit
|
||||||
echo " * Mounting $TMPDISK1 as $RELEASEDIR/usr"
|
echo " * Mounting $TMPDISK1 as $RELEASEMNTDIR/usr"
|
||||||
mount $TMPDISK1 $RELEASEDIR/usr || exit
|
mount $TMPDISK1 $RELEASEMNTDIR/usr || exit
|
||||||
mkdir -p $RELEASEDIR/tmp
|
mkdir -p $RELEASEDIR/tmp
|
||||||
mkdir -p $RELEASEDIR/usr/tmp
|
mkdir -p $RELEASEDIR/usr/tmp
|
||||||
mkdir -p $RELEASEDIR/$XBIN
|
mkdir -p $RELEASEDIR/$XBIN
|
||||||
|
@ -355,18 +371,33 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $version_pretty, SVN revision $REVISION, generated `date` >$RELEASEDIR/etc/version
|
echo $version_pretty, SVN revision $REVISION, generated `date` >$RELEASEDIR/etc/version
|
||||||
|
if [ $MINIMAL -ne 0 ]
|
||||||
|
then
|
||||||
|
echo " * Removing files to create minimal image"
|
||||||
|
rm -rf $RELEASEDIR/boot/image/* $RELEASEDIR/usr/man/man*/* \
|
||||||
|
$RELEASEDIR/usr/share/zoneinfo* $RELEASEDIR/usr/src \
|
||||||
|
$RELEASEDIR/tmp/*
|
||||||
|
mkdir -p $RELEASEDIR/usr/src/tools
|
||||||
|
ln $RELEASEDIR/boot/image_big $RELEASEDIR/boot/image/$version
|
||||||
|
fi
|
||||||
echo " * Counting files"
|
echo " * Counting files"
|
||||||
extrakb=`du -s $RELEASEDIR/usr/install | awk '{ print $1 }'`
|
extrakb=`du -s $RELEASEDIR/usr/install | awk '{ print $1 }'`
|
||||||
expr `df $TMPDISK1 | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEDIR/.usrkb
|
expr `df $TMPDISK1 | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEDIR/.usrkb
|
||||||
find $RELEASEDIR/usr | fgrep -v /install/ | wc -l >$RELEASEDIR/.usrfiles
|
find $RELEASEDIR/usr | fgrep -v /install/ | wc -l >$RELEASEDIR/.usrfiles
|
||||||
find $RELEASEDIR -xdev | wc -l >$RELEASEDIR/.rootfiles
|
find $RELEASEDIR -xdev | wc -l >$RELEASEDIR/.rootfiles
|
||||||
echo " * Zeroing remainder of temporary areas"
|
if [ $MINIMAL -ne 0 ]
|
||||||
df $TMPDISK1
|
then
|
||||||
df $TMPDISK3
|
echo " * Copying files from staging to image"
|
||||||
cp /dev/zero $RELEASEDIR/usr/.x 2>/dev/null || true
|
synctree -f $RELEASEDIR $RELEASEMNTDIR > /dev/null || true
|
||||||
rm $RELEASEDIR/usr/.x
|
else
|
||||||
cp /dev/zero $RELEASEDIR/.x 2>/dev/null || true
|
echo " * Zeroing remainder of temporary areas"
|
||||||
rm $RELEASEDIR/.x
|
df $TMPDISK1
|
||||||
|
df $TMPDISK3
|
||||||
|
cp /dev/zero $RELEASEDIR/usr/.x 2>/dev/null || true
|
||||||
|
rm $RELEASEDIR/usr/.x
|
||||||
|
cp /dev/zero $RELEASEDIR/.x 2>/dev/null || true
|
||||||
|
rm $RELEASEDIR/.x
|
||||||
|
fi
|
||||||
|
|
||||||
umount $TMPDISK1 || exit
|
umount $TMPDISK1 || exit
|
||||||
umount $TMPDISK2 || exit
|
umount $TMPDISK2 || exit
|
||||||
|
@ -423,8 +454,8 @@ else
|
||||||
# Make sure there is no hole..! Otherwise the ISO format is
|
# Make sure there is no hole..! Otherwise the ISO format is
|
||||||
# unreadable.
|
# unreadable.
|
||||||
partition -m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
|
partition -m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
|
||||||
echo "gzipping $IMG"
|
echo "${ZIP}ping $IMG"
|
||||||
gzip $IMG
|
$ZIP -f $IMG
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue