MCPcopy Index your code
hub / github.com/celer-pkg/celer / updateFSTabEntry

Method updateFSTabEntry

pkgcache/cache_setup.go:341–352  ·  view source on GitHub ↗
(serverExport, mountPoint string)

Source from the content-addressed store, hash-verified

339}
340
341func (n *NFSClientSetup) updateFSTabEntry(serverExport, mountPoint string) error {
342 fstabEntry := fmt.Sprintf("%s %s nfs rw,_netdev,noatime,rsize=1048576,wsize=1048576 0 0", serverExport, mountPoint)
343 if err := fileio.ReplaceContent(nfsFSTabPath, fstabEntry, func(line string) bool {
344 fields := strings.Fields(line)
345 return len(fields) >= 2 && fields[0] == serverExport && fields[1] == mountPoint
346 }); err != nil {
347 return fmt.Errorf("failed to update fstab entry -> %w", err)
348 }
349
350 color.PrintHint("✔ add/update fstab entry: %q", fstabEntry)
351 return nil
352}
353
354func (n *NFSClientSetup) removeFSTabEntry(serverExport, mountPoint string) error {
355 if err := fileio.RemoveContent(nfsFSTabPath, func(line string) bool {

Callers 1

SetupMethod · 0.95

Calls 3

ReplaceContentFunction · 0.92
PrintHintFunction · 0.92
SprintfMethod · 0.80

Tested by

no test coverage detected