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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8F1DF15817D for ; Fri, 21 Jun 2024 13:14:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BC1EBE2AB2; Fri, 21 Jun 2024 13:14:20 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 788FFE2AAF for ; Fri, 21 Jun 2024 13:14:20 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5C6C033F9FD for ; Fri, 21 Jun 2024 13:14:19 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D72401D5E for ; Fri, 21 Jun 2024 13:14:15 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1718324864.9bc6cee2b8e1325b096cf91fe7f58918b79ee7ba.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 9bc6cee2b8e1325b096cf91fe7f58918b79ee7ba X-VCS-Branch: master Date: Fri, 21 Jun 2024 13:14:15 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 77300cdb-98c9-4670-b523-e4871c3c2549 X-Archives-Hash: 454f7ef38ad85fb9ec2eadedd9fc962e commit: 9bc6cee2b8e1325b096cf91fe7f58918b79ee7ba Author: Kerin Millar plushkava net> AuthorDate: Mon Jun 10 23:47:14 2024 +0000 Commit: Sam James gentoo org> CommitDate: Fri Jun 14 00:27:44 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=9bc6cee2 Add the from_portage() function The function determines whether the current shell appears to be a subprocess of portage. Signed-off-by: Kerin Millar plushkava.net> functions.sh | 39 ++++++++++++++++++++++++--------------- 1 file 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 ################################################################################ @@ -306,6 +307,14 @@ ewend() GENFUN_CALLER=${GENFUN_CALLER:-ewend} _eend ewarn "$@" } +# +# 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=.