From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0B343139694 for ; Fri, 24 Feb 2017 00:19:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 38CF421C028; Fri, 24 Feb 2017 00:19:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 13B4821C028 for ; Fri, 24 Feb 2017 00:19:03 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 005953416AB for ; Fri, 24 Feb 2017 00:19:02 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 92705525C for ; Fri, 24 Feb 2017 00:19:00 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1487895375.1cb44092fce298004ab4c4547c6fbcac29c5997f.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: sh/ X-VCS-Repository: proj/openrc X-VCS-Files: sh/rc-functions.sh.in X-VCS-Directories: sh/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 1cb44092fce298004ab4c4547c6fbcac29c5997f X-VCS-Branch: master Date: Fri, 24 Feb 2017 00:19:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 14d2f611-c31c-4d71-819d-7fbe70eb8a35 X-Archives-Hash: c65cf17112f23e4768ff56917a2b7350 commit: 1cb44092fce298004ab4c4547c6fbcac29c5997f Author: William Hubbs gmail com> AuthorDate: Thu Feb 23 18:50:33 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Fri Feb 24 00:16:15 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1cb44092 sh/rc-functions.sh.in: add get_bootparam_value function sh/rc-functions.sh.in | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in index 12eb4e2a..7b771f82 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