2023-06-07 15:26:01 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
. ./tests/common.sh
|
|
|
|
|
|
|
|
export TARBACK_REMOTE='ssh localhost'
|
|
|
|
|
|
|
|
# archive whole directory
|
|
|
|
workdir="$(create_directories)"
|
2023-06-08 17:49:26 +02:00
|
|
|
./tarback.sh -P ssh create "$workdir/source" "$workdir/dest/source.tar.xz"
|
|
|
|
./tarback.sh -P ssh restore "$workdir/dest/source.tar.xz" "$workdir/restore"
|
2023-06-07 15:26:01 +02:00
|
|
|
diff "$workdir/source" "$workdir/restore"
|
|
|
|
rm -rf "$workdir"
|
|
|
|
|
|
|
|
# archive single file
|
|
|
|
workdir="$(create_directories)"
|
2023-06-07 21:53:14 +02:00
|
|
|
filename="$(basename "$(find "$workdir/source" -type f)")"
|
2023-06-08 17:49:26 +02:00
|
|
|
./tarback.sh -P ssh create "$workdir/source/$filename" "$workdir/dest/source.tar.xz"
|
|
|
|
./tarback.sh -P ssh restore "$workdir/dest/source.tar.xz" "$workdir/restore/$filename"
|
2023-06-07 15:26:01 +02:00
|
|
|
diff "$workdir/source" "$workdir/restore"
|
|
|
|
rm -rf "$workdir"
|
|
|
|
|
|
|
|
# split archive
|
|
|
|
workdir="$(create_directories)"
|
2023-06-07 21:53:14 +02:00
|
|
|
filename="$(basename "$(find "$workdir/source" -type f)")"
|
2023-06-08 17:49:26 +02:00
|
|
|
TARBACK_SPLIT="split -b 10 -" ./tarback.sh -P ssh create "$workdir/source/$filename" "$workdir/dest/source.tar.xz"
|
|
|
|
TARBACK_SPLIT="split -b 10 -" ./tarback.sh -P ssh restore "$workdir/dest/source.tar.xz" "$workdir/restore/$filename"
|
2023-06-07 15:26:01 +02:00
|
|
|
diff "$workdir/source" "$workdir/restore"
|
|
|
|
[ "$(ls -1 "$workdir/dest/"*.part* | wc -l)" -gt 1 ]
|
|
|
|
rm -rf "$workdir"
|