Be more lenient with matching the ObjectiveFs mount path
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-03 14:20:03 +02:00
parent 567aa92cd1
commit e3ead3ba0a

View File

@@ -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
}