Use /etc/localtime, not /etc/timezone, in the tz command.
authorMatt Birkholz <matt@birchwood-abbey.net>
Sat, 15 Mar 2025 21:17:24 +0000 (16:17 -0500)
committerMatt Birkholz <matt@birchwood-abbey.net>
Sat, 15 Mar 2025 21:17:24 +0000 (16:17 -0500)
README.org
abbey

index b56ee0d09b681d3fee20f272c2bbdba391dca245..955f52980e3432dc166fbb044608b516a4eba2a2 100644 (file)
@@ -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 8deda6b4263ec979662a27f5b0371c9b857d36cb..800fe3ca81f7e0404ac9d96c486355c4f59c41d1 100755 (executable)
--- 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");