summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2024-06-11 06:48:11 +0100
committerKerin Millar <kfm@plushkava.net>2024-06-14 01:27:44 +0100
commitb56690548449e96d7af3c794434ba89ae0c7fc88 (patch)
tree80218f99e908edc5abacaa0fec084911c08e8b5c
parentAdd the from_portage() function (diff)
downloadgentoo-functions-b56690548449e96d7af3c794434ba89ae0c7fc88.tar.gz
gentoo-functions-b56690548449e96d7af3c794434ba89ae0c7fc88.tar.bz2
gentoo-functions-b56690548449e96d7af3c794434ba89ae0c7fc88.zip
Add the from_runscript() function
The function determines whether the current shell is executing an OpenRC runscript, or is a subprocess of one. Signed-off-by: Kerin Millar <kfm@plushkava.net>
-rw-r--r--functions.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/functions.sh b/functions.sh
index 8963b12..605aa48 100644
--- a/functions.sh
+++ b/functions.sh
@@ -316,6 +316,15 @@ from_portage()
}
#
+# Determines whether the current shell is executing an OpenRC runscript, or is
+# a subprocess of one.
+#
+from_runscript()
+{
+ has_openrc && test "${RC_OPENRC_PID}"
+}
+
+#
# Determines whether the kernel cmdline contains the specified parameter as a
# component of a comma-separated list specified in the format of gentoo=<list>.
#