custom restic binary

This commit is contained in:
2021-05-06 15:04:35 +02:00
parent 9256cdc38c
commit 88c6949208
4 changed files with 14 additions and 3 deletions

View File

@@ -10,13 +10,15 @@ import (
"github.com/cupcakearmy/autorestic/internal/colors"
)
var RESTIC_BIN string
func CheckIfCommandIsCallable(cmd string) bool {
_, err := exec.LookPath(cmd)
return err == nil
}
func CheckIfResticIsCallable() bool {
return CheckIfCommandIsCallable("restic")
return CheckIfCommandIsCallable(RESTIC_BIN)
}
type ExecuteOptions struct {
@@ -50,7 +52,7 @@ func ExecuteCommand(options ExecuteOptions, args ...string) (string, error) {
}
func ExecuteResticCommand(options ExecuteOptions, args ...string) (string, error) {
options.Command = "restic"
options.Command = RESTIC_BIN
return ExecuteCommand(options, args...)
}