2023-10-20 12:57:50 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
# Check encrypted files for newer versions
|
|
|
|
files="$HOME/.config/yadm/encrypt"
|
2024-01-28 00:51:19 +00:00
|
|
|
archive="$HOME/.password-store/yadm.gpg"
|
2023-10-20 12:57:50 +00:00
|
|
|
new_files=false
|
|
|
|
|
2024-01-28 00:51:19 +00:00
|
|
|
[ -f "$archive" ] || exit 0
|
|
|
|
|
2023-10-20 12:57:50 +00:00
|
|
|
echo "Checking for newer versions of encrypted files..."
|
|
|
|
while IFS= read -r file
|
|
|
|
do
|
|
|
|
if test "$HOME/$file" -nt "$archive"
|
|
|
|
then
|
|
|
|
echo "WARNING: ~/$file is newer than the archive!"
|
|
|
|
new_files=true
|
|
|
|
fi
|
|
|
|
done < "$files"
|
|
|
|
|
|
|
|
if $new_files
|
|
|
|
then
|
|
|
|
echo "WARNING: There are newer versions of encrypted files!"
|
|
|
|
echo "WARNING: Please consider re-encrypting them."
|
|
|
|
printf "Continue? [y/N] "
|
|
|
|
read -r answer
|
|
|
|
if [ "$answer" = "n" ] || [ "$answer" = "N" ]
|
|
|
|
then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "All encrypted files are up to date."
|
|
|
|
fi
|