Check that exist before the calculate the checksum

This commit is contained in:
Josué Tille 2019-09-07 13:01:45 +02:00
parent c8e70bfc28
commit 8a92727fb1
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF

View file

@ -339,7 +339,7 @@ ynh_backup_if_checksum_is_different () {
backup_file_checksum=""
if [ -n "$checksum_value" ]
then # Proceed only if a value was stored into the app settings
if ! echo "$checksum_value $file" | sudo md5sum -c --status
if [ -e $file ] && ! echo "$checksum_value $file" | sudo md5sum -c --status
then # If the checksum is now different
backup_file_checksum="/home/yunohost.conf/backup/$file.backup.$(date '+%Y%m%d.%H%M%S')"
sudo mkdir -p "$(dirname "$backup_file_checksum")"