File: issue824.sh

package info (click to toggle)
duplicity 3.0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,260 kB
  • sloc: python: 25,089; sh: 934; ansic: 392; makefile: 83
file content (19 lines) | stat: -rwxr-xr-x 627 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

TMPDIR=$(mktemp -d)
mkdir -p "$TMPDIR/testfiles"

for i in $(seq 1 10); do
    dd if=/dev/urandom of="$TMPDIR/testfiles/$i.bin" bs=1M count=50
done
PASSPHRASE=foo duplicity "$TMPDIR/testfiles" "file://$TMPDIR/testbackup"
TOCORRUPT=$(echo $TMPDIR/testbackup/*vol2*gpg)
mv "$TOCORRUPT" "$TMPDIR/testbackup/GOOD"
head -c -1000000 "$TMPDIR/testbackup/GOOD" > "$TOCORRUPT"
PASSPHRASE=foo duplicity --ignore-errors --num-retries 1 "file://$TMPDIR/testbackup" "$TMPDIR/testrestore"
if ! test -f "$TMPDIR/testrestore/9.bin"; then
    >2 echo "Restore failed to ignore errors"
    rm -rf $TMPDIR
    exit 1
fi
rm -rf $TMPDIR