From 913a8039c3108c8d642ee05ddb42627f734e1207b51b41d878a8221d2d6c9af5 Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Tue, 8 Oct 2013 19:00:45 +0000 Subject: [PATCH 1/2] OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=70 --- dracut.changes | 7 +++++++ dracut.spec | 3 +++ mkinitrd-fix-boot-dir-detection.patch | 17 +++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 mkinitrd-fix-boot-dir-detection.patch diff --git a/dracut.changes b/dracut.changes index 5da585f..b8794ea 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Oct 8 18:59:30 UTC 2013 - tittiatcoke@gmail.com + +- Fix again the mkinitrd script as that people don't seem to test. + Added mkinitrd-fix-boot-dir-detection.patch so that an initrd + is created. + ------------------------------------------------------------------- Mon Oct 7 08:58:00 UTC 2013 - trenn@suse.de diff --git a/dracut.spec b/dracut.spec index b84754b..90c7c97 100644 --- a/dracut.spec +++ b/dracut.spec @@ -48,6 +48,8 @@ Patch3: use_all_paths_udev.patch Patch4: suse_only_logger.patch # PATCH-FIX-OPENSUSE Call the update-bootloader after dracut finished creating the initrd - tittiatcoke@gmail.com Patch5: mkinitrd_update_bootloader.diff +# PATCH-FIX-OPENSUSE Validate the initrd parameter first, before just blindly add the boot_dir parameter in front of it +Patch6: mkinitrd-fix-boot-dir-detection.patch BuildRequires: bash BuildRequires: dash @@ -127,6 +129,7 @@ This package contains tools to assemble the local initrd and host configuration. %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 %build %configure\ diff --git a/mkinitrd-fix-boot-dir-detection.patch b/mkinitrd-fix-boot-dir-detection.patch new file mode 100644 index 0000000..9b6d231 --- /dev/null +++ b/mkinitrd-fix-boot-dir-detection.patch @@ -0,0 +1,17 @@ +diff -urNB dracut-033/mkinitrd-dracut.sh new/mkinitrd-dracut.sh +--- dracut-033/mkinitrd-dracut.sh 2013-10-04 13:57:15.000000000 +0200 ++++ new/mkinitrd-dracut.sh 2013-10-08 20:55:59.280035248 +0200 +@@ -172,7 +172,12 @@ + ;; + -i) read_arg initrd_images "$@" || shift $? + for initrd_image in $initrd_images;do +- targets="$targets $boot_dir/$initrd_image" ++ case $initrd_image in ++ "$boot_dir"*) ++ targets="$targets $initrd_image";; ++ *) ++ targets="$targets $boot_dir/$initrd_image";; ++ esac + done + ;; + *) if [[ ! $targets ]]; then From a53fb0ad6d913df50888febed08bdc0cffbbf71e67b705eb4315ea01003b1e75 Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Tue, 8 Oct 2013 19:02:42 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=71 --- mkinitrd_allow_multiple_args.patch | 103 ----------------------------- 1 file changed, 103 deletions(-) delete mode 100644 mkinitrd_allow_multiple_args.patch diff --git a/mkinitrd_allow_multiple_args.patch b/mkinitrd_allow_multiple_args.patch deleted file mode 100644 index 333f881..0000000 --- a/mkinitrd_allow_multiple_args.patch +++ /dev/null @@ -1,103 +0,0 @@ -mkinitrd-dracut.sh: Enhance param parsing: Allow multiple arguments per param - -Currently --with parameter had to be passed as: --with="mod1 mod2". -Now one can pass: --with "mod1 mod2" or even --with mod1 mod2. - -Signed-off-by: Thomas Renninger - -diff --git a/mkinitrd-dracut.sh b/mkinitrd-dracut.sh -index ace7725..d8e92f3 100755 ---- a/mkinitrd-dracut.sh -+++ b/mkinitrd-dracut.sh -@@ -26,36 +26,43 @@ read_arg() { - # $1 = arg name - # $2 = arg value - # $3 = arg parameter -- local rematch='^[^=]*=(.*)$' -+ param="$1" -+ local rematch='^[^=]*=(.*)$' result - if [[ $2 =~ $rematch ]]; then -- read "$1" <<< "${BASH_REMATCH[1]}" -- elif [[ $3 != -* ]]; then -- # Only read next arg if it not an arg itself. -- read "$1" <<< "$3" -- # There is no way to shift our callers args, so -- # return 1 to indicate they should do it instead. -- return 1 -+ read "$param" <<< "${BASH_REMATCH[1]}" -+ else -+ for ((i=3; $i <= $#; i++)); do -+ # Only read next arg if it not an arg itself. -+ if [[ ${@:$i:1} = -* ]];then -+ break -+ fi -+ result="$result ${@:$i:1}" -+ # There is no way to shift our callers args, so -+ # return "no of args" to indicate they should do it instead. -+ done -+ read "$1" <<< "$result" -+ return $(($i - 3)) - fi - } - - while (($# > 0)); do - case ${1%%=*} in -- --with-usb) read_arg usbmodule "$@" || shift -+ --with-usb) read_arg usbmodule "$@" || shift $? - basicmodules="$basicmodules ${usbmodule:-usb-storage}" - unset usbmodule;; -- --with-avail) read_arg modname "$@" || shift -+ --with-avail) read_arg modname "$@" || shift $? - basicmodules="$basicmodules $modname";; -- --with) read_arg modname "$@" || shift -+ --with) read_arg modname "$@" || shift $? - basicmodules="$basicmodules $modname";; - --version) - echo "mkinitrd: dracut compatibility wrapper" - exit 0;; - -v|--verbose) dracut_args="${dracut_args} -v";; - -f|--force) dracut_args="${dracut_args} -f";; -- --preload) read_arg modname "$@" || shift -+ --preload) read_arg modname "$@" || shift $? - basicmodules="$basicmodules $modname";; - --image-version) img_vers=yes;; -- --rootfs) read_arg rootfs "$@" || shift -+ --rootfs) read_arg rootfs "$@" || shift $? - dracut_args="${dracut_args} --filesystems $rootfs";; - --nocompress) dracut_args="$dracut_args --no-compress";; - --help) usage -n;; -@@ -82,24 +89,29 @@ while (($# > 0)); do - --looppath*) ;; - --dsdt*) ;; - --bootchart) ;; -- -b) read_arg boot_dir "$@" || shift -+ -b) read_arg boot_dir "$@" || shift $? - if [ ! -d $boot_dir ];then - error "Boot directory $boot_dir does not exist" - exit 1 - fi - ;; - -k) # Would be nice to get a list of images here -- read_arg kernel_images "$@" || shift -+ read_arg kernel_images "$@" || shift $? - for kernel_image in $kernel_images;do - kernels="$kernels ${kernel_image#*-}" - done - ;; -- -i) read_arg initrd_images "$@" || shift -+ -i) read_arg initrd_images "$@" || shift $? - for initrd_image in $initrd_images;do -- targets="$targets $boot_dir/$initrd_images" -+ case $initrd_image in -+ "$boot_dir"*) -+ targets="$targets $initrd_image";; -+ *) -+ targets="$targets $boot_dir/$initrd_image";; -+ esac - done - ;; -- *) if [[ ! $targets ]]; then -+ *) if [[ ! $targets ]]; then - targets=$1 - elif [[ ! $kernels ]]; then - kernels=$1