[PATCH 01/14] dracut-lib add getargs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



getargs returns a space seperated list with all values found for a key
on the kernel command line
---
 modules.d/99base/dracut-lib.sh |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 96ecbb0..a26949c 100644
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -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
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux