Skip to content

Commit

Permalink
support for v2 of go-fuse
Browse files Browse the repository at this point in the history
  • Loading branch information
kost committed Feb 15, 2020
1 parent 5bb18ce commit 02d338f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion static-appimage-runtime/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/kost/static-appimage/static-appimage-runtime
go 1.13

require (
github.com/hanwen/go-fuse v1.0.0
github.com/hanwen/go-fuse/v2 v2.0.2
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/orivej/e v0.0.0-20180728214217-ac3492690fda
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 // indirect
Expand Down
5 changes: 3 additions & 2 deletions static-appimage-runtime/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
github.com/hanwen/go-fuse v1.0.0 h1:GxS9Zrn6c35/BnfiVsZVWmsG803xwE7eVRDvcf/BEVc=
github.com/hanwen/go-fuse v1.0.0/go.mod h1:unqXarDXqzAk0rt98O2tVndEPIpUgLD9+rwFisZH3Ok=
github.com/hanwen/go-fuse/v2 v2.0.2 h1:BtsqKI5RXOqDMnTgpCb0IWgvRgGLJdqYVZ/Hm6KgKto=
github.com/hanwen/go-fuse/v2 v2.0.2/go.mod h1:HH3ygZOoyRbP9y2q7y3+JM6hPL+Epe29IbWaS0UA81o=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/orivej/e v0.0.0-20180728214217-ac3492690fda h1:fqLgbcmo9qKecZOH8lByuxi9XXoIhNYBpRJEo4rDEUQ=
github.com/orivej/e v0.0.0-20180728214217-ac3492690fda/go.mod h1:eOxOguJBxQH6q/o7CZvmR+fh5v1LHH1sfohtgISSSFA=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE=
Expand Down
30 changes: 12 additions & 18 deletions static-appimage-runtime/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"syscall"
"time"

"github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/hanwen/go-fuse/zipfs"
"github.com/hanwen/go-fuse/v2/zipfs"
"github.com/hanwen/go-fuse/v2/fs"
"github.com/kardianos/osext"
"github.com/orivej/e"
)
Expand All @@ -29,30 +29,24 @@ func main() {
if debug {
fmt.Fprintf(os.Stderr, "[d] executable: %s\n", executable)
}
files, err := zipfs.NewZipTree(executable)
root, err := zipfs.NewZipTree(executable)
e.Exit(err)

mfs := zipfs.NewMemTreeFs(files)
mfs.Name = fmt.Sprintf("fs(%s)", os.Args[0])

if debug {
fmt.Fprintf(os.Stderr, "[d] mfs.Name: %s\n", os.Args[0])
}

opts := &nodefs.Options{
AttrTimeout: 10 * time.Second,
EntryTimeout: 10 * time.Second,
Debug: debug,
}

mnt, err := ioutil.TempDir("", ".mount_")
e.Exit(err)

if debug {
fmt.Fprintf(os.Stderr, "[d] mnt: %s\n", mnt)
fmt.Fprintf(os.Stderr, "[d] mnt: %s\n", mnt)
}

server, _, err := nodefs.MountRoot(mnt, mfs.Root(), opts)
ttl := 10 * time.Second
ttlp := &ttl
opts := &fs.Options{
AttrTimeout: ttlp,
EntryTimeout: ttlp,
}
opts.Debug = debug
server, err := fs.Mount(mnt, root, opts)
e.Exit(err)

go server.Serve()
Expand Down

0 comments on commit 02d338f

Please sign in to comment.