change "while read x" to cope with EOF without newline

while read x || [ -n "$x" ]

should do the trick
master
Harald Hoyer 2015-01-05 16:07:38 +01:00
parent 822a7ae504
commit 6d58fa27a4
54 changed files with 106 additions and 106 deletions

View File

@ -234,7 +234,7 @@ hostimage: all
@echo wrote test-$(shell uname -r).img

AUTHORS:
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS

dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html

View File

@ -309,7 +309,7 @@ get_fs_env() {
[[ $1 ]] || return
unset ID_FS_TYPE
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
| while read line; do
| while read line || [ -n "$line" ]; do
if [[ "$line" == TYPE\=* ]]; then
printf "%s" "${line#TYPE=}";
exit 0;
@ -435,7 +435,7 @@ find_block_device() {
if [[ $use_fstab != yes ]]; then
[[ -d $_find_mpt/. ]]
findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
while read _majmin _dev; do
while read _majmin _dev || [ -n "$_dev" ]; do
if [[ -b $_dev ]]; then
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
_majmin=$(get_maj_min $_dev)
@ -456,7 +456,7 @@ find_block_device() {
# fall back to /etc/fstab

findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
while read _majmin _dev; do
while read _majmin _dev || [ -n "$_dev" ]; do
if ! [[ $_dev ]]; then
_dev="$_majmin"
unset _majmin
@ -492,7 +492,7 @@ find_mp_fstype() {

if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --target "$1" | { \
while read _fs; do
while read _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@ -501,7 +501,7 @@ find_mp_fstype() {
fi

findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | { \
while read _fs; do
while read _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@ -528,7 +528,7 @@ find_dev_fstype() {

if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
while read _fs; do
while read _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@ -537,7 +537,7 @@ find_dev_fstype() {
fi

findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
while read _fs; do
while read _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
printf "%s" "$_fs"
@ -997,7 +997,7 @@ prepare_udev_rules() {
for f in "$@"; do
f="${initdir}/etc/udev/rules.d/$f"
[ -e "$f" ] || continue
while read line; do
while read line || [ -n "$line" ]; do
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
if [ $UDEVVERSION -ge 174 ]; then
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
@ -1512,7 +1512,7 @@ for_each_kmod_dep() {
local _func=$1 _kmod=$2 _cmd _modpath _options
shift 2
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
while read _cmd _modpath _options; do
while read _cmd _modpath _options || [ -n "$_cmd" ]; do
[[ $_cmd = insmod ]] || continue
$_func ${_modpath} || exit $?
done
@ -1528,7 +1528,7 @@ dracut_kernel_post() {
--ignore-install --show-depends --set-version $kernel \
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
| sort -u \
| while read _cmd _modpath _options; do
| while read _cmd _modpath _options || [ -n "$_cmd" ]; do
[[ $_cmd = insmod ]] || continue
echo "$_modpath"
done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
@ -1537,7 +1537,7 @@ dracut_kernel_post() {
if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
else
while read _modpath; do
while read _modpath || [ -n "$_modpath" ]; do
local _destpath=$_modpath
[[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/}
_destpath=${_destpath##*/lib/modules/$kernel/}
@ -1545,12 +1545,12 @@ dracut_kernel_post() {
done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
fi
) &
_pid=$(jobs -p | while read a ; do printf ":$a";done)
_pid=$(jobs -p | while read a || [ -n "$a" ]; do printf ":$a";done)
_pid=${_pid##*:}

if [[ $DRACUT_INSTALL ]]; then
xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
| while read line; do
| while read line || [ -n "$line" ]; do
for _fwdir in $fw_dir; do
echo $_fwdir/$line;
done;
@ -1635,7 +1635,7 @@ find_kernel_modules_by_path () {

_OLDIFS=$IFS
IFS=:
while read a rest; do
while read a rest || [ -n "$a" ]; do
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue
printf "%s\n" "$srcmods/$a"
done < "$srcmods/modules.dep"
@ -1730,7 +1730,7 @@ instmods() {
function instmods_1() {
local _mod _mpargs
if (($# == 0)); then # filenames from stdin
while read _mod; do
while read _mod || [ -n "$_mod" ]; do
inst1mod "${_mod%.ko*}" || {
if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
dfatal "Failed to install module $_mod"
@ -1753,7 +1753,7 @@ instmods() {
# Capture all stderr from modprobe to _fderr. We could use {var}>...
# redirections, but that would make dracut require bash4 at least.
eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \
| while read line; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
| while read line || [ -n "$line" ]; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror
_ret=$?
return $_ret
}

View File

@ -365,7 +365,7 @@ dlog() {
if (( $# > 1 )); then
_do_dlog "$@"
else
while read line; do
while read line || [ -n "$line" ]; do
_do_dlog "$1" "$line"
done
fi

View File

@ -1151,7 +1151,7 @@ done

for f in $add_fstab; do
[[ -e $f ]] || continue
while read dev rest; do
while read dev rest || [ -n "$dev" ]; do
push_host_devs "$dev"
done < "$f"
done
@ -1198,11 +1198,11 @@ if [[ $hostonly ]]; then
done

if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
while read dev type rest; do
while read dev type rest || [ -n "$dev" ]; do
[[ -b $dev ]] || continue
[[ "$type" == "partition" ]] || continue

while read _d _m _t _o _r; do
while read _d _m _t _o _r || [ -n "$_d" ]; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
[[ $_t != "swap" ]] && continue
@ -1212,7 +1212,7 @@ if [[ $hostonly ]]; then
[[ "$_d" -ef "$dev" ]] || continue

if [[ -f /etc/crypttab ]]; then
while read _mapper _a _p _o; do
while read _mapper _a _p _o || [ -n "$_mapper" ]; do
[[ $_mapper = \#* ]] && continue
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
[[ "$_o" ]] || _o="$_p"
@ -1231,8 +1231,8 @@ if [[ $hostonly ]]; then
# record all host modaliases
declare -A host_modalias
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
while read m; do
while read line; do
while read m || [ -n "$m" ]; do
while read line || [ -n "$line" ]; do
[[ "$line" != MODALIAS\=* ]] && continue
modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
break
@ -1241,14 +1241,14 @@ if [[ $hostonly ]]; then

rm -f -- "$initdir/.modalias"

while read _k _s _v; do
while read _k _s _v || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
host_modalias["$_v"]=1
done </proc/crypto

# check /proc/modules
declare -A host_modules
while read m rest; do
while read m rest || [ -n "$m" ]; do
host_modules["$m"]=1
done </proc/modules
fi
@ -1633,7 +1633,7 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then

# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f; do
| while read -r -d $'\0' f || [ -n "$f" ]; do
SIG=$(tail -c 28 "$f")
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
done | xargs -r -0 strip -g

View File

@ -149,7 +149,7 @@ list_files()


if (( ${#filenames[@]} <= 0 )); then
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
echo "========================================================================"
fi


View File

@ -138,7 +138,7 @@ install() {
local _line i
for i in "$1"/*.conf; do
[[ -f $i ]] || continue
while read _line; do
while read _line || [ -n "$_line" ]; do
case $_line in
\#*)
;;

View File

@ -59,8 +59,8 @@ do_rhevh_check()
kpath=${1}

# If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
@ -92,7 +92,7 @@ do_fips()
if ! modprobe "${_module}"; then
# check if kernel provides generic algo
_found=0
while read _k _s _v; do
while read _k _s _v || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_v" != "$_module" ] && continue
_found=1

View File

@ -4,7 +4,7 @@ capsmode=$(getarg rd.caps)

if [ "$capsmode" = "1" ]; then
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b ; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b || [ -n "$a" ]; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)


View File

@ -40,7 +40,7 @@ install() {
*) cmd=grep ;;
esac

for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a//\"/}; done); do
for INCL in $($cmd "^include " $MAP | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
findkeymap $FN
done
@ -114,12 +114,12 @@ install() {
rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
find "${initdir}${kbddir}/" -name README\* -delete
find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
| while read line; do
| while read line || [ -n "$line" ]; do
inst_multiple gzip
done

find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
| while read line; do
| while read line || [ -n "$line" ]; do
inst_multiple bzip2
done
}

View File

@ -74,7 +74,7 @@ rm -f -- "$testfile"
find_mount() {
local dev mnt etc wanted_dev
wanted_dev="$(readlink -e -q $1)"
while read dev mnt etc; do
while read dev mnt etc || [ -n "$dev" ]; do
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
done < /proc/mounts
return 1
@ -93,7 +93,7 @@ else
return 1
fi

while read a m a; do
while read a m a || [ -n "$m" ]; do
[ "$m" = "$1" ] && return 0
done < /proc/mounts
return 1

View File

@ -111,7 +111,7 @@ case $reason in
fi
unset layer2
setup_interface
set | while read line; do
set | while read line || [ -n "$line" ]; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
@ -132,7 +132,7 @@ case $reason in
echo "dhcp: BOND6 setting $netif"
setup_interface6

set | while read line; do
set | while read line || [ -n "$line" ]; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts

View File

@ -22,7 +22,7 @@ get_config_line_by_subchannel()
local line

CHANNELS="$1"
while read line; do
while read line || [ -n "$line" ]; do
if strstr "$line" "$CHANNELS"; then
echo $line
return 0

View File

@ -120,7 +120,7 @@ command -v ctorrent >/dev/null \

nfs_already_mounted() {
local server="$1" path="$2" localdir="" s="" p=""
cat /proc/mounts | while read src mnt rest; do
cat /proc/mounts | while read src mnt rest || [ -n "$src" ]; do
splitsep ":" "$src" s p
if [ "$server" = "$s" ]; then
if [ "$path" = "$p" ]; then

View File

@ -22,7 +22,7 @@ installkernel() {
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
while read _fname || [ -n "$_fname" ]; do
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
@ -35,7 +35,7 @@ installkernel() {
}
function rotor() {
local _f1 _f2
while read _f1; do
while read _f1 || [ -n "$_f1" ]; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}

View File

@ -26,7 +26,7 @@ if [[ $hostonly ]]; then
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
inst /usr/share/plymouth/themes/default.plymouth
# Install plugin for this theme
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
fi
else

View File

@ -42,7 +42,7 @@ function dasd_settle() {
}

function dasd_settle_all() {
for dasdccw in $(while read line; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
for dasdccw in $(while read line || [ -n "$line" ]; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
if ! dasd_settle $dasdccw ; then
echo $"Could not access DASD $dasdccw in time"
return 1
@ -84,7 +84,7 @@ function readcmsfile() # $1=dasdport $2=filename
# dasd_mod must be loaded without setting any DASD online
dev=$(canonicalize_devno $1)
numcpus=$(
while read line; do
while read line || [ -n "$line" ]; do
if strstr "$line" "# processors"; then
echo ${line##*:};
break;
@ -181,7 +181,7 @@ processcmsfile()

unset _do_zfcp
for i in ${!FCP_*}; do
echo "${!i}" | while read port rest; do
echo "${!i}" | while read port rest || [ -n "$port" ]; do
case $port in
*.*.*)
;;

View File

@ -7,7 +7,7 @@ crypttab_contains() {
local luks="$1"
local l d rest
if [ -f /etc/crypttab ]; then
while read l d rest; do
while read l d rest || [ -n "$l" ]; do
strstr "${l##luks-}" "${luks##luks-}" && return 0
strstr "$d" "${luks##luks-}" && return 0
done < /etc/crypttab
@ -155,7 +155,7 @@ getkey() {
[ -f "$keys_file" ] || return 1

local IFS=:
while read luks_dev key_dev key_path; do
while read luks_dev key_dev key_path || [ -n "$luks_dev" ]; do
if match_dev "$luks_dev" "$for_dev"; then
echo "${key_dev}:${key_path}"
return 0

View File

@ -23,7 +23,7 @@ numtries=${3:-10}

# TODO: improve to support what cmdline does
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; then
while read name dev luksfile luksoptions; do
while read name dev luksfile luksoptions || [ -n "$name" ]; do
# ignore blank lines and comments
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
continue

View File

@ -35,7 +35,7 @@ cmdline() {

UUID=$(
blkid -u crypto -o export $dev \
| while read line; do
| while read line || [ -n "$line" ]; do
[[ ${line#UUID} = $line ]] && continue
printf "%s" "${line#UUID=}"
break
@ -65,7 +65,7 @@ install() {

if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
# filter /etc/crypttab for the devices we need
while read _mapper _dev _rest; do
while read _mapper _dev _rest || [ -n "$_mapper" ]; do
[[ $_mapper = \#* ]] && continue
[[ $_dev ]] || continue


View File

@ -9,7 +9,7 @@ installkernel() {
local _merge=8 _side2=9
function bmf1() {
local _f
while read _f; do case "$_f" in
while read _f || [ -n "$_f" ]; do case "$_f" in
*.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
*.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
*.ko.xz) [[ $(xz -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
@ -19,7 +19,7 @@ installkernel() {
}
function rotor() {
local _f1 _f2
while read _f1; do
while read _f1 || [ -n "$_f1" ]; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}

View File

@ -46,7 +46,7 @@ cmdline() {

UUID=$(
/sbin/mdadm --examine --export $dev \
| while read line; do
| while read line || [ -n "$line" ]; do
[[ ${line#MD_UUID=} = $line ]] && continue
printf "%s" "${line#MD_UUID=} "
done

View File

@ -10,7 +10,7 @@ else
if [ -n "$MD_UUID" ]; then
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
[ -e "$f" ] || continue
while read line; do
while read line || [ -n "$line" ]; do
if [ "${line%%UUID CHECK}" != "$line" ]; then
printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
for uuid in $MD_UUID; do

View File

@ -46,7 +46,7 @@ installkernel() {
local _merge=8 _side2=9
function bmf1() {
local _f
while read _f; do
while read _f || [ -n "$_f" ]; do
case "$_f" in
*.ko) [[ $(< $_f) =~ $_funcs ]] && echo "$_f" ;;
*.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
@ -58,7 +58,7 @@ installkernel() {

function rotor() {
local _f1 _f2
while read _f1; do
while read _f1 || [ -n "$_f1" ]; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}

View File

@ -7,7 +7,7 @@ fstab_mount() {
local _dev _mp _fs _opts _dump _pass _rest
test -e "$1" || return 1
info "Mounting from $1"
while read _dev _mp _fs _opts _dump _pass _rest; do
while read _dev _mp _fs _opts _dump _pass _rest || [ -n "$_dev" ]; do
[ -z "${_dev%%#*}" ] && continue # Skip comment lines
ismounted $_mp && continue # Skip mounted filesystem
if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then

View File

@ -123,7 +123,7 @@ handle_netroot()

if [ -z $iscsi_initiator ]; then
if [ -f /sys/firmware/ibft/initiator/initiator-name ]; then
iscsi_initiator=$(while read line; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
fi
fi


View File

@ -166,7 +166,7 @@ installkernel() {
local _merge=8 _side2=9
function bmf1() {
local _f
while read _f; do
while read _f || [ -n "$_f" ]; do
case "$_f" in
*.ko) [[ $(< $_f) =~ $_funcs ]] && echo "$_f" ;;
*.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
@ -178,7 +178,7 @@ installkernel() {

function rotor() {
local _f1 _f2
while read _f1; do
while read _f1 || [ -n "$_f1" ]; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}

View File

@ -81,7 +81,7 @@ mount_root() {
# the root filesystem,
# remount it with the proper options
rootopts="defaults"
while read dev mp fs opts dump fsck; do
while read dev mp fs opts dump fsck || [ -n "$dev" ]; do
# skip comments
[ "${dev%%#*}" != "$dev" ] && continue


View File

@ -44,7 +44,7 @@ inst_sshenv()
if [[ -f /etc/ssh/ssh_config ]]; then
inst_simple /etc/ssh/ssh_config
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
while read key val; do
while read key val || [ -n "$key" ]; do
[[ $key != "GlobalKnownHostsFile" ]] && continue
inst_simple "$val"
break

View File

@ -42,7 +42,7 @@ mount_root() {
# the root filesystem,
# remount it with the proper options
rootopts="defaults"
while read dev mp fs opts rest; do
while read dev mp fs opts rest || [ -n "$dev" ]; do
# skip comments
[ "${dev%%#*}" != "$dev" ] && continue


View File

@ -10,7 +10,7 @@ echo
echo
echo
echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
while read -e -p "> " line; do
while read -e -p "> " line || [ -n "$line" ]; do
[[ "$line" == "." ]] && break
[[ "$line" ]] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
done

View File

@ -52,7 +52,7 @@ mount_usr()
{
local _dev _mp _fs _opts _rest _usr_found _ret _freq _passno
# check, if we have to mount the /usr filesystem
while read _dev _mp _fs _opts _freq _passno; do
while read _dev _mp _fs _opts _freq _passno || [ -n "$_dev" ]; do
[ "${_dev%%#*}" != "$_dev" ] && continue
if [ "$_mp" = "/usr" ]; then
case "$_dev" in

View File

@ -79,13 +79,13 @@ else
fi

vwarn() {
while read line; do
while read line || [ -n "$line" ]; do
warn $line;
done
}

vinfo() {
while read line; do
while read line || [ -n "$line" ]; do
info $line;
done
}
@ -131,7 +131,7 @@ getcmdline() {
unset _line

if [ -e /etc/cmdline ]; then
while read -r _line; do
while read -r _line || [ -n "$_line" ]; do
CMDLINE_ETC="$CMDLINE_ETC $_line";
done </etc/cmdline;
fi
@ -506,7 +506,7 @@ incol2() {
[ -z "$file" ] && return 1;
[ -z "$str" ] && return 1;

while read dummy check restofline; do
while read dummy check restofline || [ -n "$check" ]; do
if [ "$check" = "$str" ]; then
debug_on
return 0
@ -539,7 +539,7 @@ udevproperty() {
find_mount() {
local dev mnt etc wanted_dev
wanted_dev="$(readlink -e -q $1)"
while read dev mnt etc; do
while read dev mnt etc || [ -n "$dev" ]; do
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
done < /proc/mounts
return 1
@ -558,7 +558,7 @@ else
return 1
fi

while read a m a; do
while read a m a || [ -n "$m" ]; do
[ "$m" = "$1" ] && return 0
done < /proc/mounts
return 1
@ -1007,7 +1007,7 @@ wait_for_loginit()

if [ $i -eq 10 ]; then
kill %1 >/dev/null 2>&1
kill $(while read line;do echo $line;done</run/initramfs/loginit.pid)
kill $(while read line || [ -n "$line" ];do echo $line;done</run/initramfs/loginit.pid)
fi

setdebug
@ -1289,7 +1289,7 @@ show_memstats()
remove_hostonly_files() {
rm -fr /etc/cmdline /etc/cmdline.d/*.conf
if [ -f /lib/dracut/hostonly-files ]; then
while read -r line; do
while read line || [ -n "$line" ]; do
[ -e "$line" ] || [ -h "$line" ] || continue
rm -f "$line"
done < /lib/dracut/hostonly-files

View File

@ -72,7 +72,7 @@ fi

if command -v kmod >/dev/null 2>/dev/null; then
kmod static-nodes --format=tmpfiles 2>/dev/null | \
while read type file mode a a a majmin; do
while read type file mode a a a majmin || [ -n "$type" ]; do
type=${type%\!}
case $type in
d)
@ -113,7 +113,7 @@ source_conf /etc/conf.d

if getarg "rd.cmdline=ask"; then
echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
while read -p "> " line; do
while read -p "> " line || [ -n "$line" ]; do
[ "$line" = "." ] && break
echo "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
done
@ -254,7 +254,7 @@ done

{
echo -n "Mounted root filesystem "
while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
while read dev mp rest || [ -n "$dev" ]; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo

# pre pivot scripts are sourced just before we doing cleanup and switch over

View File

@ -10,7 +10,7 @@ printf -- "$$" > /run/initramfs/loginit.pid
[ -e /dev/kmsg ] && exec 5>/dev/kmsg || exec 5>/dev/null
exec 6>/run/initramfs/init.log

while read line; do
while read line || [ -n "$line" ]; do
if [ "$line" = "DRACUT_LOG_END" ]; then
rm -f -- /run/initramfs/loginit.pipe
exit 0

View File

@ -141,7 +141,7 @@ fsck_single() {

[ $# -lt 2 ] && return 255
# if UUID= marks more than one device, take only the first one
[ -e "$_dev" ] || _dev=$(devnames "$_dev"| while read line; do if [ -n "$line" ]; then echo $line; break;fi;done)
[ -e "$_dev" ] || _dev=$(devnames "$_dev"| while read line || [ -n "$line" ]; do if [ -n "$line" ]; then echo $line; break;fi;done)
[ -e "$_dev" ] || return 255
_fs=$(det_fs "$_dev" "$_fs")
fsck_able "$_fs" || return 255
@ -186,7 +186,7 @@ det_fs() {
local _fs

_fs=$(udevadm info --query=env --name="$_dev" | \
while read line; do
while read line || [ -n "$line" ]; do
if str_starts $line "ID_FS_TYPE="; then
echo ${line#ID_FS_TYPE=}
break

View File

@ -38,7 +38,7 @@ killall_proc_mountpoint /oldroot

umount_a() {
local _did_umount="n"
while read a mp a; do
while read a mp a || [ -n "$mp" ]; do
if strstr "$mp" oldroot; then
if umount "$mp"; then
_did_umount="y"

View File

@ -2,7 +2,7 @@
>/dev/watchdog
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
echo "dracut-root-block-success" >/dev/sdb

View File

@ -1,7 +1,7 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
exec </dev/console >/dev/console 2>&1
echo "dracut-root-block-success" >/dev/sda1

View File

@ -2,12 +2,12 @@
>/dev/watchdog
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
exec </dev/console >/dev/console 2>&1

ismounted() {
while read a m a; do
while read a m a || [ -n "$m" ]; do
[ "$m" = "$1" ] && return 0
done < /proc/mounts
return 1

View File

@ -2,12 +2,12 @@
>/dev/watchdog
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
exec </dev/console >/dev/console 2>&1

ismounted() {
while read a m a; do
while read a m a || [ -n "$a" ]; do
[ "$m" = "$1" ] && return 0
done < /proc/mounts
return 1

View File

@ -163,7 +163,7 @@ EOF
/etc/security \
/lib64/security \
/lib/security -xtype f \
| while read file; do
| while read file || [ -n "$file" ]; do
inst_multiple -o $file
done

@ -193,7 +193,7 @@ EOF

# install any Execs from the service files
egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
| while read i; do
| while read i || [ -n "$i" ]; do
i=${i##Exec*=}; i=${i##-}
inst_multiple -o $i
done

View File

@ -35,6 +35,6 @@ lvm lvchange -a n /dev/dracut/root
udevadm settle
cryptsetup luksClose /dev/mapper/dracut_crypt_test
udevadm settle
eval $(udevadm info --query=env --name=/dev/md0|while read line; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
eval $(udevadm info --query=env --name=/dev/md0|while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
{ echo "dracut-root-block-created"; echo "ID_FS_UUID=$ID_FS_UUID"; } >/dev/sda1
poweroff -f

View File

@ -1,7 +1,7 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
command -v plymouth >/dev/null && plymouth --quit
exec >/dev/console 2>&1
echo "dracut-root-block-success" >/dev/sda1

View File

@ -1,7 +1,7 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
echo "dracut-root-block-success" >/dev/sda1

View File

@ -42,5 +42,5 @@ udevadm settle
mdadm -W /dev/md0 || :
mdadm --detail --export /dev/md0 |grep -F MD_UUID > /tmp/mduuid
. /tmp/mduuid
eval $(udevadm info --query=env --name=/dev/md0|while read line; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
eval $(udevadm info --query=env --name=/dev/md0|while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
{ echo "dracut-root-block-created"; echo MD_UUID=$MD_UUID; echo "ID_FS_UUID=$ID_FS_UUID";} > /dev/sda1

View File

@ -1,7 +1,7 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
command -v plymouth >/dev/null && plymouth --quit
exec >/dev/console 2>&1
echo "dracut-root-block-success" >/dev/sda1

View File

@ -1,7 +1,7 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
echo "dracut-root-block-success" >/dev/sda

View File

@ -1,7 +1,7 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
echo "dracut-root-block-success" >/dev/sda

View File

@ -1,7 +1,7 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
echo "dracut-root-block-success" >/dev/sda1

View File

@ -3,7 +3,7 @@ export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec >/dev/console 2>&1
export TERM=linux
export PS1='initramfs-test:\w\$ '
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
strstr() { [ "${1##*"$2"*}" != "$1" ]; }

stty sane
@ -15,7 +15,7 @@ fi

echo "made it to the rootfs! Powering down."

while read dev fs fstype opts rest; do
while read dev fs fstype opts rest || [ -n "$dev" ]; do
[ "$fstype" != "nfs" -a "$fstype" != "nfs4" ] && continue
echo "nfs-OK $dev $fstype $opts" > /dev/sda
break

View File

@ -2,12 +2,12 @@
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec >/dev/console 2>&1
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."
while read dev fs fstype opts rest; do
while read dev fs fstype opts rest || [ -n "$dev" ]; do
[ "$fstype" != "ext3" ] && continue
echo "iscsi-OK $dev $fstype $opts" > /dev/sda
break

View File

@ -2,7 +2,7 @@
>/dev/watchdog
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec >/dev/console 2>&1
while read dev fs fstype opts rest; do
while read dev fs fstype opts rest || [ -n "$dev" ]; do
[ "$dev" = "rootfs" ] && continue
[ "$fs" != "/" ] && continue
echo "nbd-OK $fstype $opts" >/dev/sda

View File

@ -25,6 +25,6 @@ udevadm settle
cryptsetup luksClose /dev/mapper/dracut_crypt_test
udevadm settle
sleep 1
eval $(udevadm info --query=env --name=/dev/sdb|while read line; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
eval $(udevadm info --query=env --name=/dev/sdb|while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
{ echo "dracut-root-block-created"; echo "ID_FS_UUID=$ID_FS_UUID"; } >/dev/sda
poweroff -f

View File

@ -4,7 +4,7 @@ set -x
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
strglobin() { [ -n "$1" -a -z "${1##*$2*}" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane