summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-06-06 17:09:23 +0200
committerMichał Górny <mgorny@gentoo.org>2019-06-20 10:16:46 +0200
commite66f2b799392ce068eb907786228e6cddfe52f26 (patch)
tree11dc5e6c5369742749ba9f237f2f5db1344d0a7d /eclass/user.eclass
parentuser.eclass: Introduce esetshell (diff)
downloadgentoo-e66f2b799392ce068eb907786228e6cddfe52f26.tar.gz
gentoo-e66f2b799392ce068eb907786228e6cddfe52f26.tar.bz2
gentoo-e66f2b799392ce068eb907786228e6cddfe52f26.zip
user.eclass: Introduce eget{user,group}name
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/user.eclass')
-rw-r--r--eclass/user.eclass20
1 files changed, 20 insertions, 0 deletions
diff --git a/eclass/user.eclass b/eclass/user.eclass
index 3bd381b0c089..7592ee3bba23 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -351,6 +351,26 @@ enewgroup() {
esac
}
+# @FUNCTION: egetusername
+# @USAGE: <uid>
+# @DESCRIPTION:
+# Gets the username for given UID.
+egetusername() {
+ [[ $# -eq 1 ]] || die "usage: egetusername <uid>"
+
+ id -u -n "$1"
+}
+
+# @FUNCTION: egetgroupname
+# @USAGE: <gid>
+# @DESCRIPTION:
+# Gets the group name for given GID.
+egetgroupname() {
+ [[ $# -eq 1 ]] || die "usage: egetgroupname <gid>"
+
+ id -g -n "$1"
+}
+
# @FUNCTION: egethome
# @USAGE: <user>
# @DESCRIPTION: