From 1210a818074c9df993319a1122d0ff54477d03c5 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sat, 1 Jun 2024 01:17:28 -0300 Subject: [PATCH] Update issourcezap-member --- libexec/sourcezap/commands/sourcezap-checkout | 2 +- libexec/sourcezap/commands/sourcezap-clone | 2 +- libexec/sourcezap/commands/sourcezap-pull | 2 +- libexec/sourcezap/utils/issourcezap-member | 13 +++++-------- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/libexec/sourcezap/commands/sourcezap-checkout b/libexec/sourcezap/commands/sourcezap-checkout index ab71ed6..6cc6117 100755 --- a/libexec/sourcezap/commands/sourcezap-checkout +++ b/libexec/sourcezap/commands/sourcezap-checkout @@ -32,7 +32,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/utils/issourcezap-member; then +if ! "${libexec}"/utils/issourcezap-member > /dev/null 2>&1; then printerr "$(id -un) is not a member of _sourcezap" exit 1 fi diff --git a/libexec/sourcezap/commands/sourcezap-clone b/libexec/sourcezap/commands/sourcezap-clone index e7eb06a..dbe23e4 100755 --- a/libexec/sourcezap/commands/sourcezap-clone +++ b/libexec/sourcezap/commands/sourcezap-clone @@ -33,7 +33,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/utils/issourcezap-member; then +if ! "${libexec}"/utils/issourcezap-member > /dev/null >2&1; then printerr "$(id -un) is not a member of _sourcezap" exit 1 fi diff --git a/libexec/sourcezap/commands/sourcezap-pull b/libexec/sourcezap/commands/sourcezap-pull index d8717de..eda37ca 100755 --- a/libexec/sourcezap/commands/sourcezap-pull +++ b/libexec/sourcezap/commands/sourcezap-pull @@ -31,7 +31,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/utils/issourcezap-member; then +if ! "${libexec}"/utils/issourcezap-member > /dev/null 2>&1; then printerr "$(id -un) is not a member of _sourcezap" exit 1 fi diff --git a/libexec/sourcezap/utils/issourcezap-member b/libexec/sourcezap/utils/issourcezap-member index e0bad3b..65742b1 100755 --- a/libexec/sourcezap/utils/issourcezap-member +++ b/libexec/sourcezap/utils/issourcezap-member @@ -1,12 +1,9 @@ #!/bin/sh set -e +## +# main group="_sourcezap" -if id -Gn | \ - tr ' ' '\n' | \ - grep -e "^${group}$" \ - > /dev/null 2>&1; then - exit 0 -else - exit 1 -fi +mygroups=$(id -Gn | tr ' ' '\n') +echo "${mygroups}" | grep -e "^${group}$" +exit "${?}"