fix use /etc/timezone where `timedatectl` is missing on Linux
package machine
import (
+ "errors"
+ "os"
"os/exec"
"strings"
)
func getLocalTimeZone() (string, error) {
output, err := exec.Command("timedatectl", "show", "--property=Timezone").Output()
+ if errors.Is(err, exec.ErrNotFound) {
+ output, err = os.ReadFile("/etc/timezone")
+ }
if err != nil {
return "", err
}
