Merge commit 'mlcastle/master'
[monkeysphere.git] / src / share / common
index c88857e44adabca90d57bb02358bcce92d16f67d..8e2232d659350558e472bd5f37c365d050317b8d 100644 (file)
@@ -484,6 +484,12 @@ get_homedir() {
     eval "echo ~${uname}"
 }
 
+# return the primary group of a user
+get_primary_group() {
+    local uname=${1:-`whoami`}
+    groups "$uname" | sed 's/^..* : //' | awk '{ print $1 }'
+}
+
 ### CONVERSION UTILITIES
 
 # output the ssh key for a given key ID