|
|
|
@ -53,7 +53,7 @@ func (w *Wrapper) Cleanup() {
|
|
|
|
|
// Could be killed or terminated due to manual unmount, ignore errors and retry anyway
|
|
|
|
|
w.mountCommand.Process.Kill()
|
|
|
|
|
// Sometimes not correctly unmounted causing consecutive open attempts of mounted folder to fail
|
|
|
|
|
exec.Command("umount", "restic").Run()
|
|
|
|
|
exec.Command("umount", MountDir()).Run()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -78,12 +78,12 @@ func (w *Wrapper) MountBackups(c *Config) error {
|
|
|
|
|
w.Cleanup()
|
|
|
|
|
|
|
|
|
|
// Open the folder first: MacFuse could take a second; results in occasional weird errors otherwise.
|
|
|
|
|
err := openFolder(c.MountDir())
|
|
|
|
|
err := openFolder(MountDir())
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
w.mountCommand = resticCmd("--password-file", PasswordFile(), "-r", c.Repository, "mount", c.MountDir())
|
|
|
|
|
w.mountCommand = resticCmd("--password-file", PasswordFile(), "-r", c.Repository, "mount", MountDir())
|
|
|
|
|
err = w.mountCommand.Start() // restic's mount is a blocking call
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("restic mount cmd: %w", err)
|
|
|
|
@ -141,7 +141,7 @@ func (w *Wrapper) UpdateLatestSnapshots(c *Config) error {
|
|
|
|
|
// Backup uses "restic backup" to create a new snapshot. This is a blocking call.
|
|
|
|
|
// Returns a ResticCmdTimeoutError if no response from restic after cmdTimeout
|
|
|
|
|
func (w *Wrapper) Backup(c *Config) error {
|
|
|
|
|
cmd := resticCmd("--password-file", PasswordFile(), "-r", c.Repository, "--exclude-file", ExcludeFile(), "backup", c.Backup, "--no-scan")
|
|
|
|
|
cmd := resticCmd("--password-file", PasswordFile(), "-r", c.Repository, "--exclude-file", ExcludeFile(), "backup", c.Backup)
|
|
|
|
|
stdout, _ := cmd.StdoutPipe()
|
|
|
|
|
|
|
|
|
|
busy := make(chan bool, 1)
|
|
|
|
|