forked from Ivasoft/objectivefs-docker-volume
Be more lenient with matching the ObjectiveFs mount path
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
3
main.go
3
main.go
@@ -814,12 +814,13 @@ func getMountedSnaphots(baseDir string, checkMount bool) (map[string]string, err
|
||||
}
|
||||
|
||||
func isObjectiveFsMount(path string) (bool, error) {
|
||||
nameToMatch := filepath.Base(path)
|
||||
mount := exec.Command("df", "--output=target", "-t", "fuse.objectivefs", path)
|
||||
if data, err := mount.CombinedOutput(); err == nil {
|
||||
scanner := bufio.NewScanner(strings.NewReader(string(data)))
|
||||
// On success the first line contains column headers (in our case "Mounted on")
|
||||
// and the second line contains the nearest mount point on the root path
|
||||
return scanner.Scan() && scanner.Scan() && strings.TrimSpace(scanner.Text()) == path, nil
|
||||
return scanner.Scan() && scanner.Scan() && filepath.Base(strings.TrimSpace(scanner.Text())) == nameToMatch, nil
|
||||
} else {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user