* [pve-devel] [PATCH container] use timedatectl to retrieve container host timezone
@ 2025-12-31 10:27 Stefan Mayr
0 siblings, 0 replies; only message in thread
From: Stefan Mayr @ 2025-12-31 10:27 UTC (permalink / raw)
To: pve-devel
In addition to fixing #7175 this also switches the /etc/timezone
dependency of the LXC integration to timedatectl.
One less dependency on that code in the INotify module.
Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Suggested-by: Maximiliano Sandroval <m.sandoval@proxmox.com>
Signed-off-by: Stefan Mayr <stefan@mayr-stefan.de>
---
src/PVE/LXC/Setup.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index 87330c4..0d00376 100644
--- a/src/PVE/LXC/Setup.pm
+++ b/src/PVE/LXC/Setup.pm
@@ -127,7 +127,10 @@ sub new {
# Cache some host files we need access to:
$plugin->{host_resolv_conf} = PVE::INotify::read_file('resolvconf');
- $plugin->{host_timezone} = PVE::INotify::read_file('timezone');
+ PVE::Tools::run_command(
+ ['timedatectl', 'show', '--property=Timezone', '--value'],
+ outfunc => sub { $plugin->{host_timezone} //= shift },
+ );
abs_path('/etc/localtime') =~ m|^(/.+)| or die "invalid /etc/localtime\n"; # untaint
$plugin->{host_localtime} = $1;
--
2.34.1
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-31 10:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-31 10:27 [pve-devel] [PATCH container] use timedatectl to retrieve container host timezone Stefan Mayr
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.