Integrity check can now ignore symbolic links
All checks were successful
backup.sh / bash (push) Successful in 11s

This commit is contained in:
Marco Cetica 2024-04-04 15:31:55 +02:00
parent b520b6b72c
commit 2bb255840d
Signed by: marco
GPG Key ID: 45060A949E90D0FD

View File

@ -107,8 +107,8 @@ make_backup() {
if [ "$BACKUP_SH_SHA256" -eq 1 ]; then if [ "$BACKUP_SH_SHA256" -eq 1 ]; then
shopt -s globstar dotglob shopt -s globstar dotglob
for file in "$BACKUP_SH_SUBDIR"/**/*; do for file in "$BACKUP_SH_SUBDIR"/**/*; do
# Skip directories # Skip symbol links and directories
[ -d "$file" ] && continue [ -d "$file" ] || [ -L "$file" ] && continue
gethash "$file" >> "$BACKUP_SH_CHECKSUM_FILE" gethash "$file" >> "$BACKUP_SH_CHECKSUM_FILE"
done done
shopt -u globstar dotglob shopt -u globstar dotglob
@ -173,8 +173,8 @@ extract_backup() {
if [ -n "$BACKUP_SH_SHA256_FILE" ]; then if [ -n "$BACKUP_SH_SHA256_FILE" ]; then
shopt -s globstar dotglob shopt -s globstar dotglob
for file in "backup.sh.tmp"/**/*; do for file in "backup.sh.tmp"/**/*; do
# Skip directories # Skip symbolic links and directories
[ -d "$file" ] && continue; [ -d "$file" ] || [ -L "$file" ] && continue;
# Compute sha256 for current file # Compute sha256 for current file
SHA256="$(gethash "$file")" SHA256="$(gethash "$file")"
# Check if checksum file contains hash # Check if checksum file contains hash