summaryrefslogtreecommitdiffstats
path: root/tools/addgnupghome
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2004-01-30 18:57:16 +0100
committerWerner Koch <wk@gnupg.org>2004-01-30 18:57:16 +0100
commita9eaa96f836b06644bdab472e1c438c177aa8bec (patch)
tree8cd3c4a79c05c09257ecf99a860833b421532885 /tools/addgnupghome
parent2004-01-30 Marcus Brinkmann <marcus@g10code.de> (diff)
downloadgnupg2-a9eaa96f836b06644bdab472e1c438c177aa8bec.tar.xz
gnupg2-a9eaa96f836b06644bdab472e1c438c177aa8bec.zip
*** empty log message ***
Diffstat (limited to 'tools/addgnupghome')
-rwxr-xr-xtools/addgnupghome23
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/addgnupghome b/tools/addgnupghome
index 20436b637..d237a0b42 100755
--- a/tools/addgnupghome
+++ b/tools/addgnupghome
@@ -48,11 +48,22 @@ one_user () {
error "error creating \`$home/.gnupg'"
return
fi
+
if ! chown $user "$home/.gnupg" ; then
error "error changing ownership of \`$home/.gnupg'"
return
fi
+ group=$(id -g "$user")
+ [ -z "$group" ] && group="0"
+
+ if [ "$group" -gt 0 ]; then
+ if ! chgrp $group "$home/.gnupg" ; then
+ error "error changing group of \`$home/.gnupg'"
+ return
+ fi
+ fi
+
if ! cd "$home/.gnupg" ; then
error "error cd-ing to \`$home/.gnupg'"
return
@@ -63,10 +74,18 @@ one_user () {
else
cp /etc/skel/.gnupg/$f $f
fi
- chown $user $f
+ if ! chown $user $f ; then
+ error "error changing ownership of \`$f'"
+ return
+ fi
+ if [ "$group" -gt 0 ]; then
+ if ! chgrp $group "$f" ; then
+ error "error changing group of \`$f'"
+ return
+ fi
+ fi
done
-
}
if [ -z "$1" ]; then