Print a diff of the files when backup by ynh_backup_if_checksum_is_different

This commit is contained in:
Maniack Crudelis 2019-02-12 20:17:15 +01:00 committed by GitHub
parent 2d3ff79683
commit 2f1a517a42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -352,7 +352,8 @@ ynh_backup_if_checksum_is_different () {
local backup_file="/home/yunohost.conf/backup/$file.backup.$(date '+%Y%m%d.%H%M%S')" local backup_file="/home/yunohost.conf/backup/$file.backup.$(date '+%Y%m%d.%H%M%S')"
sudo mkdir -p "$(dirname "$backup_file")" sudo mkdir -p "$(dirname "$backup_file")"
sudo cp -a "$file" "$backup_file" # Backup the current file sudo cp -a "$file" "$backup_file" # Backup the current file
echo "File $file has been manually modified since the installation or last upgrade. So it has been duplicated in $backup_file" >&2 ynh_print_info "File $file has been manually modified since the installation or last upgrade. So it has been duplicated in $backup_file"
ynh_print_info "$(git diff --no-index --patch-with-stat $backup_file $file)"
echo "$backup_file" # Return the name of the backup file echo "$backup_file" # Return the name of the backup file
fi fi
fi fi