28 lines
974 B
Bash
28 lines
974 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
set -eu
|
||
|
|
||
|
. ./tests/common.sh
|
||
|
|
||
|
# archive whole directory
|
||
|
workdir="$(create_directories)"
|
||
|
./tarback.sh create "$workdir/source" "$workdir/dest/source.tar.xz"
|
||
|
./tarback.sh restore "$workdir/dest/source.tar.xz" "$workdir/restore"
|
||
|
diff "$workdir/source" "$workdir/restore"
|
||
|
rm -rf "$workdir"
|
||
|
|
||
|
# archive single file
|
||
|
workdir="$(create_directories)"
|
||
|
./tarback.sh create "$workdir/source/hello_world.txt" "$workdir/dest/source.tar.xz"
|
||
|
./tarback.sh restore "$workdir/dest/source.tar.xz" "$workdir/restore/hello_world.txt"
|
||
|
diff "$workdir/source" "$workdir/restore"
|
||
|
rm -rf "$workdir"
|
||
|
|
||
|
# split archive
|
||
|
workdir="$(create_directories)"
|
||
|
TARBACK_SPLIT="split -b 10 -" ./tarback.sh create "$workdir/source/hello_world.txt" "$workdir/dest/source.tar.xz"
|
||
|
TARBACK_SPLIT="split -b 10 -" ./tarback.sh restore "$workdir/dest/source.tar.xz" "$workdir/restore/hello_world.txt"
|
||
|
diff "$workdir/source" "$workdir/restore"
|
||
|
[ "$(ls -1 "$workdir/dest/"*.part* | wc -l)" -gt 1 ]
|
||
|
rm -rf "$workdir"
|