copy-secrets: only chown existing secrets

This commit is contained in:
tv 2015-06-24 20:16:21 +02:00
parent d4ca5907d6
commit 41912f0452

View File

@ -25,6 +25,18 @@ rsync -cz --chown=0:0 -vr "$secrets_rsync/" "$target:/"
ssh "$target" -T <<EOF ssh "$target" -T <<EOF
set -euf 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 EOF