X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=mkext3.sh;h=4e3a60a089fd9912a8a2f7430f4a8db70b2f7dab;hb=8701b6961a630ad35e4e4bc39068bc72ffbb5153;hp=677391c35685da3f8bde25643b9782e8e280e783;hpb=8d0617472c4d98f0e4a13d8a28f7e9493c961dd0;p=xodist diff --git a/mkext3.sh b/mkext3.sh index 677391c..4e3a60a 100755 --- a/mkext3.sh +++ b/mkext3.sh @@ -18,6 +18,7 @@ IMG_NAME="" ROOT_DIR="" +SKIP_GRUB="n" . ./functions.sh @@ -64,7 +65,7 @@ create_bootable_img() # first, create a sparse image minus_size=$(($size * 6 / 100)) size=$(($size - $minus_size)) - dd if=/dev/zero of=$img bs=1M count=1 seek=$(($size - 1)) + dd if=/dev/zero of=$img bs=1M count=1 seek=$size # fill in the partition table parted -s "$img" "mklabel msdos" @@ -94,6 +95,7 @@ default 0 timeout 5 color cyan/blue white/blue EOF + installer_added=0 label=`sed -ne 's/^LABEL=\(.\+\)[[:space:]]\+\/[[:space:]]\+.*/\1/p' configs/${CONFIG_TYPE}/fstab-ext3` prefix= grep -q ' ${mntpt}/boot ' /proc/mounts && prefix=/boot @@ -111,11 +113,23 @@ kernel ${prefix}/vmlinuz-${v} root=LABEL=${label} ro initrd ${prefix}/initrd.img-${v} boot EOF + if [ "$installer_added" = "0" ]; then + installer_added=1 + cat >>${mntpt}/boot/grub/menu.lst<&2 echo " --config-type directory name in configs/ to use" 1>&2 echo " --help display this help screen" 1>&2 + echo " --skip-grub don't install GRUB on image" 1>&2 echo "" 1>&2 exit 1 } @@ -234,6 +251,9 @@ do } shift ;; + --skip-grub) + SKIP_GRUB="y" + ;; --help|-h) usage ;; @@ -264,7 +284,10 @@ if [ ! -d "$ROOT_DIR" ]; then usage fi -check_for_cmds losetup parted mke2fs tune2fs grub || exit 1 +check_for_cmds losetup parted mke2fs tune2fs || exit 1 +if [ "$SKIP_GRUB" != "y" ]; then + check_for_cmds grub || exit 1 +fi # create image's /etc/fstab if [ ! -f ./configs/${CONFIG_TYPE}/fstab-ext3 ]; then @@ -285,3 +308,5 @@ mk_ext3_fs ${IMG_NAME} ${ROOT_DIR} #mount ${IMG_NAME}.ext3 $MOUNT_POINT -o loop,offset=$OS_PART1_BEGIN -t ext3 #cp -r "$ROOT_DIR"/* $MOUNT_POINT #umount $MOUNT_POINT + +exit 0