projects
/
monkeysphere.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
improve function to get primary group to make it more portable
[monkeysphere.git]
/
src
/
share
/
common
diff --git
a/src/share/common
b/src/share/common
index 11e7969952f2b8dfb2cca4f1f87cd4959ca38f89..76b539f4ab89dc9ddd8d585a751f64ed4f514430 100644
(file)
--- a/
src/share/common
+++ b/
src/share/common
@@
-425,6
+425,12
@@
check_key_file_permissions() {
log debug "checking path permission '$path'..."
log debug "checking path permission '$path'..."
+ # rewrite path if it points to a symlink
+ if [ -h "$path" ] ; then
+ path=$(readlink -f "$path")
+ log debug "checking path symlink '$path'..."
+ fi
+
# return 255 if cannot stat file
if ! stat=$(ls -ld "$path" 2>/dev/null) ; then
log error "could not stat path '$path'."
# return 255 if cannot stat file
if ! stat=$(ls -ld "$path" 2>/dev/null) ; then
log error "could not stat path '$path'."
@@
-477,6
+483,12
@@
get_homedir() {
eval "echo ~${uname}"
}
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
### CONVERSION UTILITIES
# output the ssh key for a given key ID