diff options
author | Michał Górny <mgorny@gentoo.org> | 2019-07-25 09:54:54 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2019-07-27 11:49:04 +0200 |
commit | 077f7a9e69d648da082147ccd63c2b9ff4c8fe68 (patch) | |
tree | 35d37b55ab83ba552d560940d7d8c94160499ab0 /eclass/user.eclass | |
parent | package.mask: Masked ~sys-apps/kbd-2.1.0 (diff) | |
download | gentoo-077f7a9e69d648da082147ccd63c2b9ff4c8fe68.tar.gz gentoo-077f7a9e69d648da082147ccd63c2b9ff4c8fe68.tar.bz2 gentoo-077f7a9e69d648da082147ccd63c2b9ff4c8fe68.zip |
user.eclass: Fix egetgroups bash compliance, and make it simpler
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/user.eclass')
-rw-r--r-- | eclass/user.eclass | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/eclass/user.eclass b/eclass/user.eclass index fdf98caa6099..9dc15fa75d23 100644 --- a/eclass/user.eclass +++ b/eclass/user.eclass @@ -445,11 +445,12 @@ egetgroups() { local egroups_arr read -r -a egroups_arr < <(id -G -n "$1") - local defgroup=${egroups_arr[0]} + local g groups=${egroups_arr[0]} # sort supplementary groups to make comparison possible - readarray -t exgroups_arr < <(printf '%s\n' "${egroups_arr[@]:1}" | sort) - local exgroups=${exgroups_arr[*]} - echo "${defgroup}${exgroups:+,${exgroups// /,}}" + while read -r g; do + [[ -n ${g} ]] && groups+=",${g}" + done < <(printf '%s\n' "${egroups_arr[@]:1}" | sort) + echo "${groups}" } # @FUNCTION: esethome |