M README.md +3 -2
@@ 44,14 44,14 @@ Suppose you have an EncFS folder at `~/.
mounted to `~/Private`. Make it known to *gnome-encfs*:
$ gnome-encfs -a ~/.Private.encrypted ~/Private
- EncFS config file [-]: <optional custom encfs6.xml location>
+ EncFS config file [-]: <optional custom .encfs6.xml location>
EncFS password: <enter encfs password>
Mount at login [Y/n]: <say 'y' or 'n'>
This adds the EncFS path, its mount location and password to the GNOME keyring
and sets up a GNOME autostart entry to mount it at GNOME login (if enabled).
-Note that EncFS config file option only works with EncFS6 config files.
+Check [Anthony's EncFS hints][ehi] for custom `.encfs6.xml` locations.
### Mount an EncFS folder
@@ 127,4 127,5 @@ License
[gkr]: http://live.gnome.org/GnomeKeyring
[gpl]: http://www.gnu.org/licenses/gpl.html
[itr]: http://bitbucket.org/obensonne/gnome-encfs/issues/?status=new&status=open
+[ehi]: http://www.ict.griffith.edu.au/anthony/info/crypto/encfs.hints
M gnome-encfs +7 -3
@@ 177,8 177,8 @@ def _exit(rc):
def _proceed(msg):
print("Warning: %s" % msg)
- proceed = preset.proceed or raw_input("Proceed [y/N]: ")
- if not proceed or proceed.strip()[0].lower() != "y":
+ proceed = preset.proceed or raw_input("Proceed [y/N]: ") or "n"
+ if proceed.strip()[0].lower() != "y":
_exit(2)
def _pathify(path):
@@ 193,7 193,11 @@ def _encfs_env(econfig):
"""Get environment for encfs commands."""
env = os.environ.copy()
if econfig != "-":
- env["ENCFS6_CONFIG"] = econfig
+ cmd = ["file", "-b", "--mime-type", econfig]
+ p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+ mime_type = p.communicate()[0].strip()
+ v = 6 if mime_type == 'application/xml' else 5
+ env["ENCFS%s_CONFIG" % v] = econfig
return env
def _is_mounted(mpoint):
M tests/run.sh +2 -2
@@ 1,8 1,8 @@
#!/bin/sh
-sh test.sh | sed -e "s,/.*/tenv,./tenv," > test.out
+LC_MESSAGES=C sh test.sh | sed -e "s,/.*/tenv,./tenv," > test.out
-ERR=`diff -Nur test.exp test.out`
+ERR=`diff -u test.exp test.out`
if [ -n "$ERR" ] ; then
echo "$ERR" > test.err
M tests/tenv.tar +0 -0
M tests/test.exp +50 -0
@@ 171,6 171,56 @@ Icon=folder
# EXPECT: 1 succeeding edits
# EXPECT: autostart off
autostart off
+# EXPECT: succeeding add (1) with custom v5 config file location
+# EXPECT: 1 listed item (1)
+* encfs path : ./tenv/e1
+ mount point : ./tenv/m1
+ mount at login : no
+ encfs config : ./tenv/e1_encfs5
+# EXPECT: 1 succeeding mounts (1)
+Mounting ./tenv/m1: OK
+# EXPECT: 1 mounted paths (1)
+encfs on ./tenv/m1 type fuse.encfs
+# EXPECT: no mounted paths - all unmounted
+# EXPECT: succeeding edit (1) reset config file location
+# EXPECT: 1 listed item (1)
+* encfs path : ./tenv/e1
+ mount point : ./tenv/m1
+ mount at login : no
+ encfs config : -
+# EXPECT: succeeding edit (1) with custom v5 config file location
+# EXPECT: 1 listed item (1)
+* encfs path : ./tenv/e1
+ mount point : ./tenv/m1
+ mount at login : no
+ encfs config : ./tenv/e1_encfs5
+# EXPECT: succeeding remove (1)
+# EXPECT: 0 items
+# EXPECT: succeeding add (1) with custom v6 config file location
+# EXPECT: 1 listed item (2)
+* encfs path : ./tenv/e2
+ mount point : ./tenv/m2
+ mount at login : no
+ encfs config : ./tenv/e2_encfs6.xml
+# EXPECT: 1 succeeding mounts (2)
+Mounting ./tenv/m2: OK
+# EXPECT: 1 mounted paths (2)
+encfs on ./tenv/m2 type fuse.encfs
+# EXPECT: no mounted paths - all unmounted
+# EXPECT: succeeding edit (2) reset config file location
+# EXPECT: 1 listed item (2)
+* encfs path : ./tenv/e2
+ mount point : ./tenv/m2
+ mount at login : no
+ encfs config : -
+# EXPECT: succeeding edit (2) with custom v6 config file locations
+# EXPECT: 1 listed item (2)
+* encfs path : ./tenv/e2
+ mount point : ./tenv/m2
+ mount at login : no
+ encfs config : ./tenv/e2_encfs6.xml
+# EXPECT: succeeding remove (2)
+# EXPECT: 0 items
# EXPECT: no listed items
# EXPECT: autostart off
autostart off
M tests/test.sh +82 -3
@@ 40,7 40,7 @@ expect "1 listed item (1)"
$GENCFS -l
expect "failing add - mount point in use"
-$GENCFS -a ./tenv/e1 ./tenv/m1 --econfig "-" --password p1 --proceed n --amount y
+$GENCFS -a $TENV/e1 $TENV/m1 --econfig "-" --password p1 --proceed n --amount y
expect "1 listed item (1)"
$GENCFS -l
@@ 60,7 60,7 @@ expect "4 listed items (1,2,3a,3b)"
$GENCFS -l
expect "2 succeeding mounts (3a,3b)"
-$GENCFS -m ./tenv/e3
+$GENCFS -m $TENV/e3
expect "2 mounted paths (3a,3b)"
mounts
@@ 134,11 134,90 @@ expect "autostart off"
test -e autostart.desktop && echo "autostart on" || echo "autostart off"
# clean up keyring
+
+$GENCFS -l | grep "mount point" | grep "/tenv/m[0-9]" | awk {'print $4'} | \
+ while read MP ; do $GENCFS -r $MP ; done
+
+# test custom EncFS config file location (v5)
+
+expect "succeeding add (1) with custom v5 config file location"
+mv $TENV/e1/.encfs5 $TENV/e1_encfs5
+$GENCFS -a $TENV/e1 $TENV/m1 --econfig $TENV/e1_encfs5 --password p1 --proceed n --amount n
+expect "1 listed item (1)"
+$GENCFS -l
+
+expect "1 succeeding mounts (1)"
+$GENCFS -m $TENV/e1
+expect "1 mounted paths (1)"
+mounts
+
+for MPOINT in $TENV/m1* ; do
+ fusermount -u $MPOINT 2>&1
+done
+expect "no mounted paths - all unmounted"
+mounts
+
+expect "succeeding edit (1) reset config file location"
+mv $TENV/e1_encfs5 $TENV/e1/.encfs5
+$GENCFS -e $TENV/m1 --econfig "-" --password p1 --epath $TENV/e1 --mpoint $TENV/m1 --proceed n --amount n
+expect "1 listed item (1)"
+$GENCFS -l
+
+expect "succeeding edit (1) with custom v5 config file location"
+mv $TENV/e1/.encfs5 $TENV/e1_encfs5
+$GENCFS -e $TENV/m1 --econfig $TENV/e1_encfs5 --password p1 --epath $TENV/e1 --mpoint $TENV/m1 --proceed n --amount n
+expect "1 listed item (1)"
+$GENCFS -l
+
+expect "succeeding remove (1)"
+$GENCFS -r $TENV/m1
+mv $TENV/e1_encfs5 $TENV/e1/.encfs5
+expect "0 items"
+$GENCFS -l
+
+# test custom EncFS config file location (v6)
+
+expect "succeeding add (1) with custom v6 config file location"
+mv $TENV/e2/.encfs6.xml $TENV/e2_encfs6.xml
+$GENCFS -a $TENV/e2 $TENV/m2 --econfig $TENV/e2_encfs6.xml --password p2 --proceed n --amount n
+expect "1 listed item (2)"
+$GENCFS -l
+
+expect "1 succeeding mounts (2)"
+$GENCFS -m $TENV/e2
+expect "1 mounted paths (2)"
+mounts
+
+for MPOINT in $TENV/m2* ; do
+ fusermount -u $MPOINT 2>&1
+done
+expect "no mounted paths - all unmounted"
+mounts
+
+expect "succeeding edit (2) reset config file location"
+mv $TENV/e2_encfs6.xml $TENV/e2/.encfs6.xml
+$GENCFS -e $TENV/m2 --econfig "-" --password p2 --epath $TENV/e2 --mpoint $TENV/m2 --proceed n --amount n
+expect "1 listed item (2)"
+$GENCFS -l
+
+expect "succeeding edit (2) with custom v6 config file locations"
+mv $TENV/e2/.encfs6.xml $TENV/e2_encfs6.xml
+$GENCFS -e $TENV/m2 --econfig $TENV/e2_encfs6.xml --password p2 --epath $TENV/e2 --mpoint $TENV/m2 --proceed n --amount n
+expect "1 listed item (2)"
+$GENCFS -l
+
+expect "succeeding remove (2)"
+$GENCFS -r $TENV/m2
+mv $TENV/e2_encfs6.xml $TENV/e2/.encfs6.xml
+expect "0 items"
+$GENCFS -l
+
+# clean up keyring
$GENCFS -l | grep "mount point" | grep "/tenv/m[0-9]" | awk {'print $4'} | \
while read MP ; do $GENCFS -r $MP ; done
expect "no listed items"
$GENCFS -l
expect "autostart off"
-test -e autostart.desktop && echo "autostart on" || echo "autostart off"
+test -e autostart.desktop && echo "autostart on" || echo "autostart off"