From: Matt Birkholz Date: Sat, 15 Mar 2025 21:17:24 +0000 (-0500) Subject: Use /etc/localtime, not /etc/timezone, in the tz command. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=7c16d105950ef03541bca308d4437257d97e956b;p=Network Use /etc/localtime, not /etc/timezone, in the tz command. --- diff --git a/README.org b/README.org index b56ee0d..955f529 100644 --- a/README.org +++ b/README.org @@ -3214,9 +3214,11 @@ last host in the previous play. #+CAPTION: [[file:abbey][=abbey=]] #+BEGIN_SRC perl :tangle abbey if ($ARGV[0] eq "tz") { - my $city = `cat /etc/timezone`; chomp $city; + # my $city = `cat /etc/timezone`; chomp $city; + my $city = (readlink "/etc/localtime"); + $city =~ s,/usr/share/zoneinfo/,,; my $zone = `date +%Z`; chomp $zone; - print "Setting timezones to $city.\n"; + print "Setting timezones to $city ($zone).\n"; exec ("ansible-playbook", "-e", "\@Secret/become.yml", "-e", "zone=$zone", "-e", "city=$city", "playbooks/timezone.yml"); diff --git a/abbey b/abbey index 8deda6b..800fe3c 100755 --- a/abbey +++ b/abbey @@ -36,9 +36,11 @@ if ($ARGV[0] eq "versions") { } if ($ARGV[0] eq "tz") { - my $city = `cat /etc/timezone`; chomp $city; + # my $city = `cat /etc/timezone`; chomp $city; + my $city = (readlink "/etc/localtime"); + $city =~ s,/usr/share/zoneinfo/,,; my $zone = `date +%Z`; chomp $zone; - print "Setting timezones to $city.\n"; + print "Setting timezones to $city ($zone).\n"; exec ("ansible-playbook", "-e", "\@Secret/become.yml", "-e", "zone=$zone", "-e", "city=$city", "playbooks/timezone.yml");