*** empty log message ***
authorWerner Koch <wk@gnupg.org>
Fri, 30 Jan 2004 17:57:16 +0000 (17:57 +0000)
committerWerner Koch <wk@gnupg.org>
Fri, 30 Jan 2004 17:57:16 +0000 (17:57 +0000)
tools/ChangeLog
tools/addgnupghome

index a91f4fe..1d21812 100644 (file)
@@ -9,6 +9,10 @@
        
 2004-01-30  Werner Koch  <wk@gnupg.org>
 
+       * addgnupghome: Also set the group of copied files. 
+
+2004-01-30  Werner Koch  <wk@gnupg.org>
+
        * Makefile.am (sbin_SCRIPTS): New, to install addgnupghome.
        (EXTRA_DIST): Added rfc822parse.c rfc822parse.h gpgparsemail.c
        which might be useful for debugging.
index 20436b6..d237a0b 100755 (executable)
@@ -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