dracut-init.sh: beautify instmods()

master
Harald Hoyer 2016-04-13 13:57:03 +02:00
parent fe6e0c23ad
commit 9bb030c5d8
1 changed files with 28 additions and 3 deletions

View File

@ -1001,22 +1001,47 @@ instmods() {
local _optional="-o" local _optional="-o"
local _silent local _silent
local _ret local _ret

[[ $no_kernel = yes ]] && return [[ $no_kernel = yes ]] && return

if [[ $1 = '-c' ]]; then if [[ $1 = '-c' ]]; then
_optional="" unset _optional
shift shift
fi fi
if [[ $1 = '-s' ]]; then if [[ $1 = '-s' ]]; then
_silent=1 _silent=1
shift shift
fi fi

if (($# == 0)); then if (($# == 0)); then
read -r -d '' -a args read -r -d '' -a args
set -- "${args[@]}" set -- "${args[@]}"
fi fi
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${_optional:+-o} ${_silent:+--silent} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
$DRACUT_INSTALL \
${initdir:+-D "$initdir"} \
${loginstall:+-L "$loginstall"} \
${hostonly:+-H} \
${omit_drivers:+-N "$omit_drivers"} \
${srcmods:+--kerneldir "$srcmods"} \
${_optional:+-o} \
${_silent:+--silent} \
-m "$@"
_ret=$? _ret=$?
(($_ret != 0)) && [[ -z "$_silent" ]] && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${_optional:+-o} ${_silent:+--silent} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
if (($_ret != 0)) && [[ -z "$_silent" ]]; then
derror "FAILED: " \
$DRACUT_INSTALL \
${initdir:+-D "$initdir"} \
${loginstall:+-L "$loginstall"} \
${hostonly:+-H} \
${omit_drivers:+-N "$omit_drivers"} \
${srcmods:+--kerneldir "$srcmods"} \
${_optional:+-o} \
${_silent:+--silent} \
-m "$@"
fi

[[ "$optional" ]] && return 0 [[ "$optional" ]] && return 0
return $_ret return $_ret
} }