summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2024-06-11 00:47:14 +0100
committerKerin Millar <kfm@plushkava.net>2024-06-14 01:27:44 +0100
commit9bc6cee2b8e1325b096cf91fe7f58918b79ee7ba (patch)
treed515204993be5cd38b118e782fca97cd4dc79627
parentRectify a typo for _update_tty_level() (diff)
downloadgentoo-functions-9bc6cee2b8e1325b096cf91fe7f58918b79ee7ba.tar.gz
gentoo-functions-9bc6cee2b8e1325b096cf91fe7f58918b79ee7ba.tar.bz2
gentoo-functions-9bc6cee2b8e1325b096cf91fe7f58918b79ee7ba.zip
Add the from_portage() function
The function determines whether the current shell appears to be a subprocess of portage. Signed-off-by: Kerin Millar <kfm@plushkava.net>
-rw-r--r--functions.sh39
1 files changed, 24 insertions, 15 deletions
diff --git a/functions.sh b/functions.sh
index 0cd5316..8963b12 100644
--- a/functions.sh
+++ b/functions.sh
@@ -11,21 +11,22 @@
# The following variables affect initialisation and/or function behaviour.
-# BASH : whether bash-specific features may be employed
-# BASH_VERSINFO : whether bash-specific features may be employed
-# BASHPID : potentially used by _update_columns() to detect subshells
-# COLUMNS : potentially used by _update_columns() to get the column count
-# EERROR_QUIET : whether error printing functions should be silenced
-# EINFO_LOG : whether printing functions should call esyslog()
-# EINFO_QUIET : whether info message printing functions should be silenced
-# EINFO_VERBOSE : whether v-prefixed functions should do anything
-# EPOCHREALTIME : potentially used by _update_time() to get the time
-# IFS : multiple message operands are joined by its first character
-# INSIDE_EMACS : whether to work around an emacs-specific bug in _eend()
-# NO_COLOR : whether colored output should be suppressed
-# RC_NOCOLOR : like NO_COLOR but deprecated
-# TEST_GENFUNCS : used for testing the behaviour of get_bootparam()
-# TERM : may influence message formatting and whether color is used
+# BASH : whether bash-specific features may be employed
+# BASH_VERSINFO : whether bash-specific features may be employed
+# BASHPID : may be used by _update_columns() to detect subshells
+# COLUMNS : may be used by _update_columns() to get the column count
+# EERROR_QUIET : whether error printing functions should be silenced
+# EINFO_LOG : whether printing functions should call esyslog()
+# EINFO_QUIET : whether info message printing functions should be silenced
+# EINFO_VERBOSE : whether v-prefixed functions should do anything
+# EPOCHREALTIME : potentially used by _update_time() to get the time
+# IFS : multiple message operands are joined by its first character
+# INSIDE_EMACS : whether to work around an emacs-specific bug in _eend()
+# NO_COLOR : whether colored output should be suppressed
+# PORTAGE_BIN_PATH : used by from_portage()
+# RC_NOCOLOR : like NO_COLOR but deprecated
+# TEST_GENFUNCS : used for testing the behaviour of get_bootparam()
+# TERM : may influence message formatting and whether color is used
################################################################################
@@ -307,6 +308,14 @@ ewend()
}
#
+# Determines whether the current shell is a subprocess of portage.
+#
+from_portage()
+{
+ test "${PORTAGE_BIN_PATH}"
+}
+
+#
# Determines whether the kernel cmdline contains the specified parameter as a
# component of a comma-separated list specified in the format of gentoo=<list>.
#