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