style: shfmt -s reformat
reproducible with: ``` $ shfmt_version=3.0.1 $ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt $ chmod u+x shfmt $ ./shfmt -w -s . ```master
parent
9a52c3fdb0
commit
75d758e8f1
|
@ -18,7 +18,7 @@
|
|||
__contains_word() {
|
||||
local word="$1"
|
||||
shift
|
||||
for w in "$@"; do [[ $w = "$word" ]] && return 0; done
|
||||
for w in "$@"; do [[ $w == "$word" ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ _dracut() {
|
|||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
if [[ $cur == -* ]]; then
|
||||
# shellcheck disable=SC2207
|
||||
# shellcheck disable=SC2016
|
||||
COMPREPLY=($(compgen -W '${OPTS[*]}' -- "$cur"))
|
||||
|
|
|
@ -22,16 +22,16 @@ export LC_MESSAGES=C
|
|||
# is_func <command>
|
||||
# Check whether $1 is a function.
|
||||
is_func() {
|
||||
[[ "$(type -t "$1")" = "function" ]]
|
||||
[[ "$(type -t "$1")" == "function" ]]
|
||||
}
|
||||
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 = *"$2"* ]]; }
|
||||
strstr() { [[ $1 == *"$2"* ]]; }
|
||||
# Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
|
||||
strglobin() { [[ $1 = *$2* ]]; }
|
||||
strglobin() { [[ $1 == *$2* ]]; }
|
||||
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
|
||||
# shellcheck disable=SC2053
|
||||
strglob() { [[ $1 = $2 ]]; }
|
||||
strglob() { [[ $1 == $2 ]]; }
|
||||
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
|
||||
str_starts() { [ "${1#"$2"*}" != "$1" ]; }
|
||||
# returns OK if $1 contains literal string $2 at the end, and isn't empty
|
||||
|
@ -46,7 +46,7 @@ find_binary() {
|
|||
local p
|
||||
[[ -z ${1##/*} ]] || _delim="/"
|
||||
|
||||
if [[ "$1" == *.so* ]]; then
|
||||
if [[ $1 == *.so* ]]; then
|
||||
# shellcheck disable=SC2154
|
||||
for l in $libdirs; do
|
||||
_path="${l}${_delim}${1}"
|
||||
|
@ -61,7 +61,7 @@ find_binary() {
|
|||
return 0
|
||||
fi
|
||||
fi
|
||||
if [[ "$1" == */* ]]; then
|
||||
if [[ $1 == */* ]]; then
|
||||
_path="${_delim}${1}"
|
||||
if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
|
||||
printf "%s\n" "${_path}"
|
||||
|
@ -76,7 +76,7 @@ find_binary() {
|
|||
fi
|
||||
done
|
||||
|
||||
[[ -n "$dracutsysrootdir" ]] && return 1
|
||||
[[ -n $dracutsysrootdir ]] && return 1
|
||||
type -P "${1##*/}"
|
||||
}
|
||||
|
||||
|
@ -163,13 +163,13 @@ convert_abs_rel() {
|
|||
set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
|
||||
|
||||
# corner case #1 - self looping link
|
||||
[[ "$1" == "$2" ]] && {
|
||||
[[ $1 == "$2" ]] && {
|
||||
printf "%s\n" "${1##*/}"
|
||||
return
|
||||
}
|
||||
|
||||
# corner case #2 - own dir link
|
||||
[[ "${1%/*}" == "$2" ]] && {
|
||||
[[ ${1%/*} == "$2" ]] && {
|
||||
printf ".\n"
|
||||
return
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ convert_abs_rel() {
|
|||
__abssize=${#__absolute[@]}
|
||||
__cursize=${#__current[@]}
|
||||
|
||||
while [[ "${__absolute[__level]}" == "${__current[__level]}" ]]; do
|
||||
while [[ ${__absolute[__level]} == "${__current[__level]}" ]]; do
|
||||
((__level++))
|
||||
if ((__level > __abssize || __level > __cursize)); then
|
||||
break
|
||||
|
@ -214,7 +214,7 @@ get_fs_env() {
|
|||
unset ID_FS_TYPE
|
||||
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
|
||||
| while read line || [ -n "$line" ]; do
|
||||
if [[ "$line" == TYPE\=* ]]; then
|
||||
if [[ $line == TYPE\=* ]]; then
|
||||
printf "%s" "${line#TYPE=}"
|
||||
exit 0
|
||||
fi
|
||||
|
@ -244,8 +244,8 @@ get_devpath_block() {
|
|||
_majmin=$(get_maj_min "$1")
|
||||
|
||||
for _i in /sys/block/*/dev /sys/block/*/*/dev; do
|
||||
[[ -e "$_i" ]] || continue
|
||||
if [[ "$_majmin" == "$(< "$_i")" ]]; then
|
||||
[[ -e $_i ]] || continue
|
||||
if [[ $_majmin == "$(< "$_i")" ]]; then
|
||||
printf "%s" "${_i%/dev}"
|
||||
return 0
|
||||
fi
|
||||
|
@ -260,7 +260,7 @@ get_persistent_dev() {
|
|||
_dev=$(get_maj_min "$1")
|
||||
[ -z "$_dev" ] && return
|
||||
|
||||
if [[ -n "$persistent_policy" ]]; then
|
||||
if [[ -n $persistent_policy ]]; then
|
||||
_pol="/dev/disk/${persistent_policy}/*"
|
||||
else
|
||||
_pol=
|
||||
|
@ -275,7 +275,7 @@ get_persistent_dev() {
|
|||
/dev/disk/by-partlabel/* \
|
||||
/dev/disk/by-id/* \
|
||||
/dev/disk/by-path/*; do
|
||||
[[ -e "$i" ]] || continue
|
||||
[[ -e $i ]] || continue
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
[[ $i == /dev/mapper/mpath* ]] && continue
|
||||
_tmp=$(get_maj_min "$i")
|
||||
|
@ -361,7 +361,7 @@ find_block_device() {
|
|||
fi
|
||||
return 0
|
||||
fi
|
||||
if [[ $_dev = *:* ]]; then
|
||||
if [[ $_dev == *:* ]]; then
|
||||
printf "%s\n" "$_dev"
|
||||
return 0
|
||||
fi
|
||||
|
@ -386,7 +386,7 @@ find_block_device() {
|
|||
fi
|
||||
return 0
|
||||
fi
|
||||
if [[ $_dev = *:* ]]; then
|
||||
if [[ $_dev == *:* ]]; then
|
||||
printf "%s\n" "$_dev"
|
||||
return 0
|
||||
fi
|
||||
|
@ -412,7 +412,7 @@ find_mp_fstype() {
|
|||
findmnt -e -v -n -o 'FSTYPE' --target "$1" | {
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
[[ $_fs == "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
return 0
|
||||
done
|
||||
|
@ -423,7 +423,7 @@ find_mp_fstype() {
|
|||
findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | {
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
[[ $_fs == "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
return 0
|
||||
done
|
||||
|
@ -444,7 +444,7 @@ find_mp_fstype() {
|
|||
find_dev_fstype() {
|
||||
local _find_dev _fs
|
||||
_find_dev="$1"
|
||||
if ! [[ "$_find_dev" = /dev* ]]; then
|
||||
if ! [[ $_find_dev == /dev* ]]; then
|
||||
[[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
|
||||
fi
|
||||
|
||||
|
@ -452,7 +452,7 @@ find_dev_fstype() {
|
|||
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
[[ $_fs == "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
return 0
|
||||
done
|
||||
|
@ -463,7 +463,7 @@ find_dev_fstype() {
|
|||
findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
|
||||
while read _fs || [ -n "$_fs" ]; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
[[ $_fs == "autofs" ]] && continue
|
||||
printf "%s" "$_fs"
|
||||
return 0
|
||||
done
|
||||
|
@ -501,7 +501,7 @@ find_mp_fsopts() {
|
|||
find_dev_fsopts() {
|
||||
local _find_dev
|
||||
_find_dev="$1"
|
||||
if ! [[ "$_find_dev" = /dev* ]]; then
|
||||
if ! [[ $_find_dev == /dev* ]]; then
|
||||
[[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
|
||||
fi
|
||||
|
||||
|
@ -583,7 +583,7 @@ for_each_host_dev_and_slaves_all() {
|
|||
[[ "${host_devs[*]}" ]] || return 2
|
||||
|
||||
for _dev in "${host_devs[@]}"; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
[[ -b $_dev ]] || continue
|
||||
if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
|
||||
_ret=0
|
||||
fi
|
||||
|
@ -598,7 +598,7 @@ for_each_host_dev_and_slaves() {
|
|||
[[ "${host_devs[*]}" ]] || return 2
|
||||
|
||||
for _dev in "${host_devs[@]}"; do
|
||||
[[ -b "$_dev" ]] || continue
|
||||
[[ -b $_dev ]] || continue
|
||||
check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
|
||||
done
|
||||
return 1
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
export LC_MESSAGES=C
|
||||
|
||||
if [[ "$EUID" = "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
|
||||
if [[ $EUID == "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
|
||||
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
|
||||
else
|
||||
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
|
||||
|
@ -28,12 +28,12 @@ fi
|
|||
# is_func <command>
|
||||
# Check whether $1 is a function.
|
||||
is_func() {
|
||||
[[ "$(type -t "$1")" = "function" ]]
|
||||
[[ "$(type -t "$1")" == "function" ]]
|
||||
}
|
||||
|
||||
if ! [[ $dracutbasedir ]]; then
|
||||
dracutbasedir=${BASH_SOURCE[0]%/*}
|
||||
[[ $dracutbasedir = dracut-functions* ]] && dracutbasedir="."
|
||||
[[ $dracutbasedir == dracut-functions* ]] && dracutbasedir="."
|
||||
[[ $dracutbasedir ]] || dracutbasedir="."
|
||||
dracutbasedir="$(readlink -f $dracutbasedir)"
|
||||
fi
|
||||
|
@ -114,7 +114,7 @@ require_binaries() {
|
|||
local _module_name="${moddir##*/}"
|
||||
local _ret=0
|
||||
|
||||
if [[ "$1" = "-m" ]]; then
|
||||
if [[ $1 == "-m" ]]; then
|
||||
_module_name="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
@ -132,7 +132,7 @@ require_any_binary() {
|
|||
local _module_name="${moddir##*/}"
|
||||
local _ret=1
|
||||
|
||||
if [[ "$1" = "-m" ]]; then
|
||||
if [[ $1 == "-m" ]]; then
|
||||
_module_name="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
@ -197,13 +197,13 @@ for i in $DRACUT_INSTALL; do
|
|||
DRINSTALLPARTS=$((DRINSTALLPARTS + 1))
|
||||
done
|
||||
|
||||
if [[ $DRINSTALLPARTS = 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1; then
|
||||
if [[ $DRINSTALLPARTS == 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1; then
|
||||
dfatal "dracut-install not found!"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
if [[ $hostonly == "-h" ]]; then
|
||||
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
|
||||
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f $DRACUT_KERNEL_MODALIASES ]]; then
|
||||
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
|
||||
"$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
|
||||
fi
|
||||
|
@ -219,7 +219,7 @@ inst_dir() {
|
|||
|
||||
inst() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
if [[ $1 == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
|
@ -232,7 +232,7 @@ inst() {
|
|||
|
||||
inst_simple() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
if [[ $1 == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
|
@ -245,7 +245,7 @@ inst_simple() {
|
|||
|
||||
inst_symlink() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
if [[ $1 == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
|
@ -275,7 +275,7 @@ dracut_instmods() {
|
|||
local _silent=0
|
||||
local i
|
||||
# shellcheck disable=SC2154
|
||||
[[ $no_kernel = yes ]] && return
|
||||
[[ $no_kernel == yes ]] && return
|
||||
for i in "$@"; do
|
||||
[[ $i == "--silent" ]] && _silent=1
|
||||
done
|
||||
|
@ -292,7 +292,7 @@ dracut_instmods() {
|
|||
|
||||
inst_library() {
|
||||
local _hostonly_install
|
||||
if [[ "$1" == "-H" ]]; then
|
||||
if [[ $1 == "-H" ]]; then
|
||||
_hostonly_install="-H"
|
||||
shift
|
||||
fi
|
||||
|
@ -328,7 +328,7 @@ inst_fsck_help() {
|
|||
# given modules.
|
||||
optional_hostonly() {
|
||||
# shellcheck disable=SC2154
|
||||
if [[ $hostonly_mode = "strict" ]]; then
|
||||
if [[ $hostonly_mode == "strict" ]]; then
|
||||
printf -- "%s" "$hostonly"
|
||||
else
|
||||
printf ""
|
||||
|
@ -382,7 +382,7 @@ inst_rule_programs() {
|
|||
# shellcheck disable=SC2154
|
||||
if [[ -x ${udevdir}/$_prog ]]; then
|
||||
_bin="${udevdir}"/$_prog
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
elif [[ ${_prog/\$env\{/} == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue
|
||||
|
@ -397,7 +397,7 @@ inst_rule_programs() {
|
|||
_bin=""
|
||||
if [[ -x ${udevdir}/$_prog ]]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then
|
||||
elif [[ ${_prog/\$env\{/} == "$_prog" ]] && [[ ${_prog} != "/sbin/initqueue" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue
|
||||
|
@ -412,7 +412,7 @@ inst_rule_programs() {
|
|||
_bin=""
|
||||
if [[ -x ${udevdir}/$_prog ]]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
elif [[ ${_prog/\$env\{/} == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue
|
||||
|
@ -554,7 +554,7 @@ inst_hook() {
|
|||
dfatal "Cannot install a hook ($3) that does not exist."
|
||||
dfatal "Aborting initrd creation."
|
||||
exit 1
|
||||
elif ! [[ "$hookdirs" == *$1* ]]; then
|
||||
elif ! [[ $hookdirs == *$1* ]]; then
|
||||
dfatal "No such hook type $1. Aborting initrd creation."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -577,7 +577,7 @@ inst_hook() {
|
|||
inst_any() {
|
||||
local to f
|
||||
|
||||
[[ $1 = '-d' ]] && to="$2" && shift 2
|
||||
[[ $1 == '-d' ]] && to="$2" && shift 2
|
||||
|
||||
for f in "$@"; do
|
||||
[[ -e $f ]] || continue
|
||||
|
@ -593,14 +593,14 @@ inst_any() {
|
|||
# -n <pattern> install matching files
|
||||
inst_libdir_file() {
|
||||
local -a _files
|
||||
if [[ "$1" == "-n" ]]; then
|
||||
if [[ $1 == "-n" ]]; then
|
||||
local _pattern=$2
|
||||
shift 2
|
||||
for _dir in $libdirs; do
|
||||
for _i in "$@"; do
|
||||
for _f in "$dracutsysrootdir$_dir"/$_i; do
|
||||
[[ "${_f#$dracutsysrootdir}" =~ $_pattern ]] || continue
|
||||
[[ -e "$_f" ]] && _files+=("${_f#$dracutsysrootdir}")
|
||||
[[ ${_f#$dracutsysrootdir} =~ $_pattern ]] || continue
|
||||
[[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
|
||||
done
|
||||
done
|
||||
done
|
||||
|
@ -608,7 +608,7 @@ inst_libdir_file() {
|
|||
for _dir in $libdirs; do
|
||||
for _i in "$@"; do
|
||||
for _f in "$dracutsysrootdir$_dir"/$_i; do
|
||||
[[ -e "$_f" ]] && _files+=("${_f#$dracutsysrootdir}")
|
||||
[[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
|
||||
done
|
||||
done
|
||||
done
|
||||
|
@ -635,7 +635,7 @@ inst_decompress() {
|
|||
|
||||
for _src in "$@"; do
|
||||
_cmd=$(get_decompress_cmd "${_src}")
|
||||
[[ -z "${_cmd}" ]] && return 1
|
||||
[[ -z ${_cmd} ]] && return 1
|
||||
inst_simple "${_src}"
|
||||
# Decompress with chosen tool. We assume that tool changes name e.g.
|
||||
# from 'name.gz' to 'name'.
|
||||
|
@ -839,10 +839,10 @@ check_mount() {
|
|||
ret=$?
|
||||
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
[[ $ret == 0 || $ret == 255 ]] || return 1
|
||||
else
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
if [[ $dracutmodules == all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check_mount "$_mod" "$_moddir" || return 1
|
||||
else
|
||||
|
@ -909,10 +909,10 @@ check_module() {
|
|||
ret=$?
|
||||
fi
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
[[ $ret == 0 || $ret == 255 ]] || return 1
|
||||
else
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
if [[ $dracutmodules == all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check "$_mod" 0 "$_moddir"
|
||||
ret=$?
|
||||
|
@ -1010,13 +1010,13 @@ instmods() {
|
|||
local _silent
|
||||
local _ret
|
||||
|
||||
[[ $no_kernel = yes ]] && return
|
||||
[[ $no_kernel == yes ]] && return
|
||||
|
||||
if [[ $1 = '-c' ]]; then
|
||||
if [[ $1 == '-c' ]]; then
|
||||
unset _optional
|
||||
shift
|
||||
fi
|
||||
if [[ $1 = '-s' ]]; then
|
||||
if [[ $1 == '-s' ]]; then
|
||||
_silent=1
|
||||
shift
|
||||
fi
|
||||
|
@ -1042,7 +1042,7 @@ instmods() {
|
|||
-m "$@"
|
||||
_ret=$?
|
||||
|
||||
if ((_ret != 0)) && [[ -z "$_silent" ]]; then
|
||||
if ((_ret != 0)) && [[ -z $_silent ]]; then
|
||||
derror "FAILED: " \
|
||||
"$DRACUT_INSTALL" \
|
||||
${initdir:+-D "$initdir"} \
|
||||
|
@ -1068,7 +1068,7 @@ else
|
|||
ln_r() {
|
||||
local _source=$1
|
||||
local _dest=$2
|
||||
[[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
|
||||
[[ -d ${_dest%/*} ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
|
||||
ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
|
||||
}
|
||||
fi
|
||||
|
@ -1081,17 +1081,17 @@ is_qemu_virtualized() {
|
|||
if ! vm=$(systemd-detect-virt --vm > /dev/null 2>&1); then
|
||||
return 255
|
||||
fi
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
[[ $vm == "qemu" ]] && return 0
|
||||
[[ $vm == "kvm" ]] && return 0
|
||||
[[ $vm == "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read -r vendor < "$i"
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Red Hat" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
[[ $vendor == "QEMU" ]] && return 0
|
||||
[[ $vendor == "Red Hat" ]] && return 0
|
||||
[[ $vendor == "Bochs" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ _do_dlog() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if ((lvl <= fileloglvl)) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
|
||||
if ((lvl <= fileloglvl)) && [[ -w $logfile ]] && [[ -f $logfile ]]; then
|
||||
echo "$lmsg" >> "$logfile"
|
||||
fi
|
||||
|
||||
|
|
136
dracut.sh
136
dracut.sh
|
@ -310,7 +310,7 @@ dropindirs_sort() {
|
|||
|
||||
for d in "$@"; do
|
||||
for i in "$d/"*"$suffix"; do
|
||||
if [[ -e "$i" ]]; then
|
||||
if [[ -e $i ]]; then
|
||||
printf "%s\n" "${i##*/}"
|
||||
fi
|
||||
done
|
||||
|
@ -928,11 +928,11 @@ for i in $DRACUT_PATH; do
|
|||
rl=$(readlink -f "$dracutsysrootdir$i")
|
||||
fi
|
||||
rl="${rl#$dracutsysrootdir}"
|
||||
if [[ "$NPATH" != *:$rl* ]]; then
|
||||
if [[ $NPATH != *:$rl* ]]; then
|
||||
NPATH+=":$rl"
|
||||
fi
|
||||
done
|
||||
[[ -z "$dracutsysrootdir" ]] && export PATH="${NPATH#:}"
|
||||
[[ -z $dracutsysrootdir ]] && export PATH="${NPATH#:}"
|
||||
unset NPATH
|
||||
|
||||
export SYSTEMCTL=${SYSTEMCTL:-systemctl}
|
||||
|
@ -965,11 +965,11 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
|||
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
|
||||
[[ $do_hardlink ]] || do_hardlink=yes
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $prefix == "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
|
||||
[[ $hostonly_mode_l ]] && hostonly_mode=$hostonly_mode_l
|
||||
[[ "$hostonly" == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
|
||||
[[ $hostonly == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
|
||||
# shellcheck disable=SC2034
|
||||
[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
|
||||
# shellcheck disable=SC2034
|
||||
|
@ -1008,12 +1008,12 @@ if ! [[ $outfile ]]; then
|
|||
|
||||
if [[ $uefi == "yes" ]]; then
|
||||
# shellcheck disable=SC2154
|
||||
if [[ -n "$uefi_secureboot_key" && -z "$uefi_secureboot_cert" ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
|
||||
if [[ -n $uefi_secureboot_key && -z $uefi_secureboot_cert ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
|
||||
dfatal "Need 'uefi_secureboot_key' and 'uefi_secureboot_cert' both to be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$uefi_secureboot_key" && -n "$uefi_secureboot_cert" ]] && ! command -v sbsign &> /dev/null; then
|
||||
if [[ -n $uefi_secureboot_key && -n $uefi_secureboot_cert ]] && ! command -v sbsign &> /dev/null; then
|
||||
dfatal "Need 'sbsign' to create a signed UEFI executable"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1055,8 +1055,8 @@ export DRACUT_FIRMWARE_PATH=${fw_dir// /:}
|
|||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
# check for logfile and try to create one if it doesn't exist
|
||||
if [[ -n "$logfile" ]]; then
|
||||
if [[ ! -f "$logfile" ]]; then
|
||||
if [[ -n $logfile ]]; then
|
||||
if [[ ! -f $logfile ]]; then
|
||||
if touch "$logfile"; then
|
||||
printf "%s\n" "dracut: touch $logfile failed." >&2
|
||||
fi
|
||||
|
@ -1075,11 +1075,11 @@ DRACUT_COMPRESS_ZSTD=${DRACUT_COMPRESS_ZSTD:-zstd}
|
|||
DRACUT_COMPRESS_LZ4=${DRACUT_COMPRESS_LZ4:-lz4}
|
||||
DRACUT_COMPRESS_CAT=${DRACUT_COMPRESS_CAT:-cat}
|
||||
|
||||
if [[ $_no_compress_l = "$DRACUT_COMPRESS_CAT" ]]; then
|
||||
if [[ $_no_compress_l == "$DRACUT_COMPRESS_CAT" ]]; then
|
||||
compress="$DRACUT_COMPRESS_CAT"
|
||||
fi
|
||||
|
||||
[[ $hostonly = yes ]] && hostonly="-h"
|
||||
[[ $hostonly == yes ]] && hostonly="-h"
|
||||
[[ $hostonly != "-h" ]] && unset hostonly
|
||||
|
||||
case $hostonly_mode in
|
||||
|
@ -1103,7 +1103,7 @@ case "${drivers_dir}" in
|
|||
'' | *lib/modules/${kernel} | *lib/modules/${kernel}/) ;;
|
||||
*)
|
||||
[[ "$DRACUT_KMODDIR_OVERRIDE" ]] || {
|
||||
printf "%s\n" "dracut: -k/--kmoddir path must contain \"lib/modules\" as a parent of your kernel module directory,"
|
||||
printf "%s\n" 'dracut: -k/--kmoddir path must contain "lib/modules" as a parent of your kernel module directory,'
|
||||
printf "%s\n" "dracut: or modules may not be placed in the correct location inside the initramfs."
|
||||
printf "%s\n" "dracut: was given: ${drivers_dir}"
|
||||
printf "%s\n" "dracut: expected: $(dirname "${drivers_dir}")/lib/modules/${kernel}"
|
||||
|
@ -1148,7 +1148,7 @@ readonly initdir="${DRACUT_TMPDIR}/initramfs"
|
|||
mkdir -p "$initdir"
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
if [[ $early_microcode = yes ]] || { [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; }; then
|
||||
if [[ $early_microcode == yes ]] || { [[ $acpi_override == yes ]] && [[ -d $acpi_table_dir ]]; }; then
|
||||
readonly early_cpio_dir="${DRACUT_TMPDIR}/earlycpio"
|
||||
mkdir "$early_cpio_dir"
|
||||
fi
|
||||
|
@ -1221,14 +1221,14 @@ unset omit_drivers_corrected
|
|||
|
||||
# prepare args for logging
|
||||
for ((i = 0; i < ${#dracut_args[@]}; i++)); do
|
||||
[[ "${dracut_args[$i]}" == *\ * ]] \
|
||||
[[ ${dracut_args[$i]} == *\ * ]] \
|
||||
&& dracut_args[$i]="\"${dracut_args[$i]}\""
|
||||
#" keep vim happy
|
||||
done
|
||||
|
||||
dinfo "Executing: $dracut_cmd ${dracut_args[*]}"
|
||||
|
||||
[[ $do_list = yes ]] && {
|
||||
[[ $do_list == yes ]] && {
|
||||
for mod in "$dracutbasedir"/modules.d/*; do
|
||||
[[ -d $mod ]] || continue
|
||||
[[ -e $mod/install || -e $mod/installkernel || -e \
|
||||
|
@ -1294,13 +1294,13 @@ if [[ ! $print_cmdline ]]; then
|
|||
outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
if [[ ! -d $outdir ]]; then
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
elif [[ ! -w $outdir ]]; then
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
elif [[ -f $outfile && ! -w $outfile ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1313,7 +1313,7 @@ if [[ ! $print_cmdline ]]; then
|
|||
loginstall=$(readlink -f "$loginstall")
|
||||
fi
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
if [[ $uefi == yes ]]; then
|
||||
if ! command -v objcopy &> /dev/null; then
|
||||
dfatal "Need 'objcopy' to create a UEFI executable"
|
||||
exit 1
|
||||
|
@ -1347,7 +1347,7 @@ if [[ ! $print_cmdline ]]; then
|
|||
|
||||
if ! [[ $kernel_image ]]; then
|
||||
for kernel_image in "$dracutsysrootdir/lib/modules/$kernel/vmlinuz" "$dracutsysrootdir/boot/vmlinuz-$kernel"; do
|
||||
[[ -s "$kernel_image" ]] || continue
|
||||
[[ -s $kernel_image ]] || continue
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
@ -1358,12 +1358,12 @@ if [[ ! $print_cmdline ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if [[ $acpi_override = yes ]] && ! (check_kernel_config CONFIG_ACPI_TABLE_UPGRADE || check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE); then
|
||||
if [[ $acpi_override == yes ]] && ! (check_kernel_config CONFIG_ACPI_TABLE_UPGRADE || check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE); then
|
||||
dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y or CONFIG_ACPI_TABLE_UPGRADE!=y"
|
||||
unset acpi_override
|
||||
fi
|
||||
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
if [[ $early_microcode == yes ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
if [[ $(get_cpu_vendor) == "AMD" ]]; then
|
||||
check_kernel_config CONFIG_MICROCODE_AMD || unset early_microcode
|
||||
|
@ -1421,7 +1421,7 @@ for line in "${fstab_lines[@]}"; do
|
|||
;;
|
||||
esac
|
||||
[ -z "$dev" ] && dwarn "Bad fstab entry $*" && continue
|
||||
if [[ "$3" == btrfs ]]; then
|
||||
if [[ $3 == btrfs ]]; then
|
||||
for i in $(btrfs_devs "$2"); do
|
||||
push_host_devs "$i"
|
||||
done
|
||||
|
@ -1446,7 +1446,7 @@ if ((${#add_device_l[@]})); then
|
|||
push_host_devs "${add_device_l[@]}"
|
||||
fi
|
||||
|
||||
if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||
if [[ $hostonly ]] && [[ $hostonly_default_device != "no" ]]; then
|
||||
# in hostonly mode, determine all devices, which have to be accessed
|
||||
# and examine them for filesystem types
|
||||
|
||||
|
@ -1470,11 +1470,11 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
|||
_dev=$(find_block_device "$mp")
|
||||
_bdev=$(readlink -f "/dev/block/$_dev")
|
||||
[[ -b $_bdev ]] && _dev=$_bdev
|
||||
[[ "$mp" == "/" ]] && root_devs+=("$_dev")
|
||||
[[ $mp == "/" ]] && root_devs+=("$_dev")
|
||||
push_host_devs "$_dev"
|
||||
if [[ $(find_mp_fstype "$mp") == btrfs ]]; then
|
||||
for i in $(btrfs_devs "$mp"); do
|
||||
[[ "$mp" == "/" ]] && root_devs+=("$i")
|
||||
[[ $mp == "/" ]] && root_devs+=("$i")
|
||||
push_host_devs "$i"
|
||||
done
|
||||
fi
|
||||
|
@ -1484,24 +1484,24 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
|||
if [[ -f /proc/swaps ]] && [[ -f $dracutsysrootdir/etc/fstab ]]; then
|
||||
while read -r dev type rest || [ -n "$dev" ]; do
|
||||
[[ -b $dev ]] || continue
|
||||
[[ "$type" == "partition" ]] || continue
|
||||
[[ $type == "partition" ]] || continue
|
||||
|
||||
while read -r _d _m _t _o _ || [ -n "$_d" ]; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ $_t != "swap" ]] && continue
|
||||
[[ $_m != "swap" ]] && [[ $_m != "none" ]] && continue
|
||||
[[ "$_o" == *noauto* ]] && continue
|
||||
[[ $_o == *noauto* ]] && continue
|
||||
_d=$(expand_persistent_dev "$_d")
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
[[ $_d -ef $dev ]] || continue
|
||||
|
||||
if [[ -f $dracutsysrootdir/etc/crypttab ]]; then
|
||||
while read -r _mapper _ _p _o || [ -n "$_mapper" ]; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
|
||||
[[ $_mapper == \#* ]] && continue
|
||||
[[ $_d -ef /dev/mapper/"$_mapper" ]] || continue
|
||||
[[ "$_o" ]] || _o="$_p"
|
||||
# skip entries with password files
|
||||
[[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2
|
||||
[[ $_p == /* ]] && [[ -f $_p ]] && continue 2
|
||||
# skip mkswap swap
|
||||
[[ $_o == *swap* ]] && continue 2
|
||||
done < "$dracutsysrootdir"/etc/crypttab
|
||||
|
@ -1518,15 +1518,15 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
|||
# collect all "x-initrd.mount" entries from /etc/fstab
|
||||
if [[ -f $dracutsysrootdir/etc/fstab ]]; then
|
||||
while read -r _d _m _t _o _ || [ -n "$_d" ]; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
[[ "$_o" != *x-initrd.mount* ]] && continue
|
||||
[[ $_o != *x-initrd.mount* ]] && continue
|
||||
_dev=$(expand_persistent_dev "$_d")
|
||||
_dev="$(readlink -f "$_dev")"
|
||||
[[ -b $_dev ]] || continue
|
||||
|
||||
push_host_devs "$_dev"
|
||||
if [[ "$_t" == btrfs ]]; then
|
||||
if [[ $_t == btrfs ]]; then
|
||||
for i in $(btrfs_devs "$_m"); do
|
||||
push_host_devs "$i"
|
||||
done
|
||||
|
@ -1561,11 +1561,11 @@ for dev in "${host_devs[@]}"; do
|
|||
done
|
||||
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
|
||||
[[ ${host_fs_types[$dev]} == "reiserfs" ]] || [[ ${host_fs_types[$dev]} == "xfs" ]] || continue
|
||||
rootopts=$(find_dev_fsopts "$dev")
|
||||
if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
|
||||
if [[ ${host_fs_types[$dev]} == "reiserfs" ]]; then
|
||||
journaldev=$(fs_get_option "$rootopts" "jdev")
|
||||
elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
|
||||
elif [[ ${host_fs_types[$dev]} == "xfs" ]]; then
|
||||
journaldev=$(fs_get_option "$rootopts" "logdev")
|
||||
fi
|
||||
if [[ $journaldev ]]; then
|
||||
|
@ -1794,7 +1794,7 @@ fi
|
|||
|
||||
if [[ $prefix ]]; then
|
||||
for d in bin etc lib sbin tmp usr var $libdirs; do
|
||||
[[ "$d" == */* ]] && continue
|
||||
[[ $d == */* ]] && continue
|
||||
ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
|
||||
done
|
||||
fi
|
||||
|
@ -1842,7 +1842,7 @@ if [[ $kernel_only != yes ]]; then
|
|||
# shellcheck disable=SC2174
|
||||
mkdir -m 0755 -p "${initdir}/lib/dracut/hooks/$_d"
|
||||
done
|
||||
if [[ "$EUID" = "0" ]]; then
|
||||
if [[ $EUID == "0" ]]; then
|
||||
[[ -c ${initdir}/dev/null ]] || mknod "${initdir}"/dev/null c 1 3
|
||||
[[ -c ${initdir}/dev/kmsg ]] || mknod "${initdir}"/dev/kmsg c 1 11
|
||||
[[ -c ${initdir}/dev/console ]] || mknod "${initdir}"/dev/console c 5 1
|
||||
|
@ -1857,8 +1857,8 @@ modules_loaded=" "
|
|||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}
|
||||
_d_mod=${_d_mod#[0-9][0-9]}
|
||||
[[ "$mods_to_load" == *\ $_d_mod\ * ]] || continue
|
||||
if [[ $show_modules = yes ]]; then
|
||||
[[ $mods_to_load == *\ $_d_mod\ * ]] || continue
|
||||
if [[ $show_modules == yes ]]; then
|
||||
printf "%s\n" "$_d_mod"
|
||||
else
|
||||
dinfo "*** Including module: $_d_mod ***"
|
||||
|
@ -1902,7 +1902,7 @@ dinfo "*** Including modules done ***"
|
|||
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
if [[ $hostonly_mode = "strict" ]]; then
|
||||
if [[ $hostonly_mode == "strict" ]]; then
|
||||
cp "$DRACUT_KERNEL_MODALIASES" "$initdir"/lib/dracut/hostonly-kernel-modules.txt
|
||||
fi
|
||||
|
||||
|
@ -1911,7 +1911,7 @@ if [[ $no_kernel != yes ]]; then
|
|||
hostonly='' instmods $drivers
|
||||
fi
|
||||
|
||||
if [[ -n "${add_drivers// /}" ]]; then
|
||||
if [[ -n ${add_drivers// /} ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
hostonly='' instmods -c $add_drivers
|
||||
fi
|
||||
|
@ -2015,11 +2015,11 @@ for ((i = 0; i < ${#include_src[@]}; i++)); do
|
|||
# symlinks to $prefix
|
||||
# Objectname is a file or a directory
|
||||
for objectname in "$src"/*; do
|
||||
[[ -e "$objectname" || -L "$objectname" ]] || continue
|
||||
if [[ -d "$objectname" ]]; then
|
||||
[[ -e $objectname || -L $objectname ]] || continue
|
||||
if [[ -d $objectname ]]; then
|
||||
# objectname is a directory, let's compute the final directory name
|
||||
object_destdir=${destdir}/${objectname#$src/}
|
||||
if ! [[ -e "$object_destdir" ]]; then
|
||||
if ! [[ -e $object_destdir ]]; then
|
||||
# shellcheck disable=SC2174
|
||||
mkdir -m 0755 -p "$object_destdir"
|
||||
chmod --reference="$objectname" "$object_destdir"
|
||||
|
@ -2037,14 +2037,14 @@ for ((i = 0; i < ${#include_src[@]}; i++)); do
|
|||
fi
|
||||
done
|
||||
|
||||
if [[ $do_hardlink = yes ]] && command -v hardlink > /dev/null; then
|
||||
if [[ $do_hardlink == yes ]] && command -v hardlink > /dev/null; then
|
||||
dinfo "*** Hardlinking files ***"
|
||||
hardlink "$initdir" 2>&1
|
||||
dinfo "*** Hardlinking files done ***"
|
||||
fi
|
||||
|
||||
# strip binaries
|
||||
if [[ $do_strip = yes ]]; then
|
||||
if [[ $do_strip == yes ]]; then
|
||||
# Prefer strip from elfutils for package size
|
||||
declare strip_cmd
|
||||
strip_cmd=$(command -v eu-strip)
|
||||
|
@ -2063,7 +2063,7 @@ for d in $(ldconfig_paths); do
|
|||
rmdir -p --ignore-fail-on-non-empty "$initdir/$d" > /dev/null 2>&1
|
||||
done
|
||||
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
if [[ $early_microcode == yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
|
||||
|
@ -2092,7 +2092,7 @@ if [[ $early_microcode = yes ]]; then
|
|||
break 2
|
||||
done
|
||||
for i in $_fwdir/$_fw/$_src; do
|
||||
[[ -e "$i" ]] || continue
|
||||
[[ -e $i ]] || continue
|
||||
# skip gpg files
|
||||
str_ends "$i" ".asc" && continue
|
||||
cat "$i" >> "$_dest_dir/${ucode_dest[$idx]}"
|
||||
|
@ -2119,7 +2119,7 @@ if [[ $early_microcode = yes ]]; then
|
|||
done
|
||||
fi
|
||||
|
||||
if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
|
||||
if [[ $acpi_override == yes ]] && [[ -d $acpi_table_dir ]]; then
|
||||
dinfo "*** Packaging ACPI tables to override BIOS provided ones ***"
|
||||
_dest_dir="$early_cpio_dir/d/kernel/firmware/acpi"
|
||||
mkdir -p "$_dest_dir"
|
||||
|
@ -2155,7 +2155,7 @@ if [[ $kernel_only != yes ]]; then
|
|||
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
|
||||
for _dir in $libdirs; do
|
||||
for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
|
||||
[[ -e "$_f" ]] || continue
|
||||
[[ -e $_f ]] || continue
|
||||
inst_libdir_file "libgcc_s.so*"
|
||||
break 2
|
||||
done
|
||||
|
@ -2165,7 +2165,7 @@ if [[ $kernel_only != yes ]]; then
|
|||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
for _dir in $libdirs; do
|
||||
for _f in "$dracutsysrootdir$_dir/libcrypto.so"*; do
|
||||
[[ -e "$_f" ]] || continue
|
||||
[[ -e $_f ]] || continue
|
||||
inst_libdir_file -o "libssl.so*"
|
||||
break 2
|
||||
done
|
||||
|
@ -2179,7 +2179,7 @@ if [[ $kernel_only != yes ]]; then
|
|||
[[ -f $f ]] && inst_simple "${f#$dracutsysrootdir}"
|
||||
done
|
||||
if ! $DRACUT_LDCONFIG -r "$initdir" -f /etc/ld.so.conf; then
|
||||
if [[ $EUID = 0 ]]; then
|
||||
if [[ $EUID == 0 ]]; then
|
||||
derror "ldconfig exited ungracefully"
|
||||
else
|
||||
derror "ldconfig might need uid=0 (root) for chroot()"
|
||||
|
@ -2195,7 +2195,7 @@ if dracut_module_included "squash"; then
|
|||
DRACUT_SQUASH_POST_INST=1 module_install "squash"
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
|
@ -2239,7 +2239,7 @@ fi
|
|||
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
if [[ $uefi == yes ]]; then
|
||||
readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
|
||||
mkdir -p "$uefi_outdir"
|
||||
fi
|
||||
|
@ -2255,9 +2255,9 @@ if [[ $DRACUT_REPRODUCIBLE ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
[[ "$EUID" != 0 ]] && cpio_owner="0:0"
|
||||
[[ $EUID != 0 ]] && cpio_owner="0:0"
|
||||
|
||||
if [[ $create_early_cpio = yes ]]; then
|
||||
if [[ $create_early_cpio == yes ]]; then
|
||||
echo 1 > "$early_cpio_dir/d/early_cpio"
|
||||
|
||||
if [[ $DRACUT_REPRODUCIBLE ]]; then
|
||||
|
@ -2285,7 +2285,7 @@ if ! [[ $compress ]]; then
|
|||
compress="$i"
|
||||
break
|
||||
done
|
||||
if [[ $compress = cat ]]; then
|
||||
if [[ $compress == cat ]]; then
|
||||
printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
|
||||
fi
|
||||
fi
|
||||
|
@ -2293,7 +2293,7 @@ fi
|
|||
# choose the right arguments for the compressor
|
||||
case $compress in
|
||||
bzip2 | lbzip2)
|
||||
if [[ "$compress" = lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &> /dev/null; then
|
||||
if [[ $compress == lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &> /dev/null; then
|
||||
compress="$DRACUT_COMPRESS_LBZIP2 -9"
|
||||
else
|
||||
compress="$DRACUT_COMPRESS_BZIP2 -9"
|
||||
|
@ -2306,7 +2306,7 @@ case $compress in
|
|||
compress="$DRACUT_COMPRESS_XZ --check=crc32 --lzma2=dict=1MiB -T0"
|
||||
;;
|
||||
gzip | pigz)
|
||||
if [[ "$compress" = pigz ]] || command -v "$DRACUT_COMPRESS_PIGZ" &> /dev/null; then
|
||||
if [[ $compress == pigz ]] || command -v "$DRACUT_COMPRESS_PIGZ" &> /dev/null; then
|
||||
compress="$DRACUT_COMPRESS_PIGZ -9 -n -T -R"
|
||||
elif command -v gzip &> /dev/null && $DRACUT_COMPRESS_GZIP --help 2>&1 | grep -q rsyncable; then
|
||||
compress="$DRACUT_COMPRESS_GZIP -n -9 --rsyncable"
|
||||
|
@ -2347,17 +2347,17 @@ fi
|
|||
|
||||
umask 077
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
if [[ $uefi == yes ]]; then
|
||||
if [[ $kernel_cmdline ]]; then
|
||||
echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
|
||||
elif [[ $hostonly_cmdline = yes ]] && [ -d "$initdir/etc/cmdline.d" ]; then
|
||||
elif [[ $hostonly_cmdline == yes ]] && [ -d "$initdir/etc/cmdline.d" ]; then
|
||||
for conf in "$initdir"/etc/cmdline.d/*.conf; do
|
||||
[ -e "$conf" ] || continue
|
||||
printf "%s " "$(< "$conf")" >> "$uefi_outdir/cmdline.txt"
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $kernel_cmdline ]] || [[ $hostonly_cmdline = yes && -d "$initdir/etc/cmdline.d" ]]; then
|
||||
if [[ $kernel_cmdline ]] || [[ $hostonly_cmdline == yes && -d "$initdir/etc/cmdline.d" ]]; then
|
||||
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
|
||||
dinfo "Using UEFI kernel cmdline:"
|
||||
dinfo "$(tr -d '\000' < "$uefi_outdir/cmdline.txt")"
|
||||
|
@ -2381,7 +2381,7 @@ if [[ $uefi = yes ]]; then
|
|||
--add-section .linux="$kernel_image" --change-section-vma .linux=0x2000000 \
|
||||
--add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
|
||||
"$uefi_stub" "${uefi_outdir}/linux.efi"; then
|
||||
if [[ -n "${uefi_secureboot_key}" && -n "${uefi_secureboot_cert}" ]]; then
|
||||
if [[ -n ${uefi_secureboot_key} && -n ${uefi_secureboot_cert} ]]; then
|
||||
if sbsign \
|
||||
--key "${uefi_secureboot_key}" \
|
||||
--cert "${uefi_secureboot_cert}" \
|
||||
|
@ -2428,7 +2428,7 @@ freeze_ok_for_btrfs() {
|
|||
mnt=$(stat -c %m -- "$1")
|
||||
uuid1=$(btrfs_uuid "$mnt")
|
||||
uuid2=$(btrfs_uuid "/")
|
||||
[[ "$uuid1" && "$uuid2" && "$uuid1" != "$uuid2" ]]
|
||||
[[ $uuid1 && $uuid2 && $uuid1 != "$uuid2" ]]
|
||||
}
|
||||
|
||||
freeze_ok_for_fstype() {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [[ -z "$DRACUT_TMPDIR" ]]; then
|
||||
if [[ -z $DRACUT_TMPDIR ]]; then
|
||||
echo "DRACUT_TMPDIR is unset, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
__contains_word() {
|
||||
local word="$1"
|
||||
shift
|
||||
for w in "$@"; do [[ $w = "$word" ]] && return 0; done
|
||||
for w in "$@"; do [[ $w == "$word" ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ _lsinitrd() {
|
|||
return 0
|
||||
fi
|
||||
|
||||
if [[ $cur = -* ]]; then
|
||||
if [[ $cur == -* ]]; then
|
||||
# shellcheck disable=SC2207
|
||||
# shellcheck disable=SC2016
|
||||
COMPREPLY=($(compgen -W '${OPTS[*]}' -- "$cur"))
|
||||
|
|
12
lsinitrd.sh
12
lsinitrd.sh
|
@ -99,7 +99,7 @@ done
|
|||
|
||||
if [[ $1 ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f "$image" ]]; then
|
||||
if ! [[ -f $image ]]; then
|
||||
{
|
||||
echo "$image does not exist"
|
||||
echo
|
||||
|
@ -129,7 +129,7 @@ while (($# > 0)); do
|
|||
shift
|
||||
done
|
||||
|
||||
if ! [[ -f "$image" ]]; then
|
||||
if ! [[ -f $image ]]; then
|
||||
{
|
||||
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
|
||||
echo
|
||||
|
@ -220,7 +220,7 @@ if [ "$bin" = "MZ" ]; then
|
|||
[ -f "$image" ] || exit 1
|
||||
fi
|
||||
|
||||
if ((${#filenames[@]} <= 0)) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then
|
||||
if ((${#filenames[@]} <= 0)) && [[ -z $unpack ]] && [[ -z $unpackearly ]]; then
|
||||
if [ -n "$uefi" ]; then
|
||||
echo -n "initrd in UEFI: $uefi: "
|
||||
du -h $image | while read a b || [ -n "$a" ]; do echo $a; done
|
||||
|
@ -254,10 +254,10 @@ case $bin in
|
|||
# Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
|
||||
[[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2> /dev/null)
|
||||
if [[ "$is_early" ]]; then
|
||||
if [[ -n "$unpack" ]]; then
|
||||
if [[ -n $unpack ]]; then
|
||||
# should use --unpackearly for early CPIO
|
||||
:
|
||||
elif [[ -n "$unpackearly" ]]; then
|
||||
elif [[ -n $unpackearly ]]; then
|
||||
unpack_files
|
||||
elif ((${#filenames[@]} > 0)); then
|
||||
extract_files
|
||||
|
@ -333,7 +333,7 @@ fi
|
|||
|
||||
ret=0
|
||||
|
||||
if [[ -n "$unpack" ]]; then
|
||||
if [[ -n $unpack ]]; then
|
||||
unpack_files
|
||||
elif ((${#filenames[@]} > 0)); then
|
||||
extract_files
|
||||
|
|
|
@ -9,7 +9,7 @@ force=0
|
|||
error() { echo "$@" >&2; }
|
||||
|
||||
usage() {
|
||||
[[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
[[ $1 == '-n' ]] && cmd=echo || cmd=error
|
||||
|
||||
$cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
|
||||
$cmd " [--image-version] [--with=<module>]"
|
||||
|
@ -18,7 +18,7 @@ usage() {
|
|||
$cmd ""
|
||||
$cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
|
||||
|
||||
[[ $1 = '-n' ]] && exit 0
|
||||
[[ $1 == '-n' ]] && exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -34,17 +34,17 @@ read_arg() {
|
|||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
for ((i = 3; $i <= $#; i++)); do
|
||||
for ((i = 3; i <= $#; i++)); do
|
||||
# Only read next arg if it not an arg itself.
|
||||
if [[ ${*:$i:1} = -* ]]; then
|
||||
if [[ ${*:i:1} == -* ]]; then
|
||||
break
|
||||
fi
|
||||
result="$result ${@:$i:1}"
|
||||
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))
|
||||
return $((i - 3))
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ targets=($targets)
|
|||
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
|
||||
|
||||
echo "Creating: target|kernel|dracut args|basicmodules "
|
||||
for ((i = 0; $i < ${#targets[@]}; i++)); do
|
||||
for ((i = 0; i < ${#targets[@]}; i++)); do
|
||||
|
||||
if [[ $img_vers ]]; then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
|
|
|
@ -26,7 +26,7 @@ dracut_cmd=dracut
|
|||
error() { echo "$@" >&2; }
|
||||
|
||||
usage() {
|
||||
[[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
[[ $1 == '-n' ]] && cmd=echo || cmd=error
|
||||
|
||||
$cmd "usage: ${0##*/} [options]"
|
||||
$cmd ""
|
||||
|
@ -37,27 +37,27 @@ usage() {
|
|||
$cmd " for the root file system, or a network interface driver module for dhcp."
|
||||
$cmd ""
|
||||
$cmd " options:"
|
||||
$cmd " -f \"feature list\" Features to be enabled when generating initrd."
|
||||
$cmd ' -f "feature list" Features to be enabled when generating initrd.'
|
||||
$cmd " Available features are:"
|
||||
$cmd " iscsi, md, multipath, lvm, lvm2,"
|
||||
$cmd " ifup, fcoe, dcbd"
|
||||
$cmd " -k \"kernel list\" List of kernel images for which initrd files are"
|
||||
$cmd ' -k "kernel list" List of kernel images for which initrd files are'
|
||||
$cmd " created. Defaults to all kernels found in /boot."
|
||||
$cmd " -i \"initrd list\" List of file names for the initrd; position have"
|
||||
$cmd " match to \"kernel list\". Defaults to all kernels"
|
||||
$cmd ' -i "initrd list" List of file names for the initrd; position have'
|
||||
$cmd ' match to "kernel list". Defaults to all kernels'
|
||||
$cmd " found in /boot."
|
||||
$cmd " -b boot_dir Boot directory. Defaults to /boot."
|
||||
$cmd " -t tmp_dir Temporary directory. Defaults to /var/tmp."
|
||||
$cmd " -M map System.map file to use."
|
||||
$cmd " -A Create a so called \"monster initrd\" which"
|
||||
$cmd ' -A Create a so called "monster initrd" which'
|
||||
$cmd " includes all features and modules possible."
|
||||
$cmd " -B Do not update bootloader configuration."
|
||||
$cmd " -v Verbose mode."
|
||||
$cmd " -L Disable logging."
|
||||
$cmd " -h This help screen."
|
||||
$cmd " -m \"module list\" Modules to include in initrd. Defaults to the"
|
||||
$cmd ' -m "module list" Modules to include in initrd. Defaults to the'
|
||||
$cmd " INITRD_MODULES variable in /etc/sysconfig/kernel"
|
||||
$cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the"
|
||||
$cmd ' -u "DomU module list" Modules to include in initrd. Defaults to the'
|
||||
$cmd " DOMU_INITRD_MODULES variable in"
|
||||
$cmd " /etc/sysconfig/kernel."
|
||||
$cmd " -d root_device Root device. Defaults to the device from"
|
||||
|
@ -69,7 +69,7 @@ usage() {
|
|||
$cmd " -a acpi_dsdt Obsolete, do not use."
|
||||
$cmd " -s size Add splash animation and bootscreen to initrd."
|
||||
|
||||
[[ $1 = '-n' ]] && exit 0
|
||||
[[ $1 == '-n' ]] && exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -85,17 +85,17 @@ read_arg() {
|
|||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
for ((i = 3; $i <= $#; i++)); do
|
||||
for ((i = 3; i <= $#; i++)); do
|
||||
# Only read next arg if it not an arg itself.
|
||||
if [[ ${*:$i:1} = -* ]]; then
|
||||
if [[ ${*:i:1} == -* ]]; then
|
||||
break
|
||||
fi
|
||||
result="$result ${@:$i:1}"
|
||||
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))
|
||||
return $((i - 3))
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ calc_netmask() {
|
|||
local prefix=$1
|
||||
|
||||
[ -z "$prefix" ] && return
|
||||
mask=$((0xffffffff << (32 - $prefix)))
|
||||
mask=$((0xffffffff << (32 - prefix)))
|
||||
byte1=$((mask >> 24))
|
||||
byte2=$((mask >> 16))
|
||||
byte3=$((mask >> 8))
|
||||
|
@ -137,7 +137,7 @@ is_xen_kernel() {
|
|||
|
||||
for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config; do
|
||||
test -r $cfg || continue
|
||||
grep -q "^CONFIG_XEN=y\$" $cfg
|
||||
grep -q '^CONFIG_XEN=y$' $cfg
|
||||
return
|
||||
done
|
||||
test $kversion != "${kversion%-xen*}"
|
||||
|
@ -146,7 +146,7 @@ is_xen_kernel() {
|
|||
|
||||
kernel_version_from_image() {
|
||||
local dir="${1%/*}/"
|
||||
[[ "$dir" != "$1" ]] || dir=""
|
||||
[[ $dir != "$1" ]] || dir=""
|
||||
local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
|
||||
echo kernel_image_gz="'$kernel_image_gz'" >&2
|
||||
|
||||
|
@ -337,7 +337,7 @@ shopt -s extglob
|
|||
|
||||
failed=""
|
||||
|
||||
for ((i = 0; $i < ${#targets[@]}; i++)); do
|
||||
for ((i = 0; i < ${#targets[@]}; i++)); do
|
||||
|
||||
if [[ $img_vers ]]; then
|
||||
target="${targets[$i]}-${kernels[$i]}"
|
||||
|
|
|
@ -40,8 +40,8 @@ installkernel() {
|
|||
install() {
|
||||
local _mods
|
||||
|
||||
if [[ "$prefix" == /run/* ]]; then
|
||||
dfatal "systemd does not work with a prefix, which contains \"/run\"!!"
|
||||
if [[ $prefix == /run/* ]]; then
|
||||
dfatal 'systemd does not work with a prefix, which contains "/run"!!'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ mount_boot() {
|
|||
fi
|
||||
[ -e $boot ] && break
|
||||
sleep 0.5
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
[ $i -gt 40 ] && break
|
||||
done
|
||||
fi
|
||||
|
|
|
@ -49,9 +49,9 @@ installkernel() {
|
|||
done
|
||||
|
||||
# with hostonly_default_device fs module for /boot is not installed by default
|
||||
if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then
|
||||
if [[ $hostonly ]] && [[ $hostonly_default_device == "no" ]]; then
|
||||
_bootfstype=$(find_mp_fstype /boot)
|
||||
if [[ -n "$_bootfstype" ]]; then
|
||||
if [[ -n $_bootfstype ]]; then
|
||||
hostonly='' instmods $_bootfstype
|
||||
else
|
||||
dwarning "Can't determine fs type for /boot, FIPS check may fail."
|
||||
|
|
|
@ -13,7 +13,7 @@ check() {
|
|||
# if no keys are present
|
||||
if [[ $hostonly ]]; then
|
||||
x=$(echo "$dracutsysrootdir"/lib/modules/keys/*)
|
||||
[[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
|
||||
[[ ${x} == "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
@ -32,7 +32,7 @@ install() {
|
|||
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
|
||||
|
||||
for x in "$dracutsysrootdir"/lib/modules/keys/*; do
|
||||
[[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && break
|
||||
[[ ${x} == "$dracutsysrootdir/lib/modules/keys/*" ]] && break
|
||||
inst_simple "${x#$dracutsysrootdir}"
|
||||
done
|
||||
}
|
||||
|
|
|
@ -145,9 +145,9 @@ install() {
|
|||
|
||||
shopt -q -s nocasematch
|
||||
if [[ ${UNICODE} ]]; then
|
||||
if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]; then
|
||||
if [[ ${UNICODE} == YES || ${UNICODE} == 1 ]]; then
|
||||
UNICODE=1
|
||||
elif [[ ${UNICODE} = NO || ${UNICODE} = 0 ]]; then
|
||||
elif [[ ${UNICODE} == NO || ${UNICODE} == 0 ]]; then
|
||||
UNICODE=0
|
||||
else
|
||||
UNICODE=''
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
ROOT="$1"
|
||||
|
||||
if [[ ! -d "$ROOT" ]]; then
|
||||
if [[ ! -d $ROOT ]]; then
|
||||
echo "Usage: $0 <rootdir>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$ROOT" -ef / ]]; then
|
||||
if [[ $ROOT -ef / ]]; then
|
||||
echo "Can't convert the running system."
|
||||
echo "Please boot with 'rd.convertfs' on the kernel command line,"
|
||||
echo "to update with the help of the initramfs,"
|
||||
|
@ -15,7 +15,7 @@ if [[ "$ROOT" -ef / ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
while [[ "$ROOT" != "${ROOT%/}" ]]; do
|
||||
while [[ $ROOT != "${ROOT%/}" ]]; do
|
||||
ROOT=${ROOT%/}
|
||||
done
|
||||
|
||||
|
@ -33,8 +33,8 @@ fi
|
|||
|
||||
needconvert() {
|
||||
for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64"; do
|
||||
if [[ -e "$dir" ]]; then
|
||||
[[ -L "$dir" ]] || return 0
|
||||
if [[ -e $dir ]]; then
|
||||
[[ -L $dir ]] || return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
|
@ -55,7 +55,7 @@ fi
|
|||
testfile="$ROOT/.usrmovecheck$$"
|
||||
rm -f -- "$testfile"
|
||||
> "$testfile"
|
||||
if [[ ! -e "$testfile" ]]; then
|
||||
if [[ ! -e $testfile ]]; then
|
||||
echo "Cannot write to $ROOT/"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -64,7 +64,7 @@ rm -f -- "$testfile"
|
|||
testfile="$ROOT/usr/.usrmovecheck$$"
|
||||
rm -f -- "$testfile"
|
||||
> "$testfile"
|
||||
if [[ ! -e "$testfile" ]]; then
|
||||
if [[ ! -e $testfile ]]; then
|
||||
echo "Cannot write to $ROOT/usr/"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -58,7 +58,7 @@ do_dhclient() {
|
|||
fi
|
||||
fi
|
||||
|
||||
_COUNT=$(($_COUNT + 1))
|
||||
_COUNT=$((_COUNT + 1))
|
||||
[ $_COUNT -lt $_DHCPRETRY ] && sleep 1
|
||||
done
|
||||
warn "dhcp for interface $netif failed"
|
||||
|
|
|
@ -87,7 +87,7 @@ do_dhcp() {
|
|||
-lf /tmp/dhclient.$netif.lease \
|
||||
$netif \
|
||||
&& return 0
|
||||
_COUNT=$(($_COUNT + 1))
|
||||
_COUNT=$((_COUNT + 1))
|
||||
[ $_COUNT -lt $_DHCPRETRY ] && sleep 1
|
||||
done
|
||||
warn "dhcp for interface $netif failed"
|
||||
|
@ -102,7 +102,7 @@ load_ipv6() {
|
|||
modprobe ipv6
|
||||
i=0
|
||||
while [ ! -d /proc/sys/net/ipv6 ]; do
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
[ $i -gt 10 ] && break
|
||||
sleep 0.1
|
||||
done
|
||||
|
|
|
@ -28,7 +28,7 @@ if [ -z "$NEEDBOOTDEV" ]; then
|
|||
continue
|
||||
;;
|
||||
esac
|
||||
count=$(($count + 1))
|
||||
count=$((count + 1))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
fi
|
||||
|
|
|
@ -214,7 +214,7 @@ set_ifname() {
|
|||
done
|
||||
# otherwise, pick a new name and use that
|
||||
while :; do
|
||||
num=$(($num + 1))
|
||||
num=$((num + 1))
|
||||
[ -e /sys/class/net/$name$num ] && continue
|
||||
for n in $(getargs ifname=); do
|
||||
[ "$name$num" = "${n%%:*}" ] && continue 2
|
||||
|
@ -261,10 +261,10 @@ ibft_to_cmdline() {
|
|||
echo $a
|
||||
)
|
||||
# Skip invalid interfaces
|
||||
(($flags & 1)) || continue
|
||||
((flags & 1)) || continue
|
||||
# Skip interfaces not used for booting unless using multipath
|
||||
if ! getargbool 0 rd.iscsi.mp; then
|
||||
(($flags & 2)) || continue
|
||||
((flags & 2)) || continue
|
||||
fi
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(
|
||||
read a < ${iface}/dhcp
|
||||
|
@ -639,7 +639,7 @@ parse_ifname_opts() {
|
|||
eth[0-9] | eth[0-9][0-9] | eth[0-9][0-9][0-9] | eth[0-9][0-9][0-9][0-9])
|
||||
warn "ifname=$ifname_if uses the kernel name space for interfaces"
|
||||
warn "This can fail for multiple network interfaces and is discouraged!"
|
||||
warn "Please use a custom name like \"netboot\" or \"bluesocket\""
|
||||
warn 'Please use a custom name like "netboot" or "bluesocket"'
|
||||
warn "or use biosdevname and no ifname= at all."
|
||||
;;
|
||||
esac
|
||||
|
@ -652,13 +652,13 @@ wait_for_if_link() {
|
|||
local li
|
||||
local timeout="$(getargs rd.net.timeout.iflink=)"
|
||||
timeout=${timeout:-60}
|
||||
timeout=$(($timeout * 10))
|
||||
timeout=$((timeout * 10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip link show dev $1 2> /dev/null)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ wait_for_if_up() {
|
|||
local li
|
||||
local timeout="$(getargs rd.net.timeout.ifup=)"
|
||||
timeout=${timeout:-20}
|
||||
timeout=$(($timeout * 10))
|
||||
timeout=$((timeout * 10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip link show up dev $1)
|
||||
|
@ -691,7 +691,7 @@ wait_for_if_up() {
|
|||
return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -700,13 +700,13 @@ wait_for_route_ok() {
|
|||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.route=)"
|
||||
timeout=${timeout:-20}
|
||||
timeout=$(($timeout * 10))
|
||||
timeout=$((timeout * 10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -715,7 +715,7 @@ wait_for_ipv6_dad_link() {
|
|||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout * 10))
|
||||
timeout=$((timeout * 10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link)" ] \
|
||||
|
@ -724,7 +724,7 @@ wait_for_ipv6_dad_link() {
|
|||
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
|
||||
&& return 1
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ wait_for_ipv6_dad() {
|
|||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6dad=)"
|
||||
timeout=${timeout:-50}
|
||||
timeout=$(($timeout * 10))
|
||||
timeout=$((timeout * 10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -n "$(ip -6 addr show dev "$1")" ] \
|
||||
|
@ -743,7 +743,7 @@ wait_for_ipv6_dad() {
|
|||
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
|
||||
&& return 1
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -752,14 +752,14 @@ wait_for_ipv6_auto() {
|
|||
local cnt=0
|
||||
local timeout="$(getargs rd.net.timeout.ipv6auto=)"
|
||||
timeout=${timeout:-40}
|
||||
timeout=$(($timeout * 10))
|
||||
timeout=$((timeout * 10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -781,7 +781,7 @@ iface_has_carrier() {
|
|||
[ -d "$interface" ] || return 2
|
||||
local timeout="$(getargs rd.net.timeout.carrier=)"
|
||||
timeout=${timeout:-10}
|
||||
timeout=$(($timeout * 10))
|
||||
timeout=$((timeout * 10))
|
||||
|
||||
linkup "$1"
|
||||
|
||||
|
@ -800,7 +800,7 @@ iface_has_carrier() {
|
|||
# double check the syscfs carrier flag
|
||||
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ installkernel() {
|
|||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
|
||||
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
|
||||
if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules needed by drm
|
||||
instmods \
|
||||
"=drivers/gpu/drm/i2c" \
|
||||
|
|
|
@ -32,7 +32,7 @@ install() {
|
|||
dwarn "${line}"
|
||||
else
|
||||
derror "${line}"
|
||||
(($_ret == 0)) && _ret=1
|
||||
((_ret == 0)) && _ret=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
|
|
@ -32,7 +32,7 @@ if [[ $hostonly ]]; then
|
|||
fi
|
||||
else
|
||||
for x in "$dracutsysrootdir"/usr/share/plymouth/themes/{text,details}/*; do
|
||||
[[ -f "$x" ]] || continue
|
||||
[[ -f $x ]] || continue
|
||||
THEME_DIR=$(dirname "${x#$dracutsysrootdir}")
|
||||
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
|
||||
inst_multiple "${x#$dracutsysrootdir}"
|
||||
|
|
|
@ -16,7 +16,7 @@ function sysecho() {
|
|||
done
|
||||
local status
|
||||
read status < "$file"
|
||||
if [[ ! $status == $* ]]; then
|
||||
if [[ $status != $* ]]; then
|
||||
[ -f "$file" ] && echo $* > "$file"
|
||||
fi
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ processcmsfile() {
|
|||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
[[ $NETTYPE == "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ check() {
|
|||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == "btrfs" ]] && return 0
|
||||
[[ $fs == "btrfs" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ ask_for_password() {
|
|||
&& printf "$tty_prompt [$i/$tty_tries]:" >&2
|
||||
eval "$tty_cmd" && ret=0 && break
|
||||
ret=$?
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
[ -n "$tty_prompt" ] && printf '\n' >&2
|
||||
done
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ else
|
|||
info "No key found for $device. Will try $numtries time(s) more later."
|
||||
initqueue --unique --onetime --settled \
|
||||
--name cryptroot-ask-$luksname \
|
||||
$(command -v cryptroot-ask) "$device" "$luksname" "$is_keysource" "$(($numtries - 1))"
|
||||
$(command -v cryptroot-ask) "$device" "$luksname" "$is_keysource" "$((numtries - 1))"
|
||||
exit 0
|
||||
fi
|
||||
unset tmp
|
||||
|
|
|
@ -8,7 +8,7 @@ check() {
|
|||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = "crypto_LUKS" ]] && return 0
|
||||
[[ $fs == "crypto_LUKS" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
@ -57,12 +57,12 @@ installkernel() {
|
|||
cmdline() {
|
||||
local dev UUID
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != "crypto_LUKS" ]] && continue
|
||||
[[ ${host_fs_types[$dev]} != "crypto_LUKS" ]] && continue
|
||||
|
||||
UUID=$(
|
||||
blkid -u crypto -o export $dev \
|
||||
| while read line || [ -n "$line" ]; do
|
||||
[[ ${line#UUID} = $line ]] && continue
|
||||
[[ ${line#UUID} == $line ]] && continue
|
||||
printf "%s" "${line#UUID=}"
|
||||
break
|
||||
done
|
||||
|
@ -92,7 +92,7 @@ install() {
|
|||
if [[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/crypttab ]]; then
|
||||
# filter /etc/crypttab for the devices we need
|
||||
while read _mapper _dev _luksfile _luksoptions || [ -n "$_mapper" ]; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ $_mapper == \#* ]] && continue
|
||||
[[ $_dev ]] || continue
|
||||
|
||||
[[ $_dev == PARTUUID=* ]] \
|
||||
|
|
|
@ -10,12 +10,12 @@ check() {
|
|||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
[[ ${host_fs_types[$dev]} != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e $holder ]] || continue
|
||||
[[ -e "$holder/dm" ]] && return 0
|
||||
break
|
||||
done
|
||||
|
@ -40,12 +40,12 @@ cmdline() {
|
|||
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
local holder DEVPATH DM_NAME majmin
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
[[ ${host_fs_types[$dev]} != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e $holder ]] || continue
|
||||
dev="/dev/${holder##*/}"
|
||||
DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2> /dev/null)"
|
||||
[[ ${DM_NAME} ]] && break
|
||||
|
|
|
@ -249,8 +249,8 @@ do_live_overlay() {
|
|||
mkdir -m 0755 -p /run/initramfs/thin-overlay
|
||||
|
||||
# In block units (512b)
|
||||
thin_data_sz=$(($overlay_size * 1024 * 1024 / 512))
|
||||
thin_meta_sz=$(($thin_data_sz / 10))
|
||||
thin_data_sz=$((overlay_size * 1024 * 1024 / 512))
|
||||
thin_meta_sz=$((thin_data_sz / 10))
|
||||
|
||||
# It is important to have the backing file on a tmpfs
|
||||
# this is needed to let the loopdevice support TRIM
|
||||
|
|
|
@ -25,7 +25,7 @@ installkernel() {
|
|||
: "${depmod_modules_dep:=$srcmods/modules.dep}"
|
||||
: "${depmod_module_dir:=$srcmods}"
|
||||
|
||||
[[ -f "${depmod_modules_dep}" ]] || return 0
|
||||
[[ -f ${depmod_modules_dep} ]] || return 0
|
||||
|
||||
# Message printers with custom prefix
|
||||
local mod_name="kernel-modules-extra"
|
||||
|
@ -61,7 +61,7 @@ installkernel() {
|
|||
# configuration path
|
||||
if [ -d "$cfg" ]; then
|
||||
for f in "$cfg/"*; do
|
||||
[[ -e "$f" && ! -d "$f" ]] || {
|
||||
[[ -e $f && ! -d $f ]] || {
|
||||
prdebug "configuration source" \
|
||||
"\"$cfg\" is ignored" \
|
||||
"(directory or doesn't exist)"
|
||||
|
@ -96,14 +96,14 @@ installkernel() {
|
|||
override) # module_name kver_pattern dir
|
||||
read -r mod kverpat path <<< "$v"
|
||||
|
||||
if [[ ! "$mod" || ! "$kverpat" || ! "$path" ]]; then
|
||||
if [[ ! $mod || ! $kverpat || ! $path ]]; then
|
||||
prinfo "$cfg: ignoring incorrect" \
|
||||
"override option: \"$k $v\""
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ '*' = "$kverpat" ]] \
|
||||
|| [[ "$kernel" =~ $kverpat ]]; then
|
||||
if [[ '*' == "$kverpat" ]] \
|
||||
|| [[ $kernel =~ $kverpat ]]; then
|
||||
overrides+=("${path}/${mod}")
|
||||
|
||||
prdebug "$cfg: added override" \
|
||||
|
@ -117,14 +117,14 @@ installkernel() {
|
|||
external) # kverpat dir
|
||||
read -r kverpat path <<< "$v"
|
||||
|
||||
if [[ ! "$kverpat" || ! "$path" ]]; then
|
||||
if [[ ! $kverpat || ! $path ]]; then
|
||||
prinfo "$cfg: ignoring incorrect" \
|
||||
"external option: \"$k $v\""
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ '*' = "$kverpat" || \
|
||||
"$kernel" =~ $kverpat ]]; then
|
||||
if [[ '*' == "$kverpat" || \
|
||||
$kernel =~ $kverpat ]]; then
|
||||
external_dirs+=("$path")
|
||||
|
||||
prdebug "$cfg: added external" \
|
||||
|
|
|
@ -67,7 +67,7 @@ installkernel() {
|
|||
virtio virtio_ring virtio_pci pci_hyperv \
|
||||
"=drivers/pcmcia"
|
||||
|
||||
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
|
||||
if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules
|
||||
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
|
||||
instmods \
|
||||
|
@ -108,7 +108,7 @@ installkernel() {
|
|||
|| for_each_host_dev_and_slaves_all record_block_dev_drv; then
|
||||
hostonly='' instmods sg sr_mod sd_mod scsi_dh ata_piix
|
||||
|
||||
if [[ "$hostonly_mode" == "strict" ]]; then
|
||||
if [[ $hostonly_mode == "strict" ]]; then
|
||||
install_block_modules_strict
|
||||
else
|
||||
install_block_modules
|
||||
|
|
|
@ -18,7 +18,7 @@ installkernel() {
|
|||
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
|
||||
local _net_drivers
|
||||
|
||||
if [[ "$_arch" = "s390" ]] || [[ "$_arch" = "s390x" ]]; then
|
||||
if [[ $_arch == "s390" ]] || [[ $_arch == "s390x" ]]; then
|
||||
dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net"
|
||||
fi
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ check() {
|
|||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = LVM*_member ]] && return 0
|
||||
[[ $fs == LVM*_member ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
@ -31,11 +31,11 @@ cmdline() {
|
|||
[ -e /sys/block/${dev#/dev/}/dm/name ] || continue
|
||||
[ -e /sys/block/${dev#/dev/}/dm/uuid ] || continue
|
||||
uuid=$(< /sys/block/${dev#/dev/}/dm/uuid)
|
||||
[[ "${uuid#LVM-}" == "$uuid" ]] && continue
|
||||
[[ ${uuid#LVM-} == "$uuid" ]] && continue
|
||||
dev=$(< /sys/block/${dev#/dev/}/dm/name)
|
||||
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2> /dev/null)
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
|
||||
if ! [[ ${_activated[${DM_VG_NAME} / ${DM_LV_NAME}]} ]]; then
|
||||
if ! [[ ${_activated[DM_VG_NAME / DM_LV_NAME]} ]]; then
|
||||
printf " rd.lvm.lv=%s " "${DM_VG_NAME}/${DM_LV_NAME} "
|
||||
_activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
|
||||
fi
|
||||
|
@ -59,7 +59,7 @@ install() {
|
|||
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [[ $hostonly ]] || [[ $lvmconf == "yes" ]]; then
|
||||
if [[ -f $dracutsysrootdir/etc/lvm/lvm.conf ]]; then
|
||||
inst_simple -H /etc/lvm/lvm.conf
|
||||
# FIXME: near-term hack to establish read-only locking;
|
||||
|
|
|
@ -8,7 +8,7 @@ _do_md_shutdown() {
|
|||
ret=$?
|
||||
info "Disassembling mdraid devices."
|
||||
mdadm -vv --stop --scan | vinfo
|
||||
ret=$(($ret + $?))
|
||||
ret=$((ret + $?))
|
||||
if [ "x$final" != "x" ]; then
|
||||
info "/proc/mdstat:"
|
||||
vinfo < /proc/mdstat
|
||||
|
|
|
@ -8,12 +8,12 @@ check() {
|
|||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
[[ ${host_fs_types[$dev]} != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e $holder ]] || continue
|
||||
[[ -e "$holder/md" ]] && return 0
|
||||
break
|
||||
done
|
||||
|
@ -42,17 +42,17 @@ cmdline() {
|
|||
declare -A _activated
|
||||
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
[[ ${host_fs_types[$dev]} != *_raid_member ]] && continue
|
||||
|
||||
UUID=$(
|
||||
/sbin/mdadm --examine --export $dev \
|
||||
| while read line || [ -n "$line" ]; do
|
||||
[[ ${line#MD_UUID=} = $line ]] && continue
|
||||
[[ ${line#MD_UUID=} == $line ]] && continue
|
||||
printf "%s" "${line#MD_UUID=} "
|
||||
done
|
||||
)
|
||||
|
||||
[[ -z "$UUID" ]] && continue
|
||||
[[ -z $UUID ]] && continue
|
||||
|
||||
if ! [[ ${_activated[${UUID}]} ]]; then
|
||||
printf "%s" " rd.md.uuid=${UUID}"
|
||||
|
@ -103,7 +103,7 @@ install() {
|
|||
inst_hook pre-trigger 30 "$moddir/md-noddf.sh"
|
||||
fi
|
||||
|
||||
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
|
||||
if [[ $hostonly ]] || [[ $mdadmconf == "yes" ]]; then
|
||||
if [[ -f $dracutsysrootdir/etc/mdadm.conf ]]; then
|
||||
inst -H /etc/mdadm.conf
|
||||
else
|
||||
|
|
|
@ -94,7 +94,7 @@ install() {
|
|||
/etc/multipath/* \
|
||||
/etc/multipath/conf.d/*
|
||||
|
||||
[[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && {
|
||||
[[ $hostonly ]] && [[ $hostonly_mode == "strict" ]] && {
|
||||
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
|
||||
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ check() {
|
|||
if [[ ! $hostonly ]]; then
|
||||
return 0
|
||||
fi
|
||||
[[ $DRACUT_KERNEL_MODALIASES && -f "$DRACUT_KERNEL_MODALIASES" ]] \
|
||||
[[ $DRACUT_KERNEL_MODALIASES && -f $DRACUT_KERNEL_MODALIASES ]] \
|
||||
&& grep -q libnvdimm "$DRACUT_KERNEL_MODALIASES" && return 0
|
||||
return 255
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
check() {
|
||||
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
# only for PowerPC Macs
|
||||
[[ "$_arch" == ppc* && "$_arch" != ppc64le ]] || return 1
|
||||
[[ $_arch == ppc* && $_arch != ppc64le ]] || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ installkernel() {
|
|||
}
|
||||
|
||||
# only PowerMac3,6 has a module, special case
|
||||
if [[ "${DRACUT_ARCH:-$(uname -m)}" != ppc64* ]]; then
|
||||
if [[ ${DRACUT_ARCH:-$(uname -m)} != ppc64* ]]; then
|
||||
if ! [[ $hostonly ]] || [[ "$(pmac_model)" == "PowerMac3,6" ]]; then
|
||||
instmods therm_windtunnel
|
||||
fi
|
||||
|
|
|
@ -42,7 +42,7 @@ sc_public_key() {
|
|||
sc_supported() {
|
||||
local gpgMajor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
|
||||
local gpgMinor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"
|
||||
if [[ "${gpgMajor}" -gt 2 || "${gpgMajor}" -eq 2 && "${gpgMinor}" -ge 1 ]] \
|
||||
if [[ ${gpgMajor} -gt 2 || ${gpgMajor} -eq 2 && ${gpgMinor} -ge 1 ]] \
|
||||
&& require_binaries gpg-agent \
|
||||
&& require_binaries gpg-connect-agent \
|
||||
&& require_binaries /usr/libexec/scdaemon \
|
||||
|
|
|
@ -7,7 +7,7 @@ check() {
|
|||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == "cifs" ]] && return 0
|
||||
[[ $fs == "cifs" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ check() {
|
|||
for bdev in /sys/block/*; do
|
||||
case "${bdev##*/}" in
|
||||
dasd*)
|
||||
found=$(($found + 1))
|
||||
found=$((found + 1))
|
||||
break
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -43,7 +43,7 @@ EOF
|
|||
}
|
||||
|
||||
if [[ -f /sys/firmware/ipl/ipl_type && \
|
||||
$(< /sys/firmware/ipl/ipl_type) = "ccw" ]]; then
|
||||
$(< /sys/firmware/ipl/ipl_type) == "ccw" ]]; then
|
||||
(
|
||||
_ccw=$(cat /sys/firmware/ipl/device)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# called by dracut
|
||||
check() {
|
||||
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
[[ "$_arch" = "s390" ]] || [[ "$_arch" = "s390x" ]] || return 1
|
||||
[[ $_arch == "s390" ]] || [[ $_arch == "s390x" ]] || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ check_edd() {
|
|||
|
||||
while [ $cnt -lt 600 ]; do
|
||||
[ -d /sys/firmware/edd ] && return 0
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
sleep 0.1
|
||||
done
|
||||
return 1
|
||||
|
|
|
@ -74,28 +74,28 @@ if [ "$dcb" = "dcb" ]; then
|
|||
lldptool -p && break
|
||||
info "Waiting for lldpad to be ready"
|
||||
sleep 1
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
while [ $i -lt 60 ]; do
|
||||
dcbtool sc "$netif" dcb on && break
|
||||
info "Retrying to turn dcb on"
|
||||
sleep 1
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
while [ $i -lt 60 ]; do
|
||||
dcbtool sc "$netif" pfc e:1 a:1 w:1 && break
|
||||
info "Retrying to turn dcb on"
|
||||
sleep 1
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
while [ $i -lt 60 ]; do
|
||||
dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
|
||||
info "Retrying to turn fcoe on"
|
||||
sleep 1
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
sleep 1
|
||||
|
|
|
@ -15,5 +15,5 @@ while [ $i -lt 60 ]; do
|
|||
lldptool -p && break
|
||||
info "Waiting for lldpad to be ready"
|
||||
sleep 1
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
|
|
@ -78,10 +78,10 @@ cmdline() {
|
|||
# DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to set to "no".
|
||||
#
|
||||
# Force "nodcb" if there's any DCB_REQUIRED="no"(child or vlan parent).
|
||||
grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${i##*/} &> /dev/null
|
||||
grep -q '^[[:blank:]]*DCB_REQUIRED="no"' /etc/fcoe/cfg-${i##*/} &> /dev/null
|
||||
[ $? -eq 0 ] && dcb="nodcb"
|
||||
if [ "$p" ]; then
|
||||
grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${p} &> /dev/null
|
||||
grep -q '^[[:blank:]]*DCB_REQUIRED="no"' /etc/fcoe/cfg-${p} &> /dev/null
|
||||
[ $? -eq 0 ] && dcb="nodcb"
|
||||
fi
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ if ! [ "$netif" = "online" ]; then
|
|||
nroot="${nroot##iscsi:}"
|
||||
if [ -n "$nroot" ]; then
|
||||
handle_netroot "$nroot"
|
||||
ret=$(($ret + $?))
|
||||
ret=$((ret + $?))
|
||||
fi
|
||||
done
|
||||
else
|
||||
|
|
|
@ -94,7 +94,7 @@ while [ ! -b /dev/nbd0 ]; do
|
|||
else
|
||||
sleep 0.1
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
# If we didn't get a root= on the command line, then we need to
|
||||
|
|
|
@ -8,9 +8,9 @@ get_nfs_type() {
|
|||
local _nfs _nfs4
|
||||
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == "nfs" ]] && _nfs=1
|
||||
[[ "$fs" == "nfs3" ]] && _nfs=1
|
||||
[[ "$fs" == "nfs4" ]] && _nfs4=1
|
||||
[[ $fs == "nfs" ]] && _nfs=1
|
||||
[[ $fs == "nfs3" ]] && _nfs=1
|
||||
[[ $fs == "nfs4" ]] && _nfs4=1
|
||||
done
|
||||
|
||||
[[ "$_nfs" ]] && echo "nfs" && return
|
||||
|
|
|
@ -22,7 +22,7 @@ check() {
|
|||
break
|
||||
fi
|
||||
done
|
||||
[[ "$trtype" == "fc" ]] || [[ "$trtype" == "tcp" ]] || [[ "$trtype" == "rdma" ]]
|
||||
[[ $trtype == "fc" ]] || [[ $trtype == "tcp" ]] || [[ $trtype == "rdma" ]]
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
|
|
|
@ -13,11 +13,11 @@ depends() {
|
|||
cmdline_journal() {
|
||||
if [[ $hostonly ]]; then
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
|
||||
[[ ${host_fs_types[$dev]} == "reiserfs" ]] || [[ ${host_fs_types[$dev]} == "xfs" ]] || continue
|
||||
rootopts=$(find_dev_fsopts "$dev")
|
||||
if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
|
||||
if [[ ${host_fs_types[$dev]} == "reiserfs" ]]; then
|
||||
journaldev=$(fs_get_option $rootopts "jdev")
|
||||
elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
|
||||
elif [[ ${host_fs_types[$dev]} == "xfs" ]]; then
|
||||
journaldev=$(fs_get_option $rootopts "logdev")
|
||||
fi
|
||||
|
||||
|
@ -47,7 +47,7 @@ cmdline_rootfs() {
|
|||
if [ -n "$_fstype" ]; then
|
||||
printf " rootfstype=%s" "$_fstype"
|
||||
fi
|
||||
if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then
|
||||
if [[ $use_fstab != yes ]] && [[ $_fstype == btrfs ]]; then
|
||||
_subvol=$(findmnt -e -v -n -o FSROOT --target /) \
|
||||
&& _subvol=${_subvol#/}
|
||||
_flags="$_flags${_subvol:+,subvol=$_subvol}"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
check() {
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == "9p" ]] && return 0
|
||||
[[ $fs == "9p" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ check() {
|
|||
found=0
|
||||
for _ccw in /sys/bus/ccw/devices/*/host*; do
|
||||
[ -d "$_ccw" ] || continue
|
||||
found=$(($found + 1))
|
||||
found=$((found + 1))
|
||||
done
|
||||
[ $found -eq 0 ] && return 255
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ EOF
|
|||
}
|
||||
|
||||
if [[ -f /sys/firmware/ipl/ipl_type && \
|
||||
$(< /sys/firmware/ipl/ipl_type) = "fcp" ]]; then
|
||||
$(< /sys/firmware/ipl/ipl_type) == "fcp" ]]; then
|
||||
(
|
||||
_wwpn=$(cat /sys/firmware/ipl/wwpn)
|
||||
_lun=$(cat /sys/firmware/ipl/lun)
|
||||
|
|
|
@ -13,7 +13,7 @@ getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initque
|
|||
|
||||
RDRETRY=$(getarg rd.retry -d 'rd_retry=')
|
||||
RDRETRY=${RDRETRY:-180}
|
||||
RDRETRY=$(($RDRETRY * 2))
|
||||
RDRETRY=$((RDRETRY * 2))
|
||||
export RDRETRY
|
||||
|
||||
main_loop=0
|
||||
|
@ -54,7 +54,7 @@ while :; do
|
|||
[ -e "$i" ] && continue 2
|
||||
done
|
||||
|
||||
if [ $main_loop -gt $((2 * $RDRETRY / 3)) ]; then
|
||||
if [ $main_loop -gt $((2 * RDRETRY / 3)) ]; then
|
||||
warn "dracut-initqueue: timeout, still waiting for following initqueue hooks:"
|
||||
for _f in $hookdir/initqueue/finished/*.sh; do
|
||||
warn "$_f: \"$(cat "$_f")\""
|
||||
|
@ -71,7 +71,7 @@ while :; do
|
|||
fi
|
||||
fi
|
||||
|
||||
main_loop=$(($main_loop + 1))
|
||||
main_loop=$((main_loop + 1))
|
||||
if [ $main_loop -gt $RDRETRY ]; then
|
||||
if ! [ -f /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ]; then
|
||||
emergency_shell "Could not boot."
|
||||
|
|
|
@ -28,7 +28,7 @@ while :; do
|
|||
fi
|
||||
done
|
||||
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
[ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
|
||||
done
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ getargnum() {
|
|||
_b=$(getarg "$1")
|
||||
[ $? -ne 0 -a -z "$_b" ] && _b=$_default
|
||||
if [ -n "$_b" ]; then
|
||||
isdigit "$_b" && _b=$(($_b)) \
|
||||
isdigit "$_b" && _b=$((_b)) \
|
||||
&& [ $_b -ge $_min ] && [ $_b -le $_max ] && echo $_b && return
|
||||
fi
|
||||
echo $_default
|
||||
|
@ -471,7 +471,7 @@ check_occurances() {
|
|||
|
||||
while [ "${str#*$ch}" != "${str}" ]; do
|
||||
str="${str#*$ch}"
|
||||
count=$(($count + 1))
|
||||
count=$((count + 1))
|
||||
done
|
||||
|
||||
[ $count -eq $expected ]
|
||||
|
@ -609,7 +609,7 @@ funiq() {
|
|||
[ -d "${dir}" ] || return 1
|
||||
|
||||
while [ -e "${dir}/${prefix}$i" ]; do
|
||||
i=$(($i + 1)) || return 1
|
||||
i=$((i + 1)) || return 1
|
||||
done
|
||||
|
||||
echo "${dir}/${prefix}$i"
|
||||
|
@ -998,7 +998,7 @@ wait_for_loginit() {
|
|||
[ -z "${j##*Running*}" ] || break
|
||||
fi
|
||||
sleep 0.1
|
||||
i=$(($i + 1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
if [ $i -eq 10 ]; then
|
||||
|
|
|
@ -174,7 +174,7 @@ getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initque
|
|||
|
||||
RDRETRY=$(getarg rd.retry -d 'rd_retry=')
|
||||
RDRETRY=${RDRETRY:-180}
|
||||
RDRETRY=$(($RDRETRY * 2))
|
||||
RDRETRY=$((RDRETRY * 2))
|
||||
export RDRETRY
|
||||
main_loop=0
|
||||
export main_loop
|
||||
|
@ -209,7 +209,7 @@ while :; do
|
|||
# no more udev jobs and queues empty.
|
||||
sleep 0.5
|
||||
|
||||
if [ $main_loop -gt $((2 * $RDRETRY / 3)) ]; then
|
||||
if [ $main_loop -gt $((2 * RDRETRY / 3)) ]; then
|
||||
for job in $hookdir/initqueue/timeout/*.sh; do
|
||||
[ -e "$job" ] || break
|
||||
job=$job . $job
|
||||
|
@ -218,7 +218,7 @@ while :; do
|
|||
done
|
||||
fi
|
||||
|
||||
main_loop=$(($main_loop + 1))
|
||||
main_loop=$((main_loop + 1))
|
||||
[ $main_loop -gt $RDRETRY ] \
|
||||
&& {
|
||||
flock -s 9
|
||||
|
@ -255,7 +255,7 @@ while :; do
|
|||
fi
|
||||
done
|
||||
|
||||
_i_mount=$(($_i_mount + 1))
|
||||
_i_mount=$((_i_mount + 1))
|
||||
[ $_i_mount -gt 20 ] \
|
||||
&& {
|
||||
flock -s 9
|
||||
|
|
|
@ -65,7 +65,7 @@ install() {
|
|||
fi
|
||||
|
||||
ln -fs /proc/self/mounts "$initdir/etc/mtab"
|
||||
if [[ $ro_mnt = yes ]]; then
|
||||
if [[ $ro_mnt == yes ]]; then
|
||||
echo ro >> "${initdir}/etc/cmdline.d/base.conf"
|
||||
fi
|
||||
|
||||
|
@ -106,7 +106,7 @@ install() {
|
|||
|
||||
## save host_devs which we need bring up
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
if [[ -n "${host_devs[*]}" ]]; then
|
||||
if [[ -n ${host_devs[*]} ]]; then
|
||||
dracut_need_initqueue
|
||||
fi
|
||||
if [[ -f $initdir/lib/dracut/need-initqueue ]] || ! dracut_module_included "systemd"; then
|
||||
|
@ -120,14 +120,14 @@ install() {
|
|||
|
||||
for _dev in "${host_devs[@]}"; do
|
||||
for _dev2 in "${root_devs[@]}"; do
|
||||
[[ "$_dev" == "$_dev2" ]] && continue 2
|
||||
[[ $_dev == "$_dev2" ]] && continue 2
|
||||
done
|
||||
|
||||
# We only actually wait for real devs - swap is only needed
|
||||
# for resume and udev rules generated when parsing resume=
|
||||
# argument take care of the waiting for us
|
||||
for _dev2 in "${swap_devs[@]}"; do
|
||||
[[ "$_dev" == "$_dev2" ]] && continue 2
|
||||
[[ $_dev == "$_dev2" ]] && continue 2
|
||||
done
|
||||
|
||||
_pdev=$(get_persistent_dev $_dev)
|
||||
|
|
|
@ -64,9 +64,9 @@ install() {
|
|||
inst "$moddir/fs-lib.sh" "/lib/fs-lib.sh"
|
||||
> ${initdir}/etc/fstab.empty
|
||||
|
||||
[[ "$nofscks" = "yes" ]] && return
|
||||
[[ $nofscks == "yes" ]] && return
|
||||
|
||||
if [[ "$fscks" = "${fscks#*[^ ]*}" ]]; then
|
||||
if [[ $fscks == "${fscks#*[^ ]*}" ]]; then
|
||||
_helpers="\
|
||||
umount mount /sbin/fsck* /usr/sbin/fsck*
|
||||
xfs_db xfs_check xfs_repair xfs_metadump
|
||||
|
@ -80,7 +80,7 @@ install() {
|
|||
_helpers="$fscks"
|
||||
fi
|
||||
|
||||
if [[ "$_helpers" == *e2fsck* ]] && [[ -e $dracutsysrootdir/etc/e2fsck.conf ]]; then
|
||||
if [[ $_helpers == *e2fsck* ]] && [[ -e $dracutsysrootdir/etc/e2fsck.conf ]]; then
|
||||
inst_simple /etc/e2fsck.conf
|
||||
fi
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ umount_a() {
|
|||
_cnt=0
|
||||
while [ $_cnt -le 40 ]; do
|
||||
umount_a || break
|
||||
_cnt=$(($_cnt + 1))
|
||||
_cnt=$((_cnt + 1))
|
||||
done
|
||||
|
||||
[ $_cnt -ge 40 ] && umount_a -v
|
||||
|
@ -142,7 +142,7 @@ _check_shutdown() {
|
|||
_cnt=0
|
||||
while [ $_cnt -le 40 ]; do
|
||||
_check_shutdown && break
|
||||
_cnt=$(($_cnt + 1))
|
||||
_cnt=$((_cnt + 1))
|
||||
done
|
||||
[ $_cnt -ge 40 ] && _check_shutdown final
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ installpost() {
|
|||
# Move everything under $initdir except $squash_dir
|
||||
# itself into squash image
|
||||
for i in "$initdir"/*; do
|
||||
[[ "$squash_dir" == "$i"/* ]] || mv "$i" "$squash_dir"/
|
||||
[[ $squash_dir == "$i"/* ]] || mv "$i" "$squash_dir"/
|
||||
done
|
||||
|
||||
# Create mount points for squash loader
|
||||
|
|
|
@ -61,7 +61,7 @@ uefi_device_path() {
|
|||
0101)
|
||||
# PCI
|
||||
tt=$(getword)
|
||||
printf "PCI(0x%x,0x%x)" $(($tt / 256)) $(($tt & 255))
|
||||
printf "PCI(0x%x,0x%x)" $((tt / 256)) $((tt & 255))
|
||||
;;
|
||||
0201)
|
||||
# ACPI
|
||||
|
|
|
@ -20,7 +20,7 @@ wait_for_if_link() {
|
|||
[ -n "$li" ] && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ wait_for_if_up() {
|
|||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ wait_for_route_ok() {
|
|||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ client_test() {
|
|||
# nfsinfo=( server:/path nfs{,4} options )
|
||||
nfsinfo=($(awk '{print $2, $3, $4; exit}' $TESTDIR/client.img))
|
||||
|
||||
if [[ "${nfsinfo[0]%%:*}" != "$server" ]]; then
|
||||
if [[ ${nfsinfo[0]%%:*} != "$server" ]]; then
|
||||
echo "CLIENT TEST INFO: got server: ${nfsinfo[0]%%:*}"
|
||||
echo "CLIENT TEST INFO: expected server: $server"
|
||||
echo "CLIENT TEST END: $test_name [FAILED - WRONG SERVER]"
|
||||
|
@ -91,14 +91,14 @@ client_test() {
|
|||
|
||||
found=0
|
||||
expected=1
|
||||
if [[ ${check_opt:0:1} = '-' ]]; then
|
||||
if [[ ${check_opt:0:1} == '-' ]]; then
|
||||
expected=0
|
||||
check_opt=${check_opt:1}
|
||||
fi
|
||||
|
||||
opts=${nfsinfo[2]},
|
||||
while [[ $opts ]]; do
|
||||
if [[ ${opts%%,*} = $check_opt ]]; then
|
||||
if [[ ${opts%%,*} == $check_opt ]]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
|
|
|
@ -19,7 +19,7 @@ wait_for_if_link() {
|
|||
[ -n "$li" ] && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ wait_for_if_link() {
|
|||
[ -n "$li" ] && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ wait_for_if_up() {
|
|||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ wait_for_route_ok() {
|
|||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ wait_for_if_link() {
|
|||
[ -n "$li" ] && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ wait_for_if_up() {
|
|||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ wait_for_route_ok() {
|
|||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -91,14 +91,14 @@ client_test() {
|
|||
# nbdinfo=( fstype fsoptions )
|
||||
nbdinfo=($(awk '{print $2, $3; exit}' $TESTDIR/flag.img))
|
||||
|
||||
if [[ "${nbdinfo[0]}" != "$fstype" ]]; then
|
||||
if [[ ${nbdinfo[0]} != "$fstype" ]]; then
|
||||
echo "CLIENT TEST END: $test_name [FAILED - WRONG FS TYPE] \"${nbdinfo[0]}\" != \"$fstype\""
|
||||
return 1
|
||||
fi
|
||||
|
||||
opts=${nbdinfo[1]},
|
||||
while [[ $opts ]]; do
|
||||
if [[ ${opts%%,*} = $fsopt ]]; then
|
||||
if [[ ${opts%%,*} == $fsopt ]]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
|
|
|
@ -20,7 +20,7 @@ wait_for_if_link() {
|
|||
[ -n "$li" ] && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ wait_for_if_up() {
|
|||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ wait_for_route_ok() {
|
|||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ client_test() {
|
|||
read IFACES
|
||||
} < "$TESTDIR"/client.img
|
||||
|
||||
if [[ "$OK" != "OK" ]]; then
|
||||
if [[ $OK != "OK" ]]; then
|
||||
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
|
||||
return 1
|
||||
fi
|
||||
|
|
|
@ -22,7 +22,7 @@ wait_for_if_link() {
|
|||
[ -n "$li" ] && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ wait_for_if_up() {
|
|||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ wait_for_route_ok() {
|
|||
li=$(ip route show)
|
||||
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt + 1))
|
||||
cnt=$((cnt + 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ client_test() {
|
|||
|
||||
{
|
||||
read OK
|
||||
if [[ "$OK" != "OK" ]]; then
|
||||
if [[ $OK != "OK" ]]; then
|
||||
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
|
||||
return 1
|
||||
fi
|
||||
|
@ -107,7 +107,7 @@ client_test() {
|
|||
done
|
||||
} < "$TESTDIR"/client.img || return 1
|
||||
|
||||
if [[ "$check" != "$CONF" ]]; then
|
||||
if [[ $check != "$CONF" ]]; then
|
||||
echo "Expected: '$check'"
|
||||
echo
|
||||
echo
|
||||
|
|
|
@ -21,8 +21,8 @@ test_run() {
|
|||
set -x
|
||||
(
|
||||
cd "$TESTDIR"
|
||||
export CMDLINE="key1=0 key2=val key2=val2 key3=\" val 3 \" \" key 4 =\"val4 \"key 5=val 5\" \"key 6=\"\"val 6\" key7=\"foo\"bar\" baz=\"end \" key8 = val 8 \"
|
||||
\"key 9\"=\"val 9\""
|
||||
export CMDLINE='key1=0 key2=val key2=val2 key3=" val 3 " " key 4 ="val4 "key 5=val 5" "key 6=""val 6" key7="foo"bar" baz="end " key8 = val 8 "
|
||||
"key 9"="val 9"'
|
||||
|
||||
ret=0
|
||||
|
||||
|
@ -33,10 +33,10 @@ test_run() {
|
|||
["key3"]=" val 3 "
|
||||
[" key 4 "]="val4"
|
||||
["key 5"]="val 5"
|
||||
["key 6"]="\"val 6"
|
||||
["key7"]="foo\"bar\" baz=\"end"
|
||||
["key 6"]='"val 6'
|
||||
["key7"]='foo"bar" baz="end'
|
||||
[" key8 "]=" val 8 "
|
||||
["key 9\""]="val 9"
|
||||
['key 9"']="val 9"
|
||||
)
|
||||
for key in "${!TEST[@]}"; do
|
||||
if ! val=$(./dracut-getarg "${key}="); then
|
||||
|
@ -52,7 +52,7 @@ test_run() {
|
|||
|
||||
declare -a INVALIDKEYS
|
||||
|
||||
INVALIDKEYS=("key" "4" "5" "6" "key8" "9" "\"" "baz")
|
||||
INVALIDKEYS=("key" "4" "5" "6" "key8" "9" '"' "baz")
|
||||
for key in "${INVALIDKEYS[@]}"; do
|
||||
val=$(./dracut-getarg "$key")
|
||||
if (($? == 0)); then
|
||||
|
|
|
@ -20,7 +20,7 @@ $(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu -cpu ho
|
|||
# Provide rng device sourcing the hosts /dev/urandom and other standard parameters
|
||||
ARGS="$ARGS -smp 2 -m 512 -nodefaults -vga none -display none -no-reboot -device virtio-rng-pci"
|
||||
|
||||
if ! [[ $* = *-daemonize* ]] && ! [[ $* = *-daemonize* ]]; then
|
||||
if ! [[ $* == *-daemonize* ]] && ! [[ $* == *-daemonize* ]]; then
|
||||
ARGS="$ARGS -serial stdio"
|
||||
fi
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|||
export PATH
|
||||
|
||||
[[ -e .testdir${TEST_RUN_ID:+-$TEST_RUN_ID} ]] && . .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
if [[ -z "$TESTDIR" ]] || [[ ! -d "$TESTDIR" ]]; then
|
||||
if [[ -z $TESTDIR ]] || [[ ! -d $TESTDIR ]]; then
|
||||
TESTDIR=$(mktemp -d -p "/var/tmp" -t dracut-test.XXXXXX)
|
||||
fi
|
||||
echo "TESTDIR=\"$TESTDIR\"" > .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
|
@ -28,7 +28,7 @@ COLOR_WARNING='\033[0;33m'
|
|||
COLOR_NORMAL='\033[0;39m'
|
||||
|
||||
check_root() {
|
||||
if (($EUID != 0)); then
|
||||
if ((EUID != 0)); then
|
||||
SETCOLOR_FAILURE
|
||||
echo "Tests must be run as root! Please use 'sudo'."
|
||||
SETCOLOR_NORMAL
|
||||
|
@ -65,7 +65,7 @@ while (($# > 0)); do
|
|||
else
|
||||
echo -e "TEST: $TEST_DESCRIPTION " $COLOR_SUCCESS "[STARTED]" $COLOR_NORMAL
|
||||
fi
|
||||
if [[ "$V" == "1" ]]; then
|
||||
if [[ $V == "1" ]]; then
|
||||
set -o pipefail
|
||||
(
|
||||
test_setup && test_run
|
||||
|
@ -78,7 +78,7 @@ while (($# > 0)); do
|
|||
rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
exit $ret
|
||||
) < /dev/null 2>&1 | tee test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
elif [[ "$V" == "2" ]]; then
|
||||
elif [[ $V == "2" ]]; then
|
||||
set -o pipefail
|
||||
(
|
||||
test_setup && test_run
|
||||
|
|
Loading…
Reference in New Issue