Skip to content

auto-timezone: add new package#29233

Open
AkazaRenn wants to merge 9 commits intoopenwrt:masterfrom
AkazaRenn:auto-timezone
Open

auto-timezone: add new package#29233
AkazaRenn wants to merge 9 commits intoopenwrt:masterfrom
AkazaRenn:auto-timezone

Conversation

@AkazaRenn
Copy link
Copy Markdown

@AkazaRenn AkazaRenn commented Apr 24, 2026

📦 Package Details

Maintainer: none, new package

Description:

A hotplug script to auto set the timezone based on the IP address. It doesn't bring the endpoint by default to avoid promoting any service, so the user will need to set their own at auto-timezone.config.endpoint. Triggered once when the device is online.

I tested with https://ipinfo.io/timezone. It works on both rebooting and restarting the interface.


🧪 Run Testing Details

  • OpenWrt Version: 25.12.2
  • OpenWrt Target/Subtarget: mediatek/filogic
  • OpenWrt Device: OpenWrt One

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc., using
    make package/<your-package>/refresh V=s
  • It is structured in a way that it is potentially upstreamable
    (e.g., subject line, commit description, etc.)
    We must try to upstream patches to reduce maintenance burden.

Renn Akaza added 6 commits April 24, 2026 23:46
A hotplug script to auto set the timezone based on the IP address

Signed-off-by: Renn Akaza <openwrt.org-auto-timezone@akaza.ren>
fix indentation

Signed-off-by: Renn Akaza <openwrt.org-auto-timezone@akaza.ren>
update makefile indentation

Signed-off-by: Renn Akaza <openwrt.org-auto-timezone@akaza.ren>
revert makefile's indentation

Signed-off-by: Renn Akaza <openwrt.org-auto-timezone@akaza.ren>
minor formatting on the script

Signed-off-by: Renn Akaza <openwrt.org-auto-timezone@akaza.ren>
avoid creating new functions unnecessarily

Signed-off-by: Renn Akaza <openwrt.org-auto-timezone@akaza.ren>
@pprindeville
Copy link
Copy Markdown
Member

I like the idea, especially as I'm building a Banana Pi-R4 Pro to go in the family camper, but I'm wondering if using gpsd isn't a better idea...

We have a T-Mobile 5G card with a static address (so that won't change) and Starlink Mini so our address is CGNAT'd and meaningless (we use mwan3 to bounce between whether we're in 5G coverage or have to fallback on metered Starlink).

Copy link
Copy Markdown
Member

@pprindeville pprindeville left a comment

Choose a reason for hiding this comment

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

Minor changes needed.

Comment thread utils/auto-timezone/files/99-auto-timezone Outdated
exit 0
fi

log() {
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.

I would pass priority as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I added two functions log_info and log_error to handle the priorities in 1dbe849.

Comment thread utils/auto-timezone/files/99-auto-timezone Outdated
Comment thread utils/auto-timezone/Makefile Outdated
Hotplug script to automatically configure the timezone UCI settings based on the IP address.

The user needs to set their own endpoint to get the IANA timezone string, e.g.:
uci set auto-timezone.config.endpoint="https://domain.tld/json"
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.

Could this be made more clear?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I updated the description on the expected response from the endpoint in 1dbe849. Please let me know if you expect something else.

Renn Akaza and others added 2 commits April 26, 2026 22:01
address comments.
1. add log info/error
2. wrap posix timezone convertion in a function
3. update package description

Signed-off-by: Renn Akaza <openwrt.org-auto-timezone@akaza.ren>
@AkazaRenn
Copy link
Copy Markdown
Author

AkazaRenn commented Apr 26, 2026

I like the idea, especially as I'm building a Banana Pi-R4 Pro to go in the family camper, but I'm wondering if using gpsd isn't a better idea...

We have a T-Mobile 5G card with a static address (so that won't change) and Starlink Mini so our address is CGNAT'd and meaningless (we use mwan3 to bounce between whether we're in 5G coverage or have to fallback on metered Starlink).

I don't have any external GPS hardware to test it so it would be hard...

@pprindeville
Copy link
Copy Markdown
Member

I don't have any external GPS hardware to test it so it would be hard...

Various 5G cards will provide GPS or A-GPS, as well as some $20 USB fobs.

@AkazaRenn
Copy link
Copy Markdown
Author

I don't have any external GPS hardware to test it so it would be hard...

Various 5G cards will provide GPS or A-GPS, as well as some $20 USB fobs.

Can we leave for later if there are enough people needing it? I feel like it's overkill to let the router to deal with GPS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants