dracut-lib add getargs()
authorHarald Hoyer <harald@redhat.com>
Wed, 15 Jul 2009 16:24:01 +0000 (18:24 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 15 Jul 2009 16:27:20 +0000 (18:27 +0200)
getargs returns a space seperated list with all values found for a key
on the kernel command line

modules.d/99base/dracut-lib.sh

index 96ecbb0..a26949c 100644 (file)
@@ -8,6 +8,20 @@ getarg() {
     return 1
 }
 
+getargs() {
+    local o line found
+    [ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
+    for o in $CMDLINE; do
+       [ "$o" = "$1" ] && return 0
+       if [ "${o%%=*}" = "${1%=}" ]; then
+           echo -n "${o#*=} "; 
+           found=1;
+       fi
+    done
+    [ -n "$found" ] && return 0
+    return 1
+}
+
 source_all() {
     local f
     [ "$1" ] && [  -d "/$1" ] || return