mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
fix #17244: use /etc/timezone where timedatectl
is missing on Linux
Signed-off-by: nabbisen <nabbisen@scqr.net>
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user