Mercurial > hg > dhcpcd
annotate hooks/15-timezone @ 5535:a0d828e25482 draft
Add --noconfigure option
With this set dhcpcd will not configure anything on the host.
The expectation is that a 3rd party script will instead.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 04 Nov 2020 14:18:48 +0000 |
| parents | e323d30f279e |
| children |
| rev | line source |
|---|---|
| 3936 | 1 # Configure timezone |
| 2 | |
| 3 : ${localtime:=/etc/localtime} | |
| 4 | |
| 5 set_zoneinfo() | |
| 6 { | |
| 7 [ -z "$new_tzdb_timezone" ] && return 0 | |
| 8 | |
|
4215
e323d30f279e
dhcpcd-run-hooks: POSIX shell does not require the local builtin
Roy Marples <roy@marples.name>
parents:
3936
diff
changeset
|
9 zoneinfo_dir= |
| 3936 | 10 for d in \ |
| 11 /usr/share/zoneinfo \ | |
| 12 /usr/lib/zoneinfo \ | |
| 13 /var/share/zoneinfo \ | |
| 14 /var/zoneinfo \ | |
| 15 ; do | |
| 16 if [ -d "$d" ]; then | |
| 17 zoneinfo_dir="$d" | |
| 18 break | |
| 19 fi | |
| 20 done | |
| 21 | |
| 22 if [ -z "$zoneinfo_dir" ]; then | |
| 23 syslog warning "timezone directory not found" | |
| 24 return 1 | |
| 25 fi | |
| 26 | |
| 27 zone_file="$zoneinfo_dir/$new_tzdb_timezone" | |
| 28 if [ ! -e "$zone_file" ]; then | |
| 29 syslog warning "no timezone definition for $new_tzdb_timezone" | |
| 30 return 1 | |
| 31 fi | |
| 32 | |
| 33 if copy_file "$zone_file" "$localtime"; then | |
| 34 syslog info "timezone changed to $new_tzdb_timezone" | |
| 35 fi | |
| 36 } | |
| 37 | |
| 38 # For ease of use, map DHCP6 names onto our DHCP4 names | |
| 39 case "$reason" in | |
| 40 BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6) | |
| 41 new_tzdb_timezone="$new_dhcp6_tzdb_timezone" | |
| 42 ;; | |
| 43 esac | |
| 44 | |
| 5535 | 45 if $if_configured && $if_up; then |
| 3936 | 46 set_zoneinfo |
| 47 fi |
