Files
GoogleDriveManagement/.github/actions/decrypt.sh
2023-07-21 15:13:08 -04:00

20 lines
450 B
Bash

#!/bin/sh
credspath="${HOME}/.gam"
gpgfile="$1"
echo "source file is ${gpgfile}"
credsfile="$2"
echo "target file is ${credsfile}"
if [ -z ${PASSCODE+x} ]; then
echo "PASSCODE is unset";
else
echo "PASSCODE is set";
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}"