]> spindle.queued.net Git - xodist/blobdiff - mkext3.sh
rework boot script for usb key to nand installer
[xodist] / mkext3.sh
index 37cec9949073629476083c3f6ccc41f55a3648c0..09501a241ef2fca5d81443bc4da29dbf34d372a4 100755 (executable)
--- a/mkext3.sh
+++ b/mkext3.sh
@@ -94,11 +94,16 @@ 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
        for kern in ${mntpt}/boot/vmlinuz-*; do
                v=$(basename $kern | sed 's/vmlinuz-//')
+               if [ "${v}" = '*' ]; then
+                       echo "*** Error: no kernel images found in /boot!" 1>&2
+                       exit 1
+               fi
                cat >>${mntpt}/boot/grub/menu.lst<<EOF
 
 title          Debian GNU/Linux, kernel ${v}
@@ -107,11 +112,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<<EOF
+
+title           Debian GNU/Linux Installer
+root            (hd0,0)
+kernel          ${prefix}/vmlinuz-${v} root=LABEL=${label} ro installer
+initrd          ${prefix}/initrd.img-${v}
+boot
+EOF
+               fi
+
        done
 
        # grub-install is pretty broken, so we do this manually
        geom=`parted -s "$img" "unit chs" "print" | sed -ne 's/geometry: \([0-9]\+\),\([0-9]\+\),\([0-9]\+\)/:\1 \2 \3:/p' | cut -d: -f2`
-       grub --device-map=/dev/null <<EOF
+       grub --batch --device-map=/dev/null <<EOF
 device (hd0) $img
 geometry (hd0) $geom
 root (hd0,0)
@@ -214,6 +231,7 @@ usage()
        echo "" 1>&2
        echo "Options:" 1>&2
        echo "  --config-type <config>    directory name in configs/ to use" 1>&2
+       echo "  --help                    display this help screen" 1>&2
        echo "" 1>&2
        exit 1
 }
@@ -229,6 +247,9 @@ do
                }
                shift
                ;;
+       --help|-h)
+               usage
+               ;;
        *)
                ROOT_DIR="$1"
                shift
@@ -277,3 +298,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