diff --git a/package/base/sysfiles/parse-config b/package/base/sysfiles/parse-config index 01c3cdeee..c2cadb32b 100644 --- a/package/base/sysfiles/parse-config +++ b/package/base/sysfiles/parse-config @@ -66,3 +66,20 @@ safe_groupadd() { fi } +# Usage: uid_by_name name +# +# Outputs the uid of name on the target system or nothing +# if not found. +# +uid_by_name() { + echo "$( grep "^$1:" $root/etc/passwd | cut -f3 -d: )" +} + +# Usage: gid_by_name name +# +# Outputs the gid of name on the target system or nothing +# if not found. +# +gid_by_name() { + echo "$( grep "^$1:" $root/etc/group | cut -f3 -d: )" +}