summaryrefslogtreecommitdiffstats
path: root/bin/copy-secrets
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-06-24 20:16:21 +0200
committertv <tv@krebsco.de>2015-06-24 20:16:21 +0200
commit7b8123e267b272fb2ff1b8c8c6ccf54d161ff753 (patch)
treed85c65c58be84e65a2f613fe088e7f9ee4b53001 /bin/copy-secrets
parentf0911ceed32144b8e98dfbd3b20ae3314d5f9190 (diff)
copy-secrets: only chown existing secrets
Diffstat (limited to 'bin/copy-secrets')
-rwxr-xr-xbin/copy-secrets16
1 files changed, 14 insertions, 2 deletions
diff --git a/bin/copy-secrets b/bin/copy-secrets
index d155399..b6b93b6 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