rendered paste body##### /etc/config/timezone
config timezone
option timezone 'Europe/Berlin'
##### /etc/init.d/timezone
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=11
TIMEZONE_TABLE=/usr/lib/timezones.csv
get_posix_timezone() {
awk -v timezoneinfo="$timezone" 'BEGIN { FS = " " }
/^(#.*)?$/ { next }
{ list_timezone = $4; if ( list_timezone == timezoneinfo ) { print $3 } }
END { }' < $TIMEZONE_TABLE 2>/dev/null
}
list_available_timezones() {
awk 'BEGIN { FS = " "; last_group="" }
/^(#.*)?$/ {next}
$1 != last_group { last_group=$1; print "\n" $1 }
{ list_timezone = $4; print " " list_timezone }
END { }' < $TIMEZONE_TABLE 2>/dev/null
}
start_service () {
local section="$1"
config_get timezone "$section" timezone
echo "$timezone" > /tmp/x.txt
#if [ ! -h /etc/TZ ]; then
# ln -sf /tmp/TZ "/etc/TZ"
#fi
[ -n "$timezone" ] && get_posix_timezone "$timezone" > "/etc/TZ" || echo "UTC+0" > "/etc/TZ"
}
start () {
config_load "timezone"
config_foreach start_service timezone
}
restart () {
start
}
list_timezones () {
echo "Available time zones"
echo "--------------------"
list_available_timezones
}