fix : use /etc/timezone where timedatectl is missing on Linux

Signed-off-by: nabbisen <nabbisen@scqr.net>
This commit is contained in:
nabbisen
2023-01-27 22:46:39 +09:00
parent 8fce9dcde6
commit 12d70446f4

@ -1,12 +1,17 @@
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
}