From 2bb255840da3a731988f6bd82ca3d687495d1b3e Mon Sep 17 00:00:00 2001 From: Marco Cetica Date: Thu, 4 Apr 2024 15:31:55 +0200 Subject: [PATCH] Integrity check can now ignore symbolic links --- backup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backup.sh b/backup.sh index 3afcc93..55f1e44 100755 --- a/backup.sh +++ b/backup.sh @@ -107,8 +107,8 @@ make_backup() { if [ "$BACKUP_SH_SHA256" -eq 1 ]; then shopt -s globstar dotglob for file in "$BACKUP_SH_SUBDIR"/**/*; do - # Skip directories - [ -d "$file" ] && continue + # Skip symbol links and directories + [ -d "$file" ] || [ -L "$file" ] && continue gethash "$file" >> "$BACKUP_SH_CHECKSUM_FILE" done shopt -u globstar dotglob @@ -173,8 +173,8 @@ extract_backup() { if [ -n "$BACKUP_SH_SHA256_FILE" ]; then shopt -s globstar dotglob for file in "backup.sh.tmp"/**/*; do - # Skip directories - [ -d "$file" ] && continue; + # Skip symbolic links and directories + [ -d "$file" ] || [ -L "$file" ] && continue; # Compute sha256 for current file SHA256="$(gethash "$file")" # Check if checksum file contains hash