aboutsummaryrefslogtreecommitdiff
path: root/tests/reverse/linux-tarball-test.bash
blob: e8ecca672525010e085e8c440c5c697f43bc52b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

set -eu

cd "$(dirname "$0")"
MD5="$PWD/../stress_tests/linux-3.0.md5sums"
MYNAME=$(basename "$0")
source ../fuse-unmount.bash

# Setup dirs
cd /tmp
wget -nv --show-progress -c https://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz
WD=$(mktemp -d /tmp/$MYNAME.XXX)

# Cleanup trap
trap "set +u; cd /; fuse-unmount -z $WD/c; fuse-unmount -z $WD/b; rm -rf $WD" EXIT

cd $WD
mkdir a b c
echo "Extracting tarball"
tar -x -f /tmp/linux-3.0.tar.gz -C a
echo "Mounting a -> b -> c chain"
# Init "a"
gocryptfs -q -extpass="echo test" -reverse -init -scryptn=10 a
# Reverse-mount "a" on "b"
gocryptfs -q -extpass="echo test" -reverse  a b
# Forward-mount "b" on "c"
gocryptfs -q -extpass="echo test" b c
# Check md5 sums
cd c
echo "Checking md5 sums"
set -o pipefail
md5sum -c $MD5 | pv -l -s 36782 -N "files checked" | (grep -v ": OK" || true)