diff options
author | tv <tv@shackspace.de> | 2015-06-24 20:16:21 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-06-24 20:16:21 +0200 |
commit | 41912f04525f2c8a640c940188a842384df67b61 (patch) | |
tree | d85c65c58be84e65a2f613fe088e7f9ee4b53001 | |
parent | d4ca5907d67c4f2374b6231ff03d8ed36b39ec96 (diff) |
copy-secrets: only chown existing secrets
-rwxr-xr-x | bin/copy-secrets | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/bin/copy-secrets b/bin/copy-secrets index d155399e9..b6b93b616 100755 --- a/bin/copy-secrets +++ b/bin/copy-secrets @@ -25,6 +25,18 @@ rsync -cz --chown=0:0 -vr "$secrets_rsync/" "$target:/" ssh "$target" -T <<EOF set -euf -! test -f $retiolum_secret || chown -v $retiolum_uid:0 $retiolum_secret -! test -f $ejabberd_secret || chown -v $ejabberd_uid:0 $ejabberd_secret + +retiolum_secret=${retiolum_secret-} +retiolum_uid=${retiolum_uid-} +ejabberd_secret=${ejabberd_secret-} +ejabberd_uid=${ejabberd_uid-} + +if test -n "\$retiolum_secret"; then + chown -v "\$retiolum_uid:0" "\$retiolum_secret" +fi + +if test -n "\$ejabberd_secret"; then + chown -v "\$ejabberd_uid:0" "\$ejabberd_secret" +fi + EOF |