]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
support/scripts/mkgrubimg: Change command-line option to `-c`
authorSergiu Moga <sergiu.moga@protonmail.com>
Sat, 20 May 2023 18:27:33 +0000 (21:27 +0300)
committerUnikraft <monkey@unikraft.io>
Fri, 11 Aug 2023 14:28:34 +0000 (14:28 +0000)
Change command-line option to `-c` to make it more intuitive.

Furthermore, make it so that the actual received argument is a file
containing the command-line.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #910

support/scripts/mkgrubimg

index 9ec4aca0016be51d6b91cb1b28f4273d3225c196..bcf65e9c9634f7fd8da8421df7348b88af338fa7 100755 (executable)
@@ -9,7 +9,7 @@ usage()
        echo "  -h                         Display help and exit"
        echo "  -f                         Output format (supported: iso)"
        echo "  -k                         Path to the Unikraft kernel image"
-       echo "  -a                         Kernel command-line parameters (optional)"
+       echo "  -c                         Kernel command-line parameters file (optional)"
        echo "  -i                         Path to initrd cpio file (optional)"
        exit 1
 }
@@ -39,12 +39,17 @@ mkgrubiso()
        fi
        cp "${OPTKERNELIMG}" "${BUILDDIR}/boot/" || exit 1
 
+       MBCMDL=
+       if [ -n "${OPTCMDLINE}" ]; then
+               MBCMDL=$(tr '\n' ' ' < "${OPTCMDLINE}")
+       fi
+
        cat >"${BUILDDIR}/boot/grub/grub.cfg" <<EOF
 set default=0
 set timeout=0
 
 menuentry "${OPTKERNELNAME}" {
-       multiboot /boot/${OPTKERNELNAME} /${OPTKERNELNAME} ${OPTCMDLINE}
+       multiboot /boot/${OPTKERNELNAME} /${OPTKERNELNAME} ${MBCMDL}
        ${GRUB_CFG_INITRD}
        boot
 }
@@ -59,7 +64,7 @@ EOF
 }
 
 # process options
-while getopts "hk:i:f:a:" OPT; do
+while getopts "hk:c:i:f:" OPT; do
        case "${OPT}" in
                h)
                        usage
@@ -70,7 +75,7 @@ while getopts "hk:i:f:a:" OPT; do
                k)
                        OPTKERNELIMG="${OPTARG}"
                        ;;
-               a)
+               c)
                        OPTCMDLINE="${OPTARG}"
                        ;;
                i)