* [gentoo-dev] [PATCH] eclass/acct-user.eclass: disable pkg_* on Prefix.
@ 2020-02-18 13:02 heroxbd
2020-02-18 13:56 ` Michael 'veremitz' Everitt
0 siblings, 1 reply; 3+ messages in thread
From: heroxbd @ 2020-02-18 13:02 UTC (permalink / raw
To: gentoo-dev; +Cc: Benda Xu
From: Benda Xu <heroxbd@gentoo.org>
Gentoo Prefix runs with a normal user and cannot manage any other user.
Exit gracefully with a message.
Closes: https://bugs.gentoo.org/709570
Signed-off-by: Benda Xu <heroxbd@gentoo.org>
---
eclass/acct-user.eclass | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index be6b3dd3e600..e3ec3966035d 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -360,6 +360,11 @@ acct-user_pkg_preinst() {
acct-user_pkg_postinst() {
debug-print-function ${FUNCNAME} "${@}"
+ if [[ ${EUID} != 0 ]] ; then
+ einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
+ return 0
+ fi
+
# NB: eset* functions check current value
esethome "${ACCT_USER_NAME}" "${ACCT_USER_HOME}"
esetshell "${ACCT_USER_NAME}" "${ACCT_USER_SHELL}"
@@ -376,6 +381,11 @@ acct-user_pkg_postinst() {
acct-user_pkg_prerm() {
debug-print-function ${FUNCNAME} "${@}"
+ if [[ ${EUID} != 0 ]] ; then
+ einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
+ return 0
+ fi
+
if [[ -z ${REPLACED_BY_VERSION} ]]; then
if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then
ewarn "User account not found: ${ACCT_USER_NAME}"
--
2.25.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] [PATCH] eclass/acct-user.eclass: disable pkg_* on Prefix.
2020-02-18 13:02 [gentoo-dev] [PATCH] eclass/acct-user.eclass: disable pkg_* on Prefix heroxbd
@ 2020-02-18 13:56 ` Michael 'veremitz' Everitt
2020-02-19 4:05 ` Benda Xu
0 siblings, 1 reply; 3+ messages in thread
From: Michael 'veremitz' Everitt @ 2020-02-18 13:56 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1.1: Type: text/plain, Size: 1431 bytes --]
On 18/02/20 13:02, heroxbd@gentoo.org wrote:
> From: Benda Xu <heroxbd@gentoo.org>
>
> Gentoo Prefix runs with a normal user and cannot manage any other user.
> Exit gracefully with a message.
>
> Closes: https://bugs.gentoo.org/709570
> Signed-off-by: Benda Xu <heroxbd@gentoo.org>
> ---
> eclass/acct-user.eclass | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
> index be6b3dd3e600..e3ec3966035d 100644
> --- a/eclass/acct-user.eclass
> +++ b/eclass/acct-user.eclass
> @@ -360,6 +360,11 @@ acct-user_pkg_preinst() {
> acct-user_pkg_postinst() {
> debug-print-function ${FUNCNAME} "${@}"
>
> + if [[ ${EUID} != 0 ]] ; then
> + einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
> + return 0
> + fi
> +
> # NB: eset* functions check current value
> esethome "${ACCT_USER_NAME}" "${ACCT_USER_HOME}"
> esetshell "${ACCT_USER_NAME}" "${ACCT_USER_SHELL}"
> @@ -376,6 +381,11 @@ acct-user_pkg_postinst() {
> acct-user_pkg_prerm() {
> debug-print-function ${FUNCNAME} "${@}"
>
> + if [[ ${EUID} != 0 ]] ; then
> + einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
> + return 0
> + fi
> +
> if [[ -z ${REPLACED_BY_VERSION} ]]; then
> if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then
> ewarn "User account not found: ${ACCT_USER_NAME}"
Peanut gallery says 'ACK' +1....
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] [PATCH] eclass/acct-user.eclass: disable pkg_* on Prefix.
2020-02-18 13:56 ` Michael 'veremitz' Everitt
@ 2020-02-19 4:05 ` Benda Xu
0 siblings, 0 replies; 3+ messages in thread
From: Benda Xu @ 2020-02-19 4:05 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 134 bytes --]
Michael 'veremitz' Everitt <gentoo@veremit.xyz> writes:
> Peanut gallery says 'ACK' +1....
Thank you veremitz. Let's see :)
Benda
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-19 4:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-18 13:02 [gentoo-dev] [PATCH] eclass/acct-user.eclass: disable pkg_* on Prefix heroxbd
2020-02-18 13:56 ` Michael 'veremitz' Everitt
2020-02-19 4:05 ` Benda Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox