From b41579f74398cb8a401e9bdaf60f5bf55ea60c9b Mon Sep 17 00:00:00 2001 From: badra001 Date: Fri, 24 Jun 2022 10:39:24 -0400 Subject: [PATCH] fix --- bin/decrypt-secret-key.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bin/decrypt-secret-key.sh b/bin/decrypt-secret-key.sh index 70e0dad..8df8c77 100755 --- a/bin/decrypt-secret-key.sh +++ b/bin/decrypt-secret-key.sh @@ -1,23 +1,21 @@ #!/bin/bash -VERSION="1.0.2" +VERSION="1.0.3" THIS=$(basename $0) FILE=$1 -if [[ ! -z $FILE ]] && [[ ! -r $FILE ]] +if [ -z $FILE ] +then + FILE="access_key.yml" +fi + +if [ ! -r $FILE ] then echo "* access key file $FILE not found or unreadable" exit 1 -else - FILE="access_key.yml" - if [[ ! -r $FILE ]] - then - echo "* access key file $FILE not found or unreadable" - exit 1 - fi fi -K=$( grep ^access_secret_key_encrypted access_key.yml|sed -e 's/^.*: *//' | base64 --decode | (gpg --batch --decrypt 2> /dev/null) ) +K=$( grep ^access_secret_key_encrypted $FILE | sed -e 's/^.*: *//' | base64 --decode | (gpg --batch --decrypt 2> /dev/null) ) status=$? if [ $status != 0 ]