diff options
author | Jakob Unterwurzacher | 2016-11-23 21:54:55 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2016-11-23 21:54:55 +0100 |
commit | 910fee244f356593c795d19e090a6264ff95d472 (patch) | |
tree | 2ce28cd095a82e88e1cc962af1e87a5d9215b2f3 | |
parent | 25d06fc809a74621fd59a73dd9a43a5ba4f23607 (diff) |
benchmark.bash: allow to specify directory
-rwxr-xr-x | benchmark.bash | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/benchmark.bash b/benchmark.bash index 09532b6..4169a5a 100755 --- a/benchmark.bash +++ b/benchmark.bash @@ -4,18 +4,48 @@ # https://nuetzlich.net/gocryptfs/comparison/ cd "$(dirname "$0")" +MYNAME=$(basename "$0") -# Setup -CRYPT=$(mktemp -d /tmp/benchmark.bash.XXX) +function usage { + echo "Usage: $MYNAME [-encfs] [DIR]" + exit 1 +} + +# Print help text on too many arguments or "-h" +if [[ $# -gt 2 ]]; then + usage +elif [[ $# -ge 1 ]] && [[ $1 == "-h" ]]; then + usage +fi + +# Set $DIR and $MODE +MODE=gocryptfs +DIR=/tmp +if [[ $# -eq 2 ]]; then + if [[ $1 != "-encfs" ]]; then + usage + fi + MODE=encfs + DIR=$2 +elif [[ $# -eq 1 ]]; then + if [[ $1 == "-encfs" ]]; then + MODE=encfs + else + DIR=$1 + fi +fi + +# Create directories +CRYPT=$(mktemp -d "$DIR/$MYNAME.XXX") MNT=$CRYPT.mnt mkdir $MNT # Mount -if [ $# -eq 1 ] && [ "$1" == "-encfs" ]; then - echo "Testing EncFS at $MNT" +if [[ $MODE == encfs ]]; then + echo "Testing EncFS at $CRYPT" encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null else - echo "Testing gocryptfs at $MNT" + echo "Testing gocryptfs at $CRYPT" gocryptfs -q -init -extpass="echo test" -scryptn=10 $CRYPT gocryptfs -q -extpass="echo test" $CRYPT $MNT fi |