On Fri, 23 Jun 2023 at 16:47, gregor herrmann <gre...@debian.org> wrote: > > On Wed, 21 Jun 2023 23:16:58 +0100, bl...@debian.org wrote: > > > libsys-info-driver-linux-perl is currently referencing /etc/timezone > > without support for /etc/localtime. /etc/timezone is a legacy > > interface that is Debian specific. The cross-distro standard > > /etc/localtime (as a symlink to the appropriate timezone file), so > > please switch your package to /etc/localtime. tzsetup will stop > > creating /etc/timezone soon. > > /etc/localtime is a _text_ file, containing the name of the timezone; > /etc/timezone is a symlink to the corresponding _binary_ timezone > file. > > The code in lib/Sys/Info/Driver/Linux/OS.pm just reads the text from > /etc/localtime currently; replacing it with /etc/localtime therefore > won't work. > > Is there any facility to get the name of the timezone out of > /etc/localtime (short of following the symlink and mangling the > target file name)?
If you want to restrict it to filesystem access, then reading the link and cutting the leading directories is exactly the suggested pattern: $ cat /etc/timezone Europe/London $ readlink /etc/localtime | sed "s|/usr/share/zoneinfo/||" Europe/London Or any variations thereof, it's quite trivial as you can see. If you want fully programmatic API there's timedate1 via D-Bus: https://www.freedesktop.org/software/systemd/man/org.freedesktop.timedate1.html or the command line equivalent via timedatectl: https://www.freedesktop.org/software/systemd/man/timedatectl.html Kind regards, Luca Boccassi