diff options
author | Renato Botelho <renato@netgate.com> | 2015-09-30 18:21:44 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-09-30 18:21:44 -0300 |
commit | 60ff91f1b5dace563e1a6a62c3a90162782b3d8a (patch) | |
tree | 89110ebb0ac6c8297da7736a98de4081838f7358 /src/etc/inc/system.inc | |
parent | 9cffad03967f2f02a3d4632173ddfbfb0dbd21e7 (diff) | |
download | pfsense-60ff91f1b5dace563e1a6a62c3a90162782b3d8a.zip pfsense-60ff91f1b5dace563e1a6a62c3a90162782b3d8a.tar.gz |
Remove /usr/share/zoneinfo.tgz and use FreeBSD stock zoneinfo. It fixes #4726
Diffstat (limited to 'src/etc/inc/system.inc')
-rw-r--r-- | src/etc/inc/system.inc | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 34002ff..d172810 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -1498,6 +1498,18 @@ EOD; } +function system_get_timezone_list() { + global $g; + + $file_list = glob("/usr/share/zoneinfo/*/*"); + + if (empty($file_list)) { + $file_list[] = $g['default_timezone']; + } + + return str_replace('/usr/share/zoneinfo/', '', $file_list); +} + function system_timezone_configure() { global $config, $g; if (isset($config['system']['developerspew'])) { @@ -1512,28 +1524,11 @@ function system_timezone_configure() { } /* extract appropriate timezone file */ - $timezone = $syscfg['timezone']; - if ($timezone) { - exec('/usr/bin/tar -tvzf /usr/share/zoneinfo.tgz', $tzs); - foreach ($tzs as $tz) { - if (preg_match(",{$timezone}$,", $tz)) { - break; - } - if (preg_match(",{$timezone} link to *(.*)$,", $tz, $matches)) { - $timezone = $matches[1]; - break; - } - } - } else { - $timezone = "Etc/UTC"; - } - + $timezone = (isset($syscfg['timezone']) ? $syscfg['timezone'] : $g['default_timezone']); conf_mount_rw(); - - exec("LANG=C /usr/bin/tar xzfO /usr/share/zoneinfo.tgz " . - escapeshellarg($timezone) . " > /etc/localtime"); - - mwexec("sync"); + /* DO NOT remove \n otherwise tzseup will fail */ + @file_put_contents("/var/db/zoneinfo", $timezone . "\n"); + mwexec("/usr/sbin/tzsetup -r"); conf_mount_ro(); if (platform_booting()) { |