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