From 60ff91f1b5dace563e1a6a62c3a90162782b3d8a Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 30 Sep 2015 18:21:44 -0300 Subject: Remove /usr/share/zoneinfo.tgz and use FreeBSD stock zoneinfo. It fixes #4726 --- src/etc/inc/system.inc | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'src/etc/inc/system.inc') 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()) { -- cgit v1.1