#!/usr/bin/env python
-import sys, os, stat, errno, fuse, re, time, tempfile
+import sys, os, errno
from bup import options, git, vfs
from bup.helpers import *
+try:
+ import fuse
+except ImportError:
+ log('error: cannot find the python "fuse" module; please install it\n')
+ sys.exit(1)
class Stat(fuse.Stat):
self.st_atime = 0
self.st_mtime = 0
self.st_ctime = 0
+ self.st_blocks = 0
+ self.st_blksize = 0
+ self.st_rdev = 0
cache = {}
st.st_mode = node.mode
st.st_nlink = node.nlinks()
st.st_size = node.size()
+ st.st_mtime = node.mtime
+ st.st_ctime = node.ctime
+ st.st_atime = node.atime
return st
except vfs.NoSuchFile:
return -errno.ENOENT
def read(self, path, size, offset):
log('--read(%r)\n' % path)
n = cache_get(self.top, path)
- return n.readbytes(offset, size)
+ o = n.open()
+ o.seek(offset)
+ return o.read(size)
if not hasattr(fuse, '__version__'):
--
d,debug increase debug level
f,foreground run in foreground
+o,allow-other allow other users to access the filesystem
"""
-o = options.Options('bup fuse', optspec)
+o = options.Options(optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
if len(extra) != 1:
f.fuse_args.setmod('foreground')
print f.multithreaded
f.multithreaded = False
-f.fuse_args.add('allow_other')
+if opt.allow_other:
+ f.fuse_args.add('allow_other')
f.main()