diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-01-30 13:29:46 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-01-30 16:23:03 +0100 |
commit | f2ed769880271654297a4be420f26ab94d39666b (patch) | |
tree | 4cbfc23184993e8ef11bb1d60b307cbb3644a259 /dhcpcd/dhcpcd-hooks/15-timezone | |
parent | arphole: New test (diff) | |
download | rtems-libbsd-f2ed769880271654297a4be420f26ab94d39666b.tar.bz2 |
DHCPCD(8): Import
Import DHCPCD(8) from:
http://roy.marples.name/projects/dhcpcd/
The upstream sources can be obtained via:
fossil clone http://roy.marples.name/projects/dhcpcd
The imported version is 2014-01-29 19:46:44 [6b209507bb].
Diffstat (limited to 'dhcpcd/dhcpcd-hooks/15-timezone')
-rw-r--r-- | dhcpcd/dhcpcd-hooks/15-timezone | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/dhcpcd/dhcpcd-hooks/15-timezone b/dhcpcd/dhcpcd-hooks/15-timezone new file mode 100644 index 00000000..23ae924c --- /dev/null +++ b/dhcpcd/dhcpcd-hooks/15-timezone @@ -0,0 +1,51 @@ +# Configure timezone + +: ${localtime:=/etc/localtime} + +set_zoneinfo() +{ + local zoneinfo_dir= zone_file= + + [ -z "$new_tzdb_timezone" ] && return 0 + + for d in \ + /usr/share/zoneinfo \ + /usr/lib/zoneinfo \ + /var/share/zoneinfo \ + /var/zoneinfo \ + ; do + if [ -d "$d" ]; then + zoneinfo_dir="$d" + break + fi + done + + if [ -z "$zoneinfo_dir" ]; then + syslog warning "timezone directory not found" + return 1 + fi + + zone_file="$zoneinfo_dir/$new_tzdb_timezone" + if [ ! -e "$zone_file" ]; then + syslog warning "no timezone definition for $new_tzdb_timezone" + return 1 + fi + + syslog info "timezone changed to $new_tzdb_timezone" + if [ -h "$localtime" ]; then + ln -sf "$zone_file" "$localtime" + else + cp "$zone_file" "$localtime" + fi +} + +# For ease of use, map DHCP6 names onto our DHCP4 names +case "$reason" in +BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6) + new_tzdb_timezone="$new_dhcp6_tzdb_timezone" + ;; +esac + +if $if_up; then + set_zoneinfo +fi |