make decrypt.sh more verbose

This commit is contained in:
Jay Lee
2023-07-22 21:49:21 +00:00
parent 2c83b13192
commit f75994f735

View File

@ -1,11 +1,21 @@
#!/bin/sh #!/bin/sh
credspath="${HOME}/.gam" credspath="${HOME}/.gam"
if [ ! -d "$credspath" ]; then
echo "creating ${credspath}"
mkdir -p "$credspath"
fi
gpgfile="$1" gpgfile="$1"
if [ -f "$gpgfile" ]; then
echo "source file is ${gpgfile}" echo "source file is ${gpgfile}"
else
echo "ERROR: ${gpgfile} does not exist"
exit 1
fi
credsfile="$2" credsfile="$2"
echo "target file is ${credsfile}" echo "target file is ${credsfile}"
if [ -z ${PASSCODE+x} ]; then if [ -z ${PASSCODE+x} ]; then
echo "PASSCODE is unset"; echo "ERROR: PASSCODE is unset";
exit 2
else else
echo "PASSCODE is set"; echo "PASSCODE is set";
fi fi
@ -13,7 +23,6 @@ fi
gpg --quiet --batch --yes --decrypt --passphrase="${PASSCODE}" \ gpg --quiet --batch --yes --decrypt --passphrase="${PASSCODE}" \
--output "${credsfile}" "${gpgfile}" --output "${credsfile}" "${gpgfile}"
mkdir -p "${credspath}"
tar xvvf "${credsfile}" --directory "${credspath}" tar xvvf "${credsfile}" --directory "${credspath}"
rm -rvf "${gpgfile}" rm -rvf "${gpgfile}"
rm -rvf "${credsfile}" rm -rvf "${credsfile}"