diff -u backup2l-1.4.orig/backup2l backup2l-1.4/backup2l --- backup2l-1.4.orig/backup2l 2005-01-04 17:10:22.000000000 +0200 +++ backup2l-1.4/backup2l 2009-07-21 18:08:12.796399081 +0300 @@ -33,21 +33,25 @@ # may be required by special functions, e. g. md5sum by the check functions. # Tool requirements are check in the do_* and show_* functions. -COMMON_TOOLS="date find grep gzip gunzip sed awk mount umount" +COMMON_TOOLS="date find grep gzip gunzip sed awk mount umount tr" # The following variables define the format of *.list files. Modify at your own risk. FORMAT="%8s %TD %TT %04U.%04G %04m %p" # format for *.list files -FILTER_NAME="sed 's#^\([-:. 0-9]*/\)\{3\}#/#'" + # I insist on that code to provide various date-formats and expessially on '-n'-sed-option + # -> to prevent errors on skewed lists e.g. filenames with newline inside! +#FILTER_NAME="sed -n 's#^\( *\([0-9/:.-]\+ \)\{5\}\)/#/#p'" + # 4 groups would be logicaly right and it works: +FILTER_NAME="sed -n 's#^\( *\([0-9/:. -]\+ \)\{4\}\)/#/#p'" # sed command for extracting names from .list, .new, ... files # (removes everything up to the 3rd "/"; two are contained in the time field) -FILTER_CHOWN="sed 's#^\( *[^ ]\+\)\{3\} *0\{0,3\}\([0-9]\+\)\.0\{0,3\}\([0-9]\+\) \+\([0-9]*\)\{4\} \+/\(.*\)\$#\2.\3 \"\5\"#'" +FILTER_CHOWN="sed -n 's#^\( *[^ ]\+\)\{3\} *0\{0,4\}\([0-9]\+\)\.0\{0,4\}\([0-9]\+\) \+\([0-9]*\)\{0,4\} \+/\(.*\)\$#\2.\3\n\5#p'" # sed command for extracting ownerships and names from .list files -FILTER_CHMOD="sed 's#^\( *[^ ]\+\)\{4\} *\([0-9]\{4\}\) \+/\(.*\)\$#\2 \"\3\"#'" +FILTER_CHMOD="sed -n 's#^\( *[^ ]\+\)\{4\} *0\{0,3\}\([0-9]\{1,4\}\) \+/\(.*\)\$#\2\n\3#p'" # sed command for extracting permissions and names from .list files -FILTER_UNIFY_NAME="sed 's#\\[0-7]\{3\}#?#g; s#[^a-zA-Z0-9_ .$%:~/=+\#\-]#?#g'" +FILTER_UNIFY_NAME="sed -n 's#\\\\[0-7]\{3\}#?#g; s#[^a-zA-Z0-9_ .$%:~/=+\#\-]#?#g'" # replaces special and escaped characters by '?'; # only used when checking TOCs of fresh backup archives in order to avoid false alarms @@ -170,14 +174,14 @@ echo "tar" ;; -create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file - tar cf $3 -T $4 --no-recursion 2>&1 \ + tar cf $3 -T $4 --no-recursion --atime-preserve 2>&1 \ | grep -v 'tar: Removing leading .* from .* names' ;; -toc) # Arguments: $2 = BID, $3 = archive file name tar tf $3 | sed 's#^#/#' ;; -extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file - tar x --same-permission --same-owner -f $3 -T $4 2>&1 + tar x --same-permission --numeric-owner -f $3 -T $4 2>&1 ;; esac } @@ -194,14 +198,14 @@ echo "tar.gz" ;; -create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file - tar czf $3 -T $4 --no-recursion 2>&1 \ + tar czf $3 -T $4 --no-recursion --atime-preserve 2>&1 \ | grep -v 'tar: Removing leading .* from .* names' ;; -toc) # Arguments: $2 = BID, $3 = archive file name tar tzf $3 | sed 's#^#/#' ;; -extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file - tar zx --same-permission --same-owner -f $3 -T $4 2>&1 + tar zx --same-permission --numeric-owner -f $3 -T $4 2>&1 ;; esac } @@ -218,14 +222,14 @@ echo "tar.bz2" ;; -create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file - tar cjf $3 -T $4 --no-recursion 2>&1 \ + tar cjf $3 -T $4 --no-recursion --atime-preserve 2>&1 \ | grep -v 'tar: Removing leading .* from .* names' ;; -toc) # Arguments: $2 = BID, $3 = archive file name tar tjf $3 | sed 's#^#/#' ;; -extract) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file - tar jx --same-permission --same-owner -f $3 -T $4 2>&1 + tar jx --same-permission --numeric-owner -f $3 -T $4 2>&1 ;; esac } @@ -963,9 +967,11 @@ DIRS=`wc -l < $BACKUP_DIR/$TMP.dirs` if [ $DIRS -gt 0 ]; then echo "Restoring" $DIRS "directories..." - eval "$FILTER_NAME" < $BACKUP_DIR/$TMP.dirs | sed 's#^/\(.*\)$#"\1"#' | xargs -l1 mkdir -p - eval "$FILTER_CHMOD" < $BACKUP_DIR/$TMP.dirs | xargs -l1 chmod - eval "$FILTER_CHOWN" < $BACKUP_DIR/$TMP.dirs | xargs -l1 chown + eval "$FILTER_NAME" < $BACKUP_DIR/$TMP.dirs | sed 's#^/##' | tr '\n' '\0' | xargs -0 mkdir -p + # FILTER_CHMOD and FILTER_CHOWN provide now really any dir-names support + # (newlines still excepted) + eval "$FILTER_CHMOD" < $BACKUP_DIR/$TMP.dirs | tr '\n' '\0' | xargs -0 -n 2 chmod + eval "$FILTER_CHOWN" < $BACKUP_DIR/$TMP.dirs | tr '\n' '\0' | xargs -0 -n 2 chown fi # process all archives... @@ -1177,9 +1183,9 @@ -e | --estimate [] : Like -b, but nothing is really done -s | --get-summary : Show backup summary - -a | --get-available : Show all files in all backups containing in their path names - -l | --locate [] : Show most recent backup location of all active files matching - -r | --restore [] : Restore active files matching into current directory + -a | --get-available : Show all files in all backups containing in their *data-output-string* (>BUG<) + -l | --locate [] : Show most recent backup location of all active files (>BUG< but no empty directories!) matching + -r | --restore [] : Restore active files and directories matching into current directory -p | --purge : Remove the specified backup archive(s) and all depending backups Common subdirectories: backup2l-1.4.orig/debian and backup2l-1.4/debian diff -u backup2l-1.4.orig/first-time.conf backup2l-1.4/first-time.conf --- backup2l-1.4.orig/first-time.conf 2005-01-04 12:11:56.000000000 +0200 +++ backup2l-1.4/first-time.conf 2009-07-21 18:06:42.809398625 +0300 @@ -232,7 +232,7 @@ echo "afio-bz2" ;; -create) # Arguments: $2 = BID, $3 = archive file name, $4 = file list file - afio -z -1 m -P bzip2 -Q -9 -Z -M 50m -T 1k - <$4 >$3 2>&1 + afio -z -1 m -P bzip2 -Q -9 -Z -M 50m -T 1k -o $3 <$4 2>&1 # This line passes some additional options to afio (see afio(1)): # '-P bzip2' utilizes bzip2 as an external compressor # '-Q 9' maximizes the compression by bzip2.