118 lines
3.6 KiB
Diff
118 lines
3.6 KiB
Diff
From cb0913db0d23bb0880e525e5cb3d7a179b0c7a20 Mon Sep 17 00:00:00 2001
|
|
From: Harald Hoyer <harald@redhat.com>
|
|
Date: Thu, 9 Jul 2015 18:02:44 +0200
|
|
Subject: [PATCH] dracut.sh: reduce code
|
|
|
|
---
|
|
dracut.sh | 80 ++++++++++++++-------------------------------------------------
|
|
1 file changed, 18 insertions(+), 62 deletions(-)
|
|
|
|
diff --git a/dracut.sh b/dracut.sh
|
|
index fc84a41..21d29bf 100755
|
|
--- a/dracut.sh
|
|
+++ b/dracut.sh
|
|
@@ -674,55 +674,21 @@ done
|
|
export PATH="${NPATH#:}"
|
|
unset NPATH
|
|
|
|
-# these optins add to the stuff in the config file
|
|
-if (( ${#add_dracutmodules_l[@]} )); then
|
|
- add_dracutmodules+=" ${add_dracutmodules_l[@]} "
|
|
-fi
|
|
-
|
|
-if (( ${#force_add_dracutmodules_l[@]} )); then
|
|
- force_add_dracutmodules+=" ${force_add_dracutmodules_l[@]} "
|
|
-fi
|
|
-
|
|
-if (( ${#fscks_l[@]} )); then
|
|
- fscks+=" ${fscks_l[@]} "
|
|
-fi
|
|
-
|
|
-if (( ${#add_fstab_l[@]} )); then
|
|
- add_fstab+=" ${add_fstab_l[@]} "
|
|
-fi
|
|
-
|
|
-if (( ${#fstab_lines_l[@]} )); then
|
|
- fstab_lines+=( "${fstab_lines_l[@]}" )
|
|
-fi
|
|
-
|
|
-if (( ${#install_items_l[@]} )); then
|
|
- install_items+=" ${install_items_l[@]} "
|
|
-fi
|
|
-
|
|
-if (( ${#install_optional_items_l[@]} )); then
|
|
- install_optional_items+=" ${install_optional_items_l[@]} "
|
|
-fi
|
|
+# these options add to the stuff in the config file
|
|
+(( ${#add_dracutmodules_l[@]} )) && add_dracutmodules+=" ${add_dracutmodules_l[@]} "
|
|
+(( ${#force_add_dracutmodules_l[@]} )) && force_add_dracutmodules+=" ${force_add_dracutmodules_l[@]} "
|
|
+(( ${#fscks_l[@]} )) && fscks+=" ${fscks_l[@]} "
|
|
+(( ${#add_fstab_l[@]} )) && add_fstab+=" ${add_fstab_l[@]} "
|
|
+(( ${#fstab_lines_l[@]} )) && fstab_lines+=( "${fstab_lines_l[@]}" )
|
|
+(( ${#install_items_l[@]} )) && install_items+=" ${install_items_l[@]} "
|
|
+(( ${#install_optional_items_l[@]} )) && install_optional_items+=" ${install_optional_items_l[@]} "
|
|
|
|
# these options override the stuff in the config file
|
|
-if (( ${#dracutmodules_l[@]} )); then
|
|
- dracutmodules="${dracutmodules_l[@]}"
|
|
-fi
|
|
-
|
|
-if (( ${#omit_dracutmodules_l[@]} )); then
|
|
- omit_dracutmodules="${omit_dracutmodules_l[@]}"
|
|
-fi
|
|
-
|
|
-if (( ${#filesystems_l[@]} )); then
|
|
- filesystems="${filesystems_l[@]}"
|
|
-fi
|
|
-
|
|
-if (( ${#fw_dir_l[@]} )); then
|
|
- fw_dir="${fw_dir_l[@]}"
|
|
-fi
|
|
-
|
|
-if (( ${#libdirs_l[@]} )); then
|
|
- libdirs="${libdirs_l[@]}"
|
|
-fi
|
|
+(( ${#dracutmodules_l[@]} )) && dracutmodules="${dracutmodules_l[@]}"
|
|
+(( ${#omit_dracutmodules_l[@]} )) && omit_dracutmodules="${omit_dracutmodules_l[@]}"
|
|
+(( ${#filesystems_l[@]} )) && filesystems="${filesystems_l[@]}"
|
|
+(( ${#fw_dir_l[@]} )) && fw_dir="${fw_dir_l[@]}"
|
|
+(( ${#libdirs_l[@]} ))&& libdirs="${libdirs_l[@]}"
|
|
|
|
[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
|
|
[[ ! $stdloglvl ]] && stdloglvl=4
|
|
@@ -870,29 +836,19 @@ fi
|
|
dracutfunctions=$dracutbasedir/dracut-functions.sh
|
|
export dracutfunctions
|
|
|
|
-if (( ${#drivers_l[@]} )); then
|
|
- drivers="${drivers_l[@]}"
|
|
-fi
|
|
+(( ${#drivers_l[@]} )) && drivers="${drivers_l[@]}"
|
|
drivers=${drivers/-/_}
|
|
|
|
-if (( ${#add_drivers_l[@]} )); then
|
|
- add_drivers+=" ${add_drivers_l[@]} "
|
|
-fi
|
|
+(( ${#add_drivers_l[@]} )) && add_drivers+=" ${add_drivers_l[@]} "
|
|
add_drivers=${add_drivers/-/_}
|
|
|
|
-if (( ${#force_drivers_l[@]} )); then
|
|
- force_drivers+=" ${force_drivers_l[@]} "
|
|
-fi
|
|
+(( ${#force_drivers_l[@]} )) && force_drivers+=" ${force_drivers_l[@]} "
|
|
force_drivers=${force_drivers/-/_}
|
|
|
|
-if (( ${#omit_drivers_l[@]} )); then
|
|
- omit_drivers+=" ${omit_drivers_l[@]} "
|
|
-fi
|
|
+(( ${#omit_drivers_l[@]} )) && omit_drivers+=" ${omit_drivers_l[@]} "
|
|
omit_drivers=${omit_drivers/-/_}
|
|
|
|
-if (( ${#kernel_cmdline_l[@]} )); then
|
|
- kernel_cmdline+=" ${kernel_cmdline_l[@]} "
|
|
-fi
|
|
+(( ${#kernel_cmdline_l[@]} )) && kernel_cmdline+=" ${kernel_cmdline_l[@]} "
|
|
|
|
omit_drivers_corrected=""
|
|
for d in $omit_drivers; do
|