aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-02-23 12:50:33 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-02-23 18:16:15 -0600
commit1cb44092fce298004ab4c4547c6fbcac29c5997f (patch)
tree82c1fa91c81470c80ce9f0bb402468d84753cdd1
parentmove init.d examples under support and install them (diff)
downloadopenrc-1cb44092fce298004ab4c4547c6fbcac29c5997f.zip
openrc-1cb44092fce298004ab4c4547c6fbcac29c5997f.tar.gz
openrc-1cb44092fce298004ab4c4547c6fbcac29c5997f.tar.bz2
sh/rc-functions.sh.in: add get_bootparam_value function
-rw-r--r--sh/rc-functions.sh.in34
1 files changed, 34 insertions, 0 deletions
diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
index 12eb4e2..7b771f8 100644
--- a/sh/rc-functions.sh.in
+++ b/sh/rc-functions.sh.in
@@ -85,6 +85,40 @@ get_bootparam()
return 1
}
+get_bootparam_value()
+{
+ local match="$1" which_value="$2" sep="$3" result value
+ if [ -n "$match" -a -r /proc/cmdline ]; then
+ set -- $(cat /proc/cmdline)
+ while [ -n "$1" ]; do
+ case "$1" in
+ $match=*)
+ value="${1##*=}"
+ case "$which_value" in
+ all)
+ [ -z "$sep" ] && sep=' '
+ if [ -z "$result" ]; then
+ result="$value"
+ else
+ result="${result}${sep}${value}"
+ fi
+ ;;
+ last)
+ result="$value"
+ ;;
+ *)
+ result="$value"
+ break
+ ;;
+ esac
+ ;;
+ esac
+ shift
+ done
+ fi
+ echo $result
+}
+
# Called from openrc-run.sh or gendepends.sh
_get_containers() {
local c