ipfs1/mount: text + unmounting
Juan Batiz-Benet committed
Nov 16, 2014 at 02:35 UTC
4ac6db9a2486fa9e8f66983de19edf4dcdc1d92a
1 file changed
+17
cmd/ipfs/mount_unix.go
+17
@@ -3,6 +3,11 @@
3
package main
4
5
import (
6
+ "fmt"
7
+ "os"
8
+ "os/signal"
9
+ "syscall"
10
+
11
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
12
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
13
@@ -90,9 +95,21 @@ func doMount(node *core.IpfsNode, fsdir, nsdir string) error {
95
}
96
}
97
98
+ fmt.Printf("mounted ipfs at %s\n", fsdir)
99
+ fmt.Printf("mounted ipns at %s\n", nsdir)
100
+
101
// setup node state, so that it can be cancelled
102
node.Mounts.Ipfs = fsmount
103
node.Mounts.Ipns = nsmount
104
+
105
+ // wait until we kill
106
+ sigc := make(chan os.Signal, 1)
107
+ signal.Notify(sigc, syscall.SIGHUP, syscall.SIGINT,
108
+ syscall.SIGTERM, syscall.SIGQUIT)
109
+ <-sigc
110
+
111
+ fmt.Println("unmounting...")
112
+ node.Close()
113
return nil
114
}
115