From: Harald Hoyer Date: Fri, 18 Sep 2009 07:08:23 +0000 (+0200) Subject: dracut-gencmdline: add missing functions X-Git-Tag: 003~172 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5e5ec023bedc14d709f1d5f8e2803ba171b05daa;p=thirdparty%2Fdracut.git dracut-gencmdline: add missing functions --- diff --git a/dracut-gencmdline b/dracut-gencmdline index bab102f45..f3cbee146 100755 --- a/dracut-gencmdline +++ b/dracut-gencmdline @@ -19,6 +19,39 @@ # #. /usr/libexec/initrd-functions +IF_verbose="" +function set_verbose() { + case $1 in + 1|true|yes|on) + IF_verbose="-v" + ;; + 0|false|no|off) + IF_verbose="" + ;; + esac +} + +function is_verbose() { + [ -n "$IF_verbose" ] && return 0 + return 1 +} + +function get_verbose() { + echo "$IF_verbose" + is_verbose +} + + +function get_numeric_dev() { +( + fmt="%d:%d" + if [ "$1" == "hex" ]; then + fmt="%x:%x" + fi + ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }' +) 2>/dev/null +} + function error() { echo "$@" >&2