mirror of https://github.com/containers/podman.git
fix #17244: use /etc/timezone where `timedatectl` is missing on Linux
Signed-off-by: nabbisen <nabbisen@scqr.net>
This commit is contained in:
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue