--- elwix/install2img.sh 2011/10/18 09:02:05 1.2 +++ elwix/install2img.sh 2012/10/11 13:31:33 1.2.4.1 @@ -5,7 +5,7 @@ # (C) AITNET ltd - Sofia/Bulgaria # by Michael Pounov # -# $Id: install2img.sh,v 1.2 2011/10/18 09:02:05 misho Exp $ +# $Id: install2img.sh,v 1.2.4.1 2012/10/11 13:31:33 misho Exp $ # [ -r ./config/rc.elwix ] && . ./config/rc.elwix @@ -29,15 +29,15 @@ DEV="" mkdevice() { echo "+++ Make prepare file image ... " - rm -f $IMG - dd if=/dev/zero of=${IMG} bs=1024 count=${IMG_SIZE} + rm -f $1 + dd if=/dev/zero of=$1 bs=1024 count=$2 - echo -n "+++ Assign memory device to image ... " - DEV=`mdconfig -a -tvnode -f ${IMG}` + echo -n "+++ Assign memory device to image $1 ... " + DEV=`mdconfig -a -tvnode -f $1` echo $DEV if [ -z "$DEV" ]; then - rm -f $IMG + rm -f $1 exit 3 fi } @@ -95,7 +95,7 @@ enablejfs() boot2dev() { echo -n "+++ Installboot to device $1 ... " - if disklabel -B -b ${WORLD}/boot/boot -m ${TARGET} ${1}; then + if disklabel -B -b ${WORLD}/boot/boot -m ${TARGET} $1; then echo "OK" else echo "Failed!" @@ -122,32 +122,39 @@ cleandev() gencksum() { echo -n "+++ Generate check sums ... " - md5 ${IMG} >${MD5CHK} - sha1 ${IMG} >${SHA1CHK} + md5 $1 >$2 + sha1 $1 >$3 echo "OK" } ### main() -if [ ! -r ${1:-"${REL}/${OS}"} ]; then +if [ ! -r ${REL}/${OS} -a -r ${REL}/${OS_LITE} ]; then echo echo "Error:: ELWIX OS file not found!" echo exit 2 fi -mkdevice - +mkdevice $IMG ${1:-"${IMG_SIZE}"} initdev $DEV - mountdev $DEV -install2 ${1:-"$REL/$OS"} +install2 ${REL}/${OS} umountdev - #enablejfs $DEV boot2dev $DEV +cleandev $DEV +gencksum $IMG $MD5CHK $SHA1CHK + +mkdevice $IMG_LITE ${1:-"${IMG_SIZE}"} +initdev $DEV +mountdev $DEV +install2 ${REL}/${OS_LITE} +umountdev +#enablejfs $DEV +boot2dev $DEV cleandev $DEV +gencksum $IMG_LITE $MD5CHK_LITE $SHA1CHK_LITE -gencksum echo "ELWIX OS image complete."