From 084438ff2ece1b6d8ed3caaf03f30ea98259bac5 Mon Sep 17 00:00:00 2001 From: Erik Troan Date: Wed, 10 May 2000 13:01:57 +0000 Subject: 1) added $$ to some paths 2) added makemainimage 3) cleaned up some dd output 4) cleaned up parameter list --- scripts/mk-images | 44 +++++++++++++++++++++++++++++++++++--------- scripts/mk-images.i386 | 2 +- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/scripts/mk-images b/scripts/mk-images index c7884f5e3..13a9c6175 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -5,7 +5,7 @@ usage () { exit 0 } -if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" -o -z "$5" ]; then usage; fi +if [ -z "$1" -o -z "$2" -o -z "$3" ]; then usage; fi TOPDIR=$(echo $0 | sed "s,/[^/]*$,,") if [ $TOPDIR = $0 ]; then @@ -18,10 +18,10 @@ TOPDIR=$(cd $TOPDIR; pwd) KERNELPATH=$1 TOPDESTPATH=$2 IMAGEPATH=$2/images - FULLMODPATH=$3 - INSTIMGPATH=$4 - INSTIMGTEMPLATE=$5 - IMGPATH=$(echo $FULLMODPATH | sed 's,/[^/]*$,,') + FULLMODPATH=$2/RedHat/instimage/modules + INSTIMGPATH=$2/RedHat/base + INSTIMGTEMPLATE=$3 + IMGPATH=$2/RedHat/instimage KERNELROOT=/tmp/updboot.kernel.$$ MODDEPS=$KERNELROOT/moddeps ARCH=$(uname -m | sed 's/i.86/i386/') @@ -350,7 +350,7 @@ EOF rm -rf $MBD_FSIMAGE.uncompressed $MBD_DIR rm -rf $MBD_TMPIMAGE $MBD_BOOTTREE - dd if=/dev/zero bs=1k count=$FLOPPYSIZE of=/$MBD_TMPIMAGE + dd if=/dev/zero bs=1k count=$FLOPPYSIZE of=/$MBD_TMPIMAGE 2>/dev/null # Create the bootdisk image as $MBD_TMPIMAGE, mount it, copy # $MBD_FSIMAGE (the initrd) to it, add a kernel, umount it. It should be @@ -392,9 +392,9 @@ EOF makeinstimage () { imagename=$1 modlist=$(expandModuleSet "$2") - tmpimage=/tmp/instimage.img - mntpoint=/tmp/instimage.mnt - tmpdir=/tmp/instimage.dir + tmpimage=/tmp/instimage.img.$$ + mntpoint=/tmp/instimage.mnt.$$ + tmpdir=/tmp/instimage.dir.$$ rm -rf $tmpimage $mntpoint $tmpdir mkdir -p $mntpoint $tmpdir @@ -424,6 +424,32 @@ makeinstimage () { rm $tmpimage } +makemainimage () { + imagename=$1 + tmpimage=/tmp/instimage.img.$$ + mntpoint=/tmp/instimage.mnt.$$ + + rm -rf $mntpoint $tmpimage + mkdir $mntpoint + + size=$(du -sk $IMGPATH | awk '{print $1}') + + dd if=/dev/zero of=$tmpimage bs=1k count=$size 2>/dev/null + echo y | mke2fs -m 0 -i 4096 $tmpimage > /dev/null 2>/dev/null + mount -o loop $tmpimage $mntpoint + (cd $IMGPATH; find . | cpio --quiet -p $mntpoint) + + df $mntpoint + df -i $mntpoint + + umount $mntpoint + rmdir $mntpoint + + cp $tmpimage $INSTIMGPATH/${imagename}.img + + rm $tmpimage +} + makedriverdisk () { modlabel=$1 diskname=$2 diff --git a/scripts/mk-images.i386 b/scripts/mk-images.i386 index b245e7af3..689e6a630 100644 --- a/scripts/mk-images.i386 +++ b/scripts/mk-images.i386 @@ -21,4 +21,4 @@ makedriverdisk "Parallel port IDE Drivers" "paride" "parport_pc parport pcd pari makemainmodules "=scsi =net $SECSTAGE" makeinstimage "netstg2" "=scsi $SECSTAGE" -makeinstimage "hdstg2" "=scsi $SECSTAGE" +makemainimage "stage2" -- cgit