dracut.sh: reduce code

master
Harald Hoyer 2015-07-09 18:02:44 +02:00
parent 32de4eb5d3
commit cb0913db0d
1 changed files with 18 additions and 62 deletions

View File

@ -674,55 +674,21 @@ done
export PATH="${NPATH#:}" export PATH="${NPATH#:}"
unset NPATH unset NPATH


# these optins add to the stuff in the config file # these options add to the stuff in the config file
if (( ${#add_dracutmodules_l[@]} )); then (( ${#add_dracutmodules_l[@]} )) && add_dracutmodules+=" ${add_dracutmodules_l[@]} "
add_dracutmodules+=" ${add_dracutmodules_l[@]} " (( ${#force_add_dracutmodules_l[@]} )) && force_add_dracutmodules+=" ${force_add_dracutmodules_l[@]} "
fi (( ${#fscks_l[@]} )) && fscks+=" ${fscks_l[@]} "

(( ${#add_fstab_l[@]} )) && add_fstab+=" ${add_fstab_l[@]} "
if (( ${#force_add_dracutmodules_l[@]} )); then (( ${#fstab_lines_l[@]} )) && fstab_lines+=( "${fstab_lines_l[@]}" )
force_add_dracutmodules+=" ${force_add_dracutmodules_l[@]} " (( ${#install_items_l[@]} )) && install_items+=" ${install_items_l[@]} "
fi (( ${#install_optional_items_l[@]} )) && install_optional_items+=" ${install_optional_items_l[@]} "

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 override the stuff in the config file # these options override the stuff in the config file
if (( ${#dracutmodules_l[@]} )); then (( ${#dracutmodules_l[@]} )) && dracutmodules="${dracutmodules_l[@]}"
dracutmodules="${dracutmodules_l[@]}" (( ${#omit_dracutmodules_l[@]} )) && omit_dracutmodules="${omit_dracutmodules_l[@]}"
fi (( ${#filesystems_l[@]} )) && filesystems="${filesystems_l[@]}"

(( ${#fw_dir_l[@]} )) && fw_dir="${fw_dir_l[@]}"
if (( ${#omit_dracutmodules_l[@]} )); then (( ${#libdirs_l[@]} ))&& libdirs="${libdirs_l[@]}"
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


[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l [[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
[[ ! $stdloglvl ]] && stdloglvl=4 [[ ! $stdloglvl ]] && stdloglvl=4
@ -870,29 +836,19 @@ fi
dracutfunctions=$dracutbasedir/dracut-functions.sh dracutfunctions=$dracutbasedir/dracut-functions.sh
export dracutfunctions export dracutfunctions


if (( ${#drivers_l[@]} )); then (( ${#drivers_l[@]} )) && drivers="${drivers_l[@]}"
drivers="${drivers_l[@]}"
fi
drivers=${drivers/-/_} drivers=${drivers/-/_}


if (( ${#add_drivers_l[@]} )); then (( ${#add_drivers_l[@]} )) && add_drivers+=" ${add_drivers_l[@]} "
add_drivers+=" ${add_drivers_l[@]} "
fi
add_drivers=${add_drivers/-/_} add_drivers=${add_drivers/-/_}


if (( ${#force_drivers_l[@]} )); then (( ${#force_drivers_l[@]} )) && force_drivers+=" ${force_drivers_l[@]} "
force_drivers+=" ${force_drivers_l[@]} "
fi
force_drivers=${force_drivers/-/_} force_drivers=${force_drivers/-/_}


if (( ${#omit_drivers_l[@]} )); then (( ${#omit_drivers_l[@]} )) && omit_drivers+=" ${omit_drivers_l[@]} "
omit_drivers+=" ${omit_drivers_l[@]} "
fi
omit_drivers=${omit_drivers/-/_} omit_drivers=${omit_drivers/-/_}


if (( ${#kernel_cmdline_l[@]} )); then (( ${#kernel_cmdline_l[@]} )) && kernel_cmdline+=" ${kernel_cmdline_l[@]} "
kernel_cmdline+=" ${kernel_cmdline_l[@]} "
fi


omit_drivers_corrected="" omit_drivers_corrected=""
for d in $omit_drivers; do for d in $omit_drivers; do