summaryrefslogtreecommitdiff
path: root/contrib/pam_mount/gocryptfs_pam_mount.bash
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-08 17:36:35 +0200
committerJakob Unterwurzacher2016-10-08 22:30:13 +0200
commit610a242ec6429436b37b47dd357b0c777c620d65 (patch)
treefae6233a497181b95b8f530b06b64608a8f80519 /contrib/pam_mount/gocryptfs_pam_mount.bash
parentd25fcc6a4b095e37c77cce8f9de2ec0f12007ed5 (diff)
contrib: pam_mount: add documentation and wrapper
See ticket #34
Diffstat (limited to 'contrib/pam_mount/gocryptfs_pam_mount.bash')
-rwxr-xr-xcontrib/pam_mount/gocryptfs_pam_mount.bash31
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/pam_mount/gocryptfs_pam_mount.bash b/contrib/pam_mount/gocryptfs_pam_mount.bash
new file mode 100755
index 0000000..3c7e48d
--- /dev/null
+++ b/contrib/pam_mount/gocryptfs_pam_mount.bash
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Simple bash script to transform the command-line arguments that
+# pam_mount passes to gocryptfs into something that gocryptfs
+# understands.
+#
+# Currently understood: nonempty,allow_other,quiet.
+# Unknown options are ignored.
+
+exec >&2
+set -eu
+
+if [[ $# != 4 ]]; then
+ MYNAME=$(basename $0)
+ echo "$MYNAME: expected 4 arguments, got $#"
+ echo "Example: $MYNAME /home/user.crypt /home/user.plain -o allow_other"
+ echo "Example: $MYNAME /home/user.crypt /home/user.plain -o defaults"
+ exit 1
+fi
+
+SRC=$1
+DST=$2
+GOPTS=""
+for OPT in nonempty allow_other quiet; do
+ if [[ $4 == *$OPT* ]]; then
+ GOPTS="$GOPTS -$OPT"
+ fi
+done
+
+cd "$(dirname "$0")"
+exec ./gocryptfs $GOPTS $SRC $DST