From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6AD48138334 for ; Sun, 9 Jun 2019 11:32:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C6300E0959; Sun, 9 Jun 2019 11:28:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 160FFE094E for ; Sun, 9 Jun 2019 11:28:37 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 96EE2345AB0; Sun, 9 Jun 2019 11:28:35 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH v3 10/19] user.eclass: Introduce eget{user,group}name Date: Sun, 9 Jun 2019 13:28:05 +0200 Message-Id: <20190609112814.15907-11-mgorny@gentoo.org> X-Mailer: git-send-email 2.22.0.rc3 In-Reply-To: <20190609112814.15907-1-mgorny@gentoo.org> References: <20190609112814.15907-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 30cb5db3-80c0-4985-83bc-7d0dab7f1083 X-Archives-Hash: b93bf85d5f42038962b3067bf83d7e1e Signed-off-by: Michał Górny --- eclass/user.eclass | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/eclass/user.eclass b/eclass/user.eclass index 3bd381b0c089..e4e2732b11e0 100644 --- a/eclass/user.eclass +++ b/eclass/user.eclass @@ -351,6 +351,30 @@ enewgroup() { esac } +# @FUNCTION: egetusername +# @USAGE: +# @DESCRIPTION: +# Gets the username for given UID. +egetusername() { + local pos + + [[ $# -eq 1 ]] || die "usage: egetusername " + + egetent passwd "$1" | cut -d: -f1 +} + +# @FUNCTION: egetgroupname +# @USAGE: +# @DESCRIPTION: +# Gets the group name for given GID. +egetgroupname() { + local pos + + [[ $# -eq 1 ]] || die "usage: egetgroupname " + + egetent group "$1" | cut -d: -f1 +} + # @FUNCTION: egethome # @USAGE: # @DESCRIPTION: -- 2.22.0.rc3