From b56690548449e96d7af3c794434ba89ae0c7fc88 Mon Sep 17 00:00:00 2001 From: Kerin Millar Date: Tue, 11 Jun 2024 06:48:11 +0100 Subject: 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 --- 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=. -- cgit v1.2.3-65-gdbad