diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 10:33:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 10:33:11 +0000 |
commit | 203af7302854f453fa4a05ecefd4403b6c8a4f8d (patch) | |
tree | 967fdacafe332baabd12b57725505c138d0f3bbf /modules.d/99base | |
parent | Adding upstream version 102. (diff) | |
download | dracut-87aa6639b3cd2285afa2ea598366934b1a158354.tar.xz dracut-87aa6639b3cd2285afa2ea598366934b1a158354.zip |
Adding upstream version 103.upstream/103upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/99base')
-rwxr-xr-x | modules.d/99base/dracut-dev-lib.sh | 2 | ||||
-rwxr-xr-x | modules.d/99base/dracut-lib.sh | 20 | ||||
-rwxr-xr-x | modules.d/99base/init.sh | 2 |
3 files changed, 13 insertions, 11 deletions
diff --git a/modules.d/99base/dracut-dev-lib.sh b/modules.d/99base/dracut-dev-lib.sh index 5779508..6a443a6 100755 --- a/modules.d/99base/dracut-dev-lib.sh +++ b/modules.d/99base/dracut-dev-lib.sh @@ -30,7 +30,7 @@ dev_unit_name() { return $? fi - if [ "$dev" = "/" -o -z "$dev" ]; then + if [ "$dev" = "/" ] || [ -z "$dev" ]; then printf -- "-" return 0 fi diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index e83ee94..cbef2db 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -37,7 +37,7 @@ strstr() { # matches; as it would match anything, it's not an interesting case. strglob() { # shellcheck disable=SC2295 - [ -n "$1" -a -z "${1##$2}" ] + [ -n "$1" ] && [ -z "${1##$2}" ] } # returns OK if $1 contains (anywhere) a match of glob pattern $2 @@ -45,7 +45,7 @@ strglob() { # matches; as it would match anything, it's not an interesting case. strglobin() { # shellcheck disable=SC2295 - [ -n "$1" -a -z "${1##*$2*}" ] + [ -n "$1" ] && [ -z "${1##*$2*}" ] } # returns OK if $1 contains literal string $2 at the beginning, and isn't empty @@ -266,7 +266,7 @@ getargnum() { _b=$(getarg "$1") || _b=${_b:-"$_default"} if [ -n "$_b" ]; then isdigit "$_b" && _b=$((_b)) \ - && [ $_b -ge "$_min" ] && [ $_b -le "$_max" ] && echo $_b && return + && [ "$_b" -ge "$_min" ] && [ "$_b" -le "$_max" ] && echo "$_b" && return fi echo "$_default" } @@ -354,14 +354,14 @@ splitsep() { shift 2 local tmp - while [ -n "$str" -a "$#" -gt 1 ]; do + while [ -n "$str" ] && [ "$#" -gt 1 ]; do tmp="${str%%"$sep"*}" eval "$1='${tmp}'" str="${str#"$tmp"}" str="${str#"$sep"}" shift done - [ -n "$str" -a -n "$1" ] && eval "$1='$str'" + [ -n "$str" ] && [ -n "$1" ] && eval "$1='$str'" debug_on return 0 } @@ -937,15 +937,15 @@ _emergency_shell() { _ctty="$(RD_DEBUG='' getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}" if [ -z "$_ctty" ]; then _ctty=console - while [ -f /sys/class/tty/$_ctty/active ]; do - read -r _ctty < /sys/class/tty/$_ctty/active + while [ -f "/sys/class/tty/$_ctty/active" ]; do + read -r _ctty < "/sys/class/tty/$_ctty/active" _ctty=${_ctty##* } # last one in the list done _ctty=/dev/$_ctty fi [ -c "$_ctty" ] || _ctty=/dev/tty1 case "$(/usr/bin/setsid --help 2>&1)" in *--ctty*) CTTY="--ctty" ;; esac - setsid $CTTY /bin/sh -i -l 0<> $_ctty 1<> $_ctty 2<> $_ctty + setsid ${CTTY:+"${CTTY}"} /bin/sh -i -l 0<> "$_ctty" 1<> "$_ctty" 2<> "$_ctty" fi } @@ -1002,8 +1002,8 @@ export_n() { local var local val for var in "$@"; do - eval val=\$$var - unset $var + eval "val=\$$var" + unset "$var" [ -n "$val" ] && eval "$var=\"$val\"" done } diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh index 727f279..2a095a6 100755 --- a/modules.d/99base/init.sh +++ b/modules.d/99base/init.sh @@ -109,6 +109,8 @@ source_conf /etc/conf.d if getarg "rd.cmdline=ask"; then echo "Enter additional kernel command line parameter (end with ctrl-d or .)" + # In POSIX sh, read -p is undefined, but dash supports it + # shellcheck disable=SC3045 while read -r -p "> " ${BASH:+-e} line || [ -n "$line" ]; do [ "$line" = "." ] && break echo "$line" >> /etc/cmdline.d/99-cmdline-ask.conf |