mirror of https://github.com/restic/restic.git
mount: append repository ID to FS name of FUSE mount
This commit is contained in:
parent
da47967316
commit
eb0e8d316d
|
@ -5,6 +5,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -141,9 +142,16 @@ func runMount(ctx context.Context, opts MountOptions, gopts GlobalOptions, args
|
|||
return err
|
||||
}
|
||||
|
||||
repositoryID, err := repo.ID()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fuseMountName := fmt.Sprintf("restic:%s", repositoryID)
|
||||
|
||||
mountOptions := []systemFuse.MountOption{
|
||||
systemFuse.ReadOnly(),
|
||||
systemFuse.FSName("restic"),
|
||||
systemFuse.FSName(fuseMountName),
|
||||
systemFuse.MaxReadahead(128 * 1024),
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,15 @@ func (r *Repository) Config() restic.Config {
|
|||
return r.cfg
|
||||
}
|
||||
|
||||
// ID returns the repository ID.
|
||||
func (r *Repository) ID() (restic.ID, error) {
|
||||
id, err := restic.ParseID(r.cfg.ID)
|
||||
if err != nil {
|
||||
return restic.ID{}, err
|
||||
}
|
||||
return id, nil
|
||||
}
|
||||
|
||||
// packSize return the target size of a pack file when uploading
|
||||
func (r *Repository) packSize() uint {
|
||||
return r.opts.PackSize
|
||||
|
|
Loading…
Reference in New Issue