From 5439181b6020948597f3079d66fcf339f72e6da7 Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Sat, 21 Mar 2020 17:28:28 +0100 Subject: [PATCH] Added missing sudo. Added checks. --- start_or_update.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/start_or_update.sh b/start_or_update.sh index f507f61..be128b3 100755 --- a/start_or_update.sh +++ b/start_or_update.sh @@ -1,4 +1,5 @@ #!/bin/bash +test -z $KEY && { echo "KEY is not defined."; exit 1; } test -z $1 || HOST="_$1" test -z $2 || INSTANCE="_$2" if ! test -f ~/secrets.tar.gz.enc @@ -10,7 +11,8 @@ then exit 1 fi fi -openssl enc -aes-256-cbc -d -in ~/secrets.tar.gz.enc | tar -zxv --strip 2 secrets/docker-cron-global-stack${HOST}${INSTANCE}/crontab.yaml +openssl enc -aes-256-cbc -d -in ~/secrets.tar.gz.enc | sudo tar -zxv --strip 2 secrets/docker-cron-global-stack${HOST}${INSTANCE}/crontab.yaml \ + || { echo "Could not extract from secrets archive, exiting."; rm -f ~/secrets.tar.gz.enc; exit 1; } sudo chown root. crontab.yaml sudo chmod 644 crontab.yaml