summaryrefslogtreecommitdiff
path: root/configs/releng/root-image/etc/archiso/functions
diff options
context:
space:
mode:
Diffstat (limited to 'configs/releng/root-image/etc/archiso/functions')
-rw-r--r--configs/releng/root-image/etc/archiso/functions20
1 files changed, 20 insertions, 0 deletions
diff --git a/configs/releng/root-image/etc/archiso/functions b/configs/releng/root-image/etc/archiso/functions
new file mode 100644
index 0000000..9fffdcb
--- /dev/null
+++ b/configs/releng/root-image/etc/archiso/functions
@@ -0,0 +1,20 @@
+# vim: set ft=sh:
+
+# kernel_cmdline <param> <default>
+# Looks for a parameter on the kernel's boot-time command line.
+#
+# returns: 0 if param was found. Also prints its value if it was a K=V param.
+# 1 if it was not. Also prints value passed as <default>
+#
+kernel_cmdline ()
+{
+ for param in $(/bin/cat /proc/cmdline); do
+ case "${param}" in
+ $1=*) echo "${param##*=}"; return 0 ;;
+ $1) return 0 ;;
+ *) continue ;;
+ esac
+ done
+ [ -n "${2}" ] && echo "${2}"
+ return 1
+}