summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-xall.bash8
-rwxr-xr-xbenchmark.bash2
-rwxr-xr-xgocryptfs22
-rwxr-xr-xgocryptfs.sh14
-rw-r--r--gocryptfs_main/main.go (renamed from main.go)0
-rw-r--r--gocryptfs_main/main_test.go (renamed from main_test.go)4
7 files changed, 35 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 6072ebf..4e4ddae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
# binary
-/gocryptfs
+/gocryptfs_main/gocryptfs_main
# temporary files created by the tests
/tmp
diff --git a/all.bash b/all.bash
new file mode 100755
index 0000000..08bc7cf
--- /dev/null
+++ b/all.bash
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -eu
+
+cd gocryptfs_main
+echo -n "Compiling... "
+go build
+echo "done."
diff --git a/benchmark.bash b/benchmark.bash
index 447581a..baba0f1 100755
--- a/benchmark.bash
+++ b/benchmark.bash
@@ -2,5 +2,7 @@
set -eux
+cd gocryptfs_main
+
go build
go test -bench=.
diff --git a/gocryptfs b/gocryptfs
new file mode 100755
index 0000000..ce15b97
--- /dev/null
+++ b/gocryptfs
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Simple wrapper that runs the gocryptfs process in the background
+
+set -eu
+
+dir=$(dirname "$0")
+main="$dir/gocryptfs_main/gocryptfs_main"
+
+if [ ! -x $main ]; then
+ echo "Error: gocryptfs_main executable not found. Run ./all.bash to build it."
+ exit 1
+fi
+
+# This needs user input and cannot run in the background
+if [[ $* == *--init* ]]; then
+ "$main" $*
+else
+ "$main" $* &
+ sleep 0.1
+ disown
+fi
diff --git a/gocryptfs.sh b/gocryptfs.sh
deleted file mode 100755
index 689708c..0000000
--- a/gocryptfs.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-# Run the gocryptfs process in the background
-
-set -eu
-
-dir=$(dirname "$0")
-
-# This needs user input and cannot run in the background
-if [[ $* == *--init* ]]; then
- "$dir/gocryptfs" $*
-else
- "$dir/gocryptfs" $* & disown
-fi
diff --git a/main.go b/gocryptfs_main/main.go
index ae3974e..ae3974e 100644
--- a/main.go
+++ b/gocryptfs_main/main.go
diff --git a/main_test.go b/gocryptfs_main/main_test.go
index 2f606bc..218c256 100644
--- a/main_test.go
+++ b/gocryptfs_main/main_test.go
@@ -13,7 +13,7 @@ import (
"time"
)
-const tmpDir = "tmp/"
+const tmpDir = "../tmp/"
const plainDir = tmpDir + "plain/"
const cipherDir = tmpDir + "cipher/"
@@ -53,7 +53,7 @@ func TestMain(m *testing.M) {
}
//c := exec.Command("./gocryptfs", "--zerokey", "--cpuprofile", "/tmp/gcfs.cpu", cipherDir, plainDir)
- c := exec.Command("./gocryptfs", "--zerokey", cipherDir, plainDir)
+ c := exec.Command("./gocryptfs_main", "--zerokey", cipherDir, plainDir)
c.Stdout = os.Stdout
c.Stderr = os.Stderr
go c.Run()