mirror of
https://github.com/containers/podman.git
synced 2025-11-01 22:32:50 +08:00
Moves all of the ignitionfiles out of the `machine` package and into its own called `ignition`. This required `VMType` to get moved out of the `machine` package and into the `define` package in order to prevent a circular dependency. Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
21 lines
450 B
Go
21 lines
450 B
Go
package ignition
|
|
|
|
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
|
|
}
|
|
// Remove prepended field and the newline
|
|
return strings.TrimPrefix(strings.TrimSuffix(string(output), "\n"), "Timezone="), nil
|
|
}
|