diff options
author | Werner Koch <wk@gnupg.org> | 2004-01-30 18:57:16 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2004-01-30 18:57:16 +0100 |
commit | a9eaa96f836b06644bdab472e1c438c177aa8bec (patch) | |
tree | 8cd3c4a79c05c09257ecf99a860833b421532885 /tools/addgnupghome | |
parent | 2004-01-30 Marcus Brinkmann <marcus@g10code.de> (diff) | |
download | gnupg2-a9eaa96f836b06644bdab472e1c438c177aa8bec.tar.xz gnupg2-a9eaa96f836b06644bdab472e1c438c177aa8bec.zip |
*** empty log message ***
Diffstat (limited to 'tools/addgnupghome')
-rwxr-xr-x | tools/addgnupghome | 23 |
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 |