mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
pkg/machine: properly setup zoneinfo symlink
If you run timedatectl inside it will not show the correct timezone, it seems systemd really wants a relative link which is also documented by coreos[1]. Also we can just use path.Join() directly and don't have to convert the path again on windows. [1] https://docs.fedoraproject.org/en-US/fedora-coreos/time-zone/#_setting_the_time_zone_via_ignition Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -280,6 +280,12 @@ var _ = Describe("podman machine init", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(timezoneSession).To(Exit(0))
|
||||
Expect(timezoneSession.outputToString()).To(ContainSubstring("HST"))
|
||||
|
||||
sshTimezone = sshMachine{}
|
||||
timezoneSession, err = mb.setName(name).setCmd(sshTimezone.withSSHCommand([]string{"timedatectl show --property Timezone"})).run()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(timezoneSession).To(Exit(0))
|
||||
Expect(timezoneSession.outputToString()).To(ContainSubstring("Pacific/Honolulu"))
|
||||
})
|
||||
|
||||
It("machine init with volume", func() {
|
||||
|
@ -166,10 +166,11 @@ func (ign *DynamicIgnition) GenerateIgnitionConfig() error {
|
||||
},
|
||||
LinkEmbedded1: LinkEmbedded1{
|
||||
Hard: BoolToPtr(false),
|
||||
// We always want this value in unix form (/path/to/something) because this is being
|
||||
// set in the machine OS (always Linux). However, filepath.join on windows will use a "\\"
|
||||
// separator; therefore we use ToSlash to convert the path to unix style
|
||||
Target: filepath.ToSlash(filepath.Join("/usr/share/zoneinfo", tz)),
|
||||
// We always want this value in unix form (../usr/share/zoneinfo) because this is being
|
||||
// set in the machine OS (always Linux) and systemd needs the relative symlink. However,
|
||||
// filepath.join on windows will use a "\\" separator so use path.Join() which always
|
||||
// uses the slash.
|
||||
Target: path.Join("../usr/share/zoneinfo", tz),
|
||||
},
|
||||
}
|
||||
ignStorage.Links = append(ignStorage.Links, tzLink)
|
||||
|
Reference in New Issue
Block a user