diff --git a/internal/nsupdate/nsupdate.go b/internal/nsupdate/nsupdate.go index d588a62..c28a886 100644 --- a/internal/nsupdate/nsupdate.go +++ b/internal/nsupdate/nsupdate.go @@ -23,6 +23,8 @@ func New(keyLabel, keyAlgorithm, keySecret, server string, port int, zone string } } +const ENV_PATH string = "/usr/bin/env" + var ( // escape characters specialChars = []string{ @@ -43,7 +45,7 @@ func (c NsUpdateStruct) UpdateTXT(record, recordType, value string) error { value = sanitizeTXT(value) command := fmt.Sprintf("dig +short TXT %s", record) - cmd := exec.Command("/usr/bin/env", "sh", "-c", command) + cmd := exec.Command(ENV_PATH, "sh", "-c", command) cmd.Stdout = &stdout cmd.Stderr = &stderr if err := cmd.Run(); err != nil { @@ -90,7 +92,7 @@ EOF nsupdate -v -k <(printf '%%s' "${DDNS_KEY}") <(printf '%%s\n\n' "${COMMAND}") `, c.Key.Label, c.Key.Algorithm, c.Key.Secret, c.Server, record, strings.ToUpper(recordType)) - cmd := exec.Command("/usr/bin/env", "sh", "-c", command) + cmd := exec.Command(ENV_PATH, "sh", "-c", command) cmd.Stdout = &stdout cmd.Stderr = &stderr if err := cmd.Run(); err != nil { @@ -122,7 +124,7 @@ EOF nsupdate -v -k <(printf '%%s' "${DDNS_KEY}") <(printf '%%s\n\n' "${COMMAND}") `, c.Key.Label, c.Key.Algorithm, c.Key.Secret, c.Server, record, strings.ToUpper(recordType), value) - cmd := exec.Command("/usr/bin/env", "sh", "-c", command) + cmd := exec.Command(ENV_PATH, "sh", "-c", command) cmd.Stdout = &stdout cmd.Stderr = &stderr if err := cmd.Run(); err != nil {