Fisxed bug related to verbose mode
All checks were successful
backup.sh / bash (push) Successful in 29s
All checks were successful
backup.sh / bash (push) Successful in 29s
This commit is contained in:
parent
c227a2f6d7
commit
2b644feb0b
18
backup.sh
18
backup.sh
@ -121,6 +121,10 @@ make_backup() {
|
||||
for file in "$BACKUP_SH_SUBDIR"/**/*; do
|
||||
# Skip symbol links and directories
|
||||
[ -d "$file" ] || [ -L "$file" ] && continue
|
||||
|
||||
if [ "$BACKUP_SH_VERBOSE" -eq 1 ]; then
|
||||
printf "Computing checksum for '%s'...\n" "$file"
|
||||
fi
|
||||
gethash "$file" >> "$BACKUP_SH_CHECKSUM_FILE"
|
||||
done
|
||||
shopt -u globstar dotglob
|
||||
@ -132,13 +136,12 @@ make_backup() {
|
||||
# Compress backup directory
|
||||
echo "Compressing backup..."
|
||||
if [ "$BACKUP_SH_VERBOSE" -eq 1 ]; then
|
||||
tar -cvzf "$BACKUP_SH_OUTPATH/backup.sh.tar.gz" \
|
||||
-C "$BACKUP_SH_OUTPATH" "$BACKUP_SH_FOLDER"
|
||||
else
|
||||
tar -czf "$BACKUP_SH_OUTPATH/backup.sh.tar.gz" \
|
||||
-C "$BACKUP_SH_OUTPATH" "$BACKUP_SH_FOLDER" > /dev/null 2>&1
|
||||
printf "Compressing '%s'...\n" "$file"
|
||||
fi
|
||||
|
||||
tar -czf "$BACKUP_SH_OUTPATH/backup.sh.tar.gz" \
|
||||
-C "$BACKUP_SH_OUTPATH" "$BACKUP_SH_FOLDER" > /dev/null 2>&1
|
||||
|
||||
# Encrypt backup directory
|
||||
echo "Encrypting backup..."
|
||||
gpg -a \
|
||||
@ -176,6 +179,7 @@ extract_backup() {
|
||||
BACKUP_SH_VERBOSE="$4"
|
||||
|
||||
# Decrypt the archive
|
||||
echo "Decrypting backup..."
|
||||
gpg -a \
|
||||
--quiet \
|
||||
--decrypt \
|
||||
@ -206,7 +210,9 @@ extract_backup() {
|
||||
printf "[FATAL] - integrity error for '%s'.\n" "$file"
|
||||
exit 1
|
||||
fi
|
||||
printf "[OK] - integrity check for '%s' passed.\n" "$file"
|
||||
if [ "$BACKUP_SH_VERBOSE" -eq 1 ]; then
|
||||
printf "[OK] - integrity check for '%s' passed.\n" "$file"
|
||||
fi
|
||||
done
|
||||
shopt -u globstar dotglob
|
||||
fi
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user