Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
f30161b0
Commit
f30161b0
authored
Nov 14, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmds: nicer error on no mountpoint
parent
fa8fc1ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
core/commands2/mount_unix.go
core/commands2/mount_unix.go
+20
-4
No files found.
core/commands2/mount_unix.go
View file @
f30161b0
...
...
@@ -4,10 +4,11 @@ package commands
import
(
"fmt"
"strings"
"time"
cmds
"github.com/jbenet/go-ipfs/commands"
"github.com/jbenet/go-ipfs/config"
config
"github.com/jbenet/go-ipfs/config"
core
"github.com/jbenet/go-ipfs/core"
ipns
"github.com/jbenet/go-ipfs/fuse/ipns"
rofs
"github.com/jbenet/go-ipfs/fuse/readonly"
...
...
@@ -17,6 +18,9 @@ import (
// TODO is this non-deterministic?
const
mountTimeout
=
time
.
Second
// fuseNoDirectory used to check the returning fuse error
const
fuseNoDirectory
=
"fusermount: failed to access mountpoint"
var
mountCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Mounts IPFS to the filesystem (read-only)"
,
...
...
@@ -25,7 +29,7 @@ Mount ipfs at a read-only mountpoint on the OS (default: /ipfs and /ipns).
All ipfs objects will be accessible under that directory. Note that the
root will not be listable, as it is virtual. Access known paths directly.
You may
k
ave to create /ipfs and /ipfs before using 'ipfs mount':
You may
h
ave to create /ipfs and /ipfs before using 'ipfs mount':
> sudo mkdir /ipfs /ipns
> sudo chown `
+
"`"
+
`whoami`
+
"`"
+
` /ipfs /ipns
...
...
@@ -36,6 +40,8 @@ Mount ipfs at a read-only mountpoint on the OS (default: /ipfs and /ipns).
All ipfs objects will be accessible under that directory. Note that the
root will not be listable, as it is virtual. Access known paths directly.
You may have to create /ipfs and /ipfs before using 'ipfs mount':
> sudo mkdir /ipfs /ipns
> sudo chown `
+
"`"
+
`whoami`
+
"`"
+
` /ipfs /ipns
> ipfs mount
...
...
@@ -117,12 +123,22 @@ baz
nsdone
:=
mountIpns
(
node
,
nsdir
,
fsdir
)
fmtFuseErr
:=
func
(
err
error
)
error
{
s
:=
err
.
Error
()
if
strings
.
Contains
(
s
,
fuseNoDirectory
)
{
s
=
strings
.
Replace
(
s
,
`fusermount: "fusermount:`
,
""
,
-
1
)
s
=
strings
.
Replace
(
s
,
`\n", exit status 1`
,
""
,
-
1
)
return
cmds
.
ClientError
(
s
)
}
return
err
}
// wait until mounts return an error (or timeout if successful)
select
{
case
err
:=
<-
fsdone
:
return
nil
,
err
return
nil
,
fmtFuseErr
(
err
)
case
err
:=
<-
nsdone
:
return
nil
,
err
return
nil
,
fmtFuseErr
(
err
)
// mounted successfully, we timed out with no errors
case
<-
time
.
After
(
mountTimeout
)
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment