import os
import subprocess
from base import FuseBase

class FuseEncfs(FuseBase):
	def __init__(self):
		FuseBase.__init__(self)

	def mount(self, mount_path, parent_path=None):
		if parent_path is None:
			raise ValueError("EncFS filesystem requires parent path")

		FuseBase.mount(self, mount_path)

		res = subprocess.call(["encfs --standard --extpass=/usr/lib/ssh/ssh-askpass "+parent_path+" "+mount_path], shell=True)
		if res != 0:
			raise RuntimeError("Cannot mount encfs filesystem [#"+str(res)+"]")

	def get_type(self):
		return "encfs"
@@ -259,16 +259,136 @@
 path%22)%0A%0A
+%09%09askpass = %22/usr/lib/ssh/ssh-askpass%22%0A%09%09if not os.path.isfile(askpass):%0A%09%09%09raise RuntimeError(%22Cannot find %22+askpass)%0A%0A
 %09%09FuseBa
@@ -472,32 +472,19 @@
 ass=
-/usr/lib/ssh/ssh-
+%22+
 askpass
++%22
  %22+p
@@ -647,8 +647,9 @@
  %22encfs%22
+%0A

Check for ssh-askpass before mounting encfs, see #17