Permalink
Browse files

single md5file patch (debian bts #638919, applies to upstream as-is)

  • Loading branch information...
1 parent c8f1ca6 commit 2e043774d6d672f2d60c20a13ed48099c1053862 Georgios M. Zarkadas committed Aug 24, 2011
Showing with 14 additions and 16 deletions.
  1. +3 −1 backup-manager
  2. +5 −6 lib/actions.sh
  3. +4 −6 lib/backup-methods.sh
  4. +2 −3 lib/files.sh
View
@@ -188,7 +188,9 @@ debug "Sanitizing the configuration file."
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
View
@@ -52,13 +52,12 @@ function make_archives()
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
}
View
@@ -38,15 +38,13 @@ function commit_archive()
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...
View
@@ -413,10 +413,9 @@ function purge_duplicate_archives()
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

0 comments on commit 2e04377

Please sign in to comment.