From 7c16d105950ef03541bca308d4437257d97e956b Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sat, 15 Mar 2025 16:17:24 -0500 Subject: [PATCH] Use /etc/localtime, not /etc/timezone, in the tz command. --- README.org | 6 ++++-- abbey | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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"); -- 2.25.1