mirror of https://github.com/perkeep/perkeep.git
cmd/pk-mount: default to mounting at /pk if it exists
And recommend /pk. Change-Id: I5255c203e46b503a1b4c59856e085d7359d84f4f
This commit is contained in:
parent
2b720aa101
commit
e52593865b
|
@ -93,12 +93,17 @@ func main() {
|
|||
if narg > 0 {
|
||||
mountPoint = flag.Arg(0)
|
||||
} else {
|
||||
mountPoint, err = ioutil.TempDir("", "pk-mount")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if fi, err := os.Stat("/pk"); err == nil && fi.IsDir() {
|
||||
log.Printf("no mount point given; using /pk")
|
||||
mountPoint = "/pk"
|
||||
} else {
|
||||
mountPoint, err = ioutil.TempDir("", "pk-mount")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Printf("no mount point given and recommended directory /pk doesn't exist; using temp directory %s", mountPoint)
|
||||
defer os.Remove(mountPoint)
|
||||
}
|
||||
log.Printf("No mount point given. Using: %s", mountPoint)
|
||||
defer os.Remove(mountPoint)
|
||||
}
|
||||
|
||||
errorf := func(msg string, args ...interface{}) {
|
||||
|
|
Loading…
Reference in New Issue