Use egetent+cut to obtain user/group names rather than id(1).
The latter has no real advantage (besides being shorter to type),
and does not work correctly for getting groups.
Closes: https://bugs.gentoo.org/691056
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
egetusername() {
[[ $# -eq 1 ]] || die "usage: egetusername <uid>"
- id -u -n "$1"
+ egetent passwd "$1" | cut -d: -f1
}
# @FUNCTION: egetgroupname
egetgroupname() {
[[ $# -eq 1 ]] || die "usage: egetgroupname <gid>"
- id -g -n "$1"
+ egetent group "$1" | cut -d: -f1
}
# @FUNCTION: egethome