From f75994f7351eb9ca14d4ff67a67e656f3bb24b34 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Sat, 22 Jul 2023 21:49:21 +0000 Subject: [PATCH] make decrypt.sh more verbose --- .github/actions/decrypt.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/actions/decrypt.sh b/.github/actions/decrypt.sh index fee79d00..da755898 100644 --- a/.github/actions/decrypt.sh +++ b/.github/actions/decrypt.sh @@ -1,11 +1,21 @@ #!/bin/sh credspath="${HOME}/.gam" +if [ ! -d "$credspath" ]; then + echo "creating ${credspath}" + mkdir -p "$credspath" +fi gpgfile="$1" -echo "source file is ${gpgfile}" +if [ -f "$gpgfile" ]; then + echo "source file is ${gpgfile}" +else + echo "ERROR: ${gpgfile} does not exist" + exit 1 +fi credsfile="$2" echo "target file is ${credsfile}" if [ -z ${PASSCODE+x} ]; then - echo "PASSCODE is unset"; + echo "ERROR: PASSCODE is unset"; + exit 2 else echo "PASSCODE is set"; fi @@ -13,7 +23,6 @@ fi gpg --quiet --batch --yes --decrypt --passphrase="${PASSCODE}" \ --output "${credsfile}" "${gpgfile}" -mkdir -p "${credspath}" tar xvvf "${credsfile}" --directory "${credspath}" rm -rvf "${gpgfile}" rm -rvf "${credsfile}"