Skip to content

Commit

Permalink
Main rfs (#2079)
Browse files Browse the repository at this point in the history
* add rfs bin

* rfs args

* remove rfs type

* return error if unknown ext found
  • Loading branch information
rawdaGastan authored Oct 19, 2023
1 parent c9a7dbf commit 5745b54
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions pkg/flist/flist.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,25 +207,35 @@ func (f *flistModule) mountRO(url, storage string) (string, error) {
}

logPath := filepath.Join(f.log, hash) + ".log"
var args []string

args = append(args,
flistExt := filepath.Ext(url)
args := []string{
"--cache", f.cache,
"--meta", flistPath,
"--storage-url", storage,
"--daemon",
"--log", logPath,
// this is always read-only
"--ro",
mountpoint,
)
}

sublog.Info().Strs("args", args).Msg("starting 0-fs daemon")
cmd := f.commander.Command("g8ufs", args...)
var cmd *exec.Cmd
if flistExt == ".flist" {
sublog.Info().Strs("args", args).Msg("starting g8ufs daemon")
args = append(args,
"--storage-url", storage,
// this is always read-only
"--ro",
mountpoint,
)
cmd = f.commander.Command("g8ufs", args...)
} else if flistExt == ".fl" {
sublog.Info().Strs("args", args).Msg("starting rfs daemon")
args = append([]string{"mount"}, append(args, mountpoint)...)
cmd = f.commander.Command("rfs", args...)
} else {
return "", errors.Errorf("unknown extension: '%s'", flistExt)
}

var out []byte
if out, err = cmd.CombinedOutput(); err != nil {
sublog.Err(err).Str("out", string(out)).Msg("fail to start 0-fs daemon")
sublog.Err(err).Str("out", string(out)).Msg("failed to start 0-fs daemon")
return "", err
}

Expand Down

0 comments on commit 5745b54

Please sign in to comment.