Package: backup-manager
Version: 0.7.9-3
Severity: wishlist
Tags: upstream patch
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Attached is a patch to replace the current scheme for storing md5 sums (one
file per day) with a single file. IMHO this simplifies the procedure and works
better with multiple configuration files, while allows easier scripting of
related tasks (for example a periodic check of archives' integrity) since all
the information is present in a central, fixed location.
The patch as is hardcodes the location of the file. It is trivial to make this
configurable, if desired; I will happily provide an updated patch in that case.
regards
George Zarkadas
- -- System Information:
Debian Release: 6.0.2
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500,
'stable'), (450, 'testing-proposed-updates'), (450, 'testing'), (400,
'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=el_GR.utf8, LC_CTYPE=el_GR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages backup-manager depends on:
ii debconf [debconf-2.0] 1.5.36.1 Debian configuration management sy
ii findutils 4.4.2-1+b1 utilities for finding files--find,
ii ucf 3.0025+nmu1 Update Configuration File: preserv
backup-manager recommends no packages.
Versions of packages backup-manager suggests:
ii anacron 2.3-14 cron-like program that doesn't go
ii backup-manager-doc 0.7.9-3 documentation package for Backup M
ii dar 2.3.10-1+b1 Disk ARchive: Backup directory tre
ii dvd+rw-tools 7.1-6 DVD+-RW/R tools
ii genisoimage 9:1.1.11-1 Creates ISO-9660 CD-ROM filesystem
ii gettext-base 0.18.1.1-3 GNU Internationalization utilities
ii libfile-slurp-perl 9999.13-1 single call read & write file rout
pn libnet-amazon-s3-perl <none> (no description available)
ii openssh-client 1:5.5p1-6+squeeze1 secure shell (SSH) client, for sec
ii perl 5.10.1-17squeeze2 Larry Wall's Practical Extraction
ii wodim 9:1.1.11-1 command line CD/DVD writing tool
ii zip 3.0-3 Archiver for .zip files
- -- debconf information excluded
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iQEcBAEBAgAGBQJOUt05AAoJEJWXIVmJ5BwWYksIALyQKkTXhH/aODCW4h85kZCX
6stxO5kswBQZTfyAUgxS/8aO3tVuO0UFTrBbR7CMnHdVYH8HzMMgK/MPi7VaPsuW
ckhrGVEDGtnoSQeWA+bcEO8Zfgz2Y0Xkpld1LckzirXQzzPD2UxFxnG5yzw+VSLj
BYS/xxMS/FaAVxdhXv8YuoRz9LkeFfDDBwBKL/lLPnkf6M0mXsmynas1a6NLHQhK
ipdNh3Ksu9pWvwzBdRshDH0yEAjiKNxePoFbCLv97YagmwRtBMD3zkmeLIBVNx4Y
p+QBeYq20Nh5bu68TKLzKiV/9TnUVJcvUYuuarUIk9+ENUVtjWvKnfwSlNqU998=
=Hd7Z
-----END PGP SIGNATURE-----
--- a/backup-manager
+++ b/backup-manager
@@ -183,7 +183,9 @@
source $libdir/sanitize.sh
debug "Initializing environment"
-bm_init_env
+bm_init_env
+# Use a single md5 file to store all archives.
+export MD5FILE="${BM_REPOSITORY_ROOT}/${BM_ARCHIVE_PREFIX}-hashes.md5"
debug "Checking if logger is available"
check_logger
--- a/lib/actions.sh
+++ b/lib/actions.sh
@@ -49,13 +49,12 @@
esac
# Now make sure the md5 file is okay.
- md5file="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-${TODAY}.md5"
- if [[ -e $md5file ]] &&
+ if [[ -e $MD5FILE ]] &&
[[ "$BM_REPOSITORY_SECURE" = "true" ]]; then
- chown $BM_REPOSITORY_USER:$BM_REPOSITORY_GROUP $md5file ||
- warning "Unable to change the owner of \"\$md5file\"."
- chmod $BM_ARCHIVE_CHMOD $md5file ||
- warning "Unable to change file permissions of \"\$md5file\"."
+ chown $BM_REPOSITORY_USER:$BM_REPOSITORY_GROUP $MD5FILE ||
+ warning "Unable to change the owner of \"\$MD5FILE\"."
+ chmod $BM_ARCHIVE_CHMOD $MD5FILE ||
+ warning "Unable to change file permissions of \"\$MD5FILE\"."
fi
done
}
--- a/lib/backup-methods.sh
+++ b/lib/backup-methods.sh
@@ -38,15 +38,13 @@
echo "$str ${md5hash})"
fi
- md5file="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-${TODAY}.md5"
-
# Check if the md5file contains already the md5sum of the file_to_create.
# In this case, the new md5sum overwrites the old one.
- if grep "$base" $md5file >/dev/null 2>&1 ; then
- previous_md5sum=$(get_md5sum_from_file $base $md5file)
- sed -e "/$base/s/$previous_md5sum/$md5hash/" -i $md5file
+ if grep "$base" $MD5FILE >/dev/null 2>&1 ; then
+ previous_md5sum=$(get_md5sum_from_file $base $MD5FILE)
+ sed -e "/$base/s/$previous_md5sum/$md5hash/" -i $MD5FILE
else
- echo "$md5hash $base" >> $md5file
+ echo "$md5hash $base" >> $MD5FILE
fi
# Now that the file is created, remove previous duplicates if exists...
--- a/lib/files.sh
+++ b/lib/files.sh
@@ -413,10 +413,9 @@
error "Unable to get date from file."
# get the md5 hash of the file we parse, in its .md5 file
-
md5file="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-${date_of_file}.md5"
- md5sum_to_check="$(get_md5sum_from_file $file $md5file)"
+ md5sum_to_check="$(get_md5sum_from_file $file $MD5FILE)"
if [[ -z "$md5sum_to_check" ]]; then
- warning "Unable to find the md5 hash of file \"\$file\" in
file \"\$md5file\"."
+ warning "Unable to find the md5 hash of file \"\$file\" in
file \"\$MD5FILE\"."
continue
fi