Skip to content

Detect timezone via /etc/timezone with /etc/localtime fallback#62

Merged
nabeya11 merged 2 commits into
mainfrom
use-timedatectl
Jun 22, 2026
Merged

Detect timezone via /etc/timezone with /etc/localtime fallback#62
nabeya11 merged 2 commits into
mainfrom
use-timedatectl

Conversation

@nabeya11

@nabeya11 nabeya11 commented Jun 8, 2026

Copy link
Copy Markdown
Member

The Makefile previously read /etc/timezone to decide whether to use the
Japanese Fedora mirror. That file is not present on all systems (notably
many systemd-based distros that only manage the timezone via timedatectl),
so the check would silently fail.

Read /etc/timezone first, falling back to resolving the /etc/localtime symlink when it is absent.

@nabeya11 nabeya11 requested a review from at-wat June 8, 2026 15:40
@nabeya11 nabeya11 marked this pull request as ready for review June 8, 2026 15:40

@at-wat at-wat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timedatectl doesn't work on WSL environment

$ timedatectl show -p Timezone
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to system scope bus via local transport: Host is down

I think it's better to put /etc/timezone manually.

@nabeya11

nabeya11 commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

How about reading the /etc/localtime symlink instead, like readlink -f /etc/localtime 2>/dev/null | sed 's|.*/zoneinfo/||'?
I'm working on Fedora43, which doesn't have /etc/timezone.

@at-wat

at-wat commented Jun 10, 2026

Copy link
Copy Markdown
Member

Using /etc/localtime should be ok in most case. (It may be a copy of /usr/share/zoneinfo/*/* file though)
I usually put /etc/timezone manually which is a simple text file.

@nabeya11

Copy link
Copy Markdown
Member Author

I'll prefer /etc/timezone and fall back to /etc/localtime.

@nabeya11 nabeya11 changed the title Use timedatectl to detect the timezone Detect timezone via /etc/timezone with /etc/localtime fallback Jun 21, 2026
@nabeya11 nabeya11 requested a review from at-wat June 21, 2026 07:11
@nabeya11 nabeya11 merged commit 930bade into main Jun 22, 2026
12 checks passed
@nabeya11 nabeya11 deleted the use-timedatectl branch June 22, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants