commit: b56690548449e96d7af3c794434ba89ae0c7fc88 Author: Kerin Millar <kfm <AT> plushkava <DOT> net> AuthorDate: Tue Jun 11 05:48:11 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Jun 14 00:27:44 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=b5669054
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 <AT> plushkava.net> functions.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/functions.sh b/functions.sh index 8963b12..605aa48 100644 --- a/functions.sh +++ b/functions.sh @@ -315,6 +315,15 @@ from_portage() test "${PORTAGE_BIN_PATH}" } +# +# 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>.