Skip to content

Commit

Permalink
fix: decrypt all sources before regenerating an anthology
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed May 6, 2022
1 parent 058e24c commit cbb7bff
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions calliope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,45 @@ decrypt ()
fi
}

# remember to pushd/popd into the required directory
decrypt_all_sources ()
{
# Any files that end in ".gpg" are considered encrypted, decrypt those.
if [ -z ${encryptionId} ]
then
echo "Encryption is not enabled"
else
echo "Decrypting all encrypted files"
find . -type f -and -not -type l -and -name "*.gpg" | while read f
do
directory="$(dirname $f)"
file="$(basename $f)"
pushd $directory
decrypt "$file" || exit -1
popd
done
fi
}

decrypt_all ()
{
# Any files that end in ".gpg" are considered encrypted, decrypt those.
if [ -z ${encryptionId} ]
then
echo "Encryption is not enabled"
else
echo "Decrypting all encrypted files"
find pdfs/ diary/ -type f -and -not -type l -and -name "*.gpg" | while read f
do
directory="$(dirname $f)"
file="$(basename $f)"
pushd $directory
decrypt "$file" || exit -1
popd
done
fi
}

create_anthology ()
{
Name="$year_to_compile-${ProjectName// /-}-Diary"
Expand All @@ -285,6 +324,14 @@ create_anthology ()
exit;
fi

if [ -z ${encryptionId} ]
then
echo ""
else
pushd "$diary_dir/$year_to_compile" && decrypt_all_sources && popd
fi


cd "$diary_dir" || exit -1

touch $FileName
Expand Down

0 comments on commit cbb7bff

Please sign in to comment.