Moved gencfs.bash, Added some EncFS USB automouting scripts
authorHarvie <tomas@mudrunka.cz>
Wed, 1 Jun 2011 00:55:37 +0000 (02:55 +0200)
committerHarvie <tomas@mudrunka.cz>
Wed, 1 Jun 2011 01:01:52 +0000 (03:01 +0200)
bash/encfs/automount/README [new file with mode: 0644]
bash/encfs/automount/config [new file with mode: 0644]
bash/encfs/automount/encfs-automount.sh [new file with mode: 0755]
bash/encfs/gencfs.bash [moved from bash/gencfs.bash with 100% similarity]

diff --git a/bash/encfs/automount/README b/bash/encfs/automount/README
new file mode 100644 (file)
index 0000000..35dfa11
--- /dev/null
@@ -0,0 +1 @@
+More info can be probably found here: https://wiki.archlinux.org/index.php/EncFS
diff --git a/bash/encfs/automount/config b/bash/encfs/automount/config
new file mode 100644 (file)
index 0000000..f1935e8
--- /dev/null
@@ -0,0 +1,11 @@
+# ~/.config/fsniper/config
+# You can get fsniper at http://code.l3ib.org/?p=fsniper.git
+
+watch {
+       /etc/ {
+               mtab {
+                       # %% is replaced with the filename of the new file
+                       handler = encfs-automount.sh %%;
+               }
+       }
+}
diff --git a/bash/encfs/automount/encfs-automount.sh b/bash/encfs/automount/encfs-automount.sh
new file mode 100755 (executable)
index 0000000..8191f2d
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+#      ~/.config/fsniper/scripts/encfs-automount.sh
+# Quick & dirty script for automounting EncFS USB drives
+# TODO:
+#  - Unmounting!!!
+#
+ASKPASS="/usr/lib/git-core/git-gui--askpass"
+
+lock=/tmp/fsniper_encfs.lock
+lpid=$(cat "$lock" 2>/dev/null) &&
+ps "$lpid" | grep "$lpid" >/dev/null && {
+       echo "Another instance of fsniper_encfs is running"
+       exit;
+}
+echo $BASHPID > "$lock";
+sleep 2;
+
+echo
+echo ==== EncFS automount script for fsniper ====
+
+list_mounts() {
+       cat /proc/mounts | cut -d ' ' -f 2
+}
+
+list_mounts | while read mount; do
+       config="$mount"'/*/.encfs*';
+       echo Looking for "$config"
+       config="$(echo $config)"
+       [ -r "$config" ] && {
+               cyphertext="$(dirname "$config")";
+               plaintext="$cyphertext".plain
+               echo Found config: "$config";
+               echo Trying to mount: "$cyphertext to $plaintext";
+               list_mounts | grep "$plaintext" >/dev/null && {
+                       echo Already mounted: "$plaintext"
+               } || {
+                       echo WOOHOO Will mount "$cyphertext to $plaintext"
+                       "$ASKPASS" "EncFS $cyphertext to $plaintext" | encfs --stdinpass "$cyphertext" "$plaintext"
+               }
+       }
+done
+echo
+
+rm "$lock" 2>/dev/null
similarity index 100%
rename from bash/gencfs.bash
rename to bash/encfs/gencfs.bash
This page took 0.154714 seconds and 4 git commands to generate.