getarg() { local o line if [ -z "$CMDLINE" ]; then read CMDLINE_ETC dracut: FATAL: $@"; echo "<1>dracut: Refusing to continue"; } > /dev/kmsg { echo "dracut: FATAL: $@"; echo "dracut: Refusing to continue"; } >&2 exit 1 } warn() { echo "<4>dracut Warning: $@" > /dev/kmsg echo "dracut Warning: $@" >&2 } info() { if [ -z "$DRACUT_QUIET" ]; then DRACUT_QUIET="no" getarg quiet && DRACUT_QUIET="yes" fi echo "<6>dracut: $@" > /dev/kmsg [ "$DRACUT_QUIET" != "yes" ] && \ echo "dracut: $@" } vinfo() { while read line; do info $line; done } check_occurances() { # Count the number of times the character $ch occurs in $str # Return 0 if the count matches the expected number, 1 otherwise local str="$1" local ch="$2" local expected="$3" local count=0 while [ "${str#*$ch}" != "${str}" ]; do str="${str#*$ch}" count=$(( $count + 1 )) done [ $count -eq $expected ] } incol2() { local dummy check; local file="$1"; local str="$2"; [ -z "$file" ] && return; [ -z "$str" ] && return; while read dummy check restofline; do [ "$check" = "$str" ] && return 0 done < $file return 1 }