Added fuse to config
This commit is contained in:
parent
4389609500
commit
8f57a0be8d
@ -106,5 +106,8 @@ func setCfgDefaults() {
|
||||
"notifs.ignore.body": []string{},
|
||||
|
||||
"music.vol.interval": 5,
|
||||
|
||||
"fuse.enabled": false,
|
||||
"fuse.mountpoint": "/tmp/itd/mnt",
|
||||
}, "."), nil)
|
||||
}
|
||||
|
9
fuse.go
9
fuse.go
@ -520,10 +520,9 @@ func (f *ITNode) Rmdir(ctx context.Context, name string) syscall.Errno {
|
||||
|
||||
func startFuse(ctx context.Context, dev *infinitime.Device) error {
|
||||
// This is where we'll mount the FS
|
||||
mntDir := "/tmp/x"
|
||||
os.Mkdir(mntDir, 0755)
|
||||
os.Mkdir(k.String("fuse.mountpoint"), 0755)
|
||||
root := &ITNode{kind: 0}
|
||||
server, err := fs.Mount(mntDir, root, &fs.Options{
|
||||
server, err := fs.Mount(k.String("fuse.mountpoint"), root, &fs.Options{
|
||||
MountOptions: fuse.MountOptions{
|
||||
// Set to true to see how the file system works.
|
||||
Debug: false,
|
||||
@ -532,14 +531,14 @@ func startFuse(ctx context.Context, dev *infinitime.Device) error {
|
||||
})
|
||||
if err != nil {
|
||||
log.Error("Mounting failed").
|
||||
Str("target", mntDir).
|
||||
Str("target", k.String("fuse.mountpoint")).
|
||||
Err(err).
|
||||
Send()
|
||||
return err
|
||||
}
|
||||
|
||||
log.Info("Mounted on target").
|
||||
Str("target", mntDir).
|
||||
Str("target", k.String("fuse.mountpoint")).
|
||||
Send()
|
||||
|
||||
mydev := Device{dev : dev};
|
||||
|
8
main.go
8
main.go
@ -187,9 +187,11 @@ func main() {
|
||||
log.Error("Error starting socket").Err(err).Send()
|
||||
}
|
||||
// Start fuse socket
|
||||
err = startFuse(ctx, dev)
|
||||
if err != nil {
|
||||
log.Error("Error starting socket").Err(err).Send()
|
||||
if k.Bool("fuse.enabled") {
|
||||
err = startFuse(ctx, dev)
|
||||
if err != nil {
|
||||
log.Error("Error starting fuse socket").Err(err).Send()
|
||||
}
|
||||
}
|
||||
// Block forever
|
||||
select {}
|
||||
|
Loading…
Reference in New Issue
Block a user