mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-31 22:47:51 +00:00
rework timezone setup
- get rid of tz-data-monitor.* - timezone is now persistent (saved to .cache)
This commit is contained in:
parent
adb0cf1ad1
commit
c42b141d2e
@ -0,0 +1,26 @@
|
|||||||
|
From 25be1b385303a8114d7e227ffab52a22de42ccd1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stefan Saraev <stefan@saraev.ca>
|
||||||
|
Date: Tue, 26 Nov 2013 20:53:08 +0200
|
||||||
|
Subject: [PATCH] run tzdata-setup on timezone change
|
||||||
|
|
||||||
|
---
|
||||||
|
xbmc/linux/LinuxTimezone.cpp | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/xbmc/linux/LinuxTimezone.cpp b/xbmc/linux/LinuxTimezone.cpp
|
||||||
|
index be7bce6..4000181 100644
|
||||||
|
--- a/xbmc/linux/LinuxTimezone.cpp
|
||||||
|
+++ b/xbmc/linux/LinuxTimezone.cpp
|
||||||
|
@@ -158,6 +158,9 @@ void CLinuxTimezone::OnSettingChanged(const CSetting *setting)
|
||||||
|
const std::string &settingId = setting->GetId();
|
||||||
|
if (settingId == "locale.timezone")
|
||||||
|
{
|
||||||
|
+ const std::string cmd = std::string("sh /usr/lib/openelec/tzdata-setup ") + ((CSettingString*)setting)->GetValue().c_str();
|
||||||
|
+ system(cmd.c_str());
|
||||||
|
+
|
||||||
|
SetTimezone(((CSettingString*)setting)->GetValue());
|
||||||
|
|
||||||
|
CDateTime::ResetTimezoneBias();
|
||||||
|
--
|
||||||
|
1.8.3.2
|
||||||
|
|
@ -59,6 +59,5 @@ post_makeinstall_target() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post_install() {
|
post_install() {
|
||||||
enable_service tz-data-monitor.path
|
|
||||||
enable_service tz-data.service
|
enable_service tz-data.service
|
||||||
}
|
}
|
||||||
|
@ -19,14 +19,25 @@
|
|||||||
# http://www.gnu.org/copyleft/gpl.html
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
GUISETTINGS="/storage/.xbmc/userdata/guisettings.xml"
|
|
||||||
|
|
||||||
if [ -f "$GUISETTINGS" ] ; then
|
if [ -z "$1" ] ; then
|
||||||
TIMEZONE=`sed -n -e 's/.*<timezone>\(.*\)<\/timezone>.*/\1/p' /storage/.xbmc/userdata/guisettings.xml`
|
# called from systemd. read timezone if set
|
||||||
fi
|
if [ -f /storage/.cache/timezone ] ; then
|
||||||
|
TIMEZONE=`cat /storage/.cache/timezone`
|
||||||
if [ ! "$TIMEZONE" == "" -a -f "/usr/share/zoneinfo/$TIMEZONE" ] ; then
|
else
|
||||||
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /var/run/localtime
|
if [ -f /storage/.xbmc/userdata/guisettings.xml ] ; then
|
||||||
|
TIMEZONE=`sed -n -e 's/.*<timezone>\(.*\)<\/timezone>.*/\1/p' /storage/.xbmc/userdata/guisettings.xml`
|
||||||
|
fi
|
||||||
|
if [ -z "TIMEZONE" ] ; then
|
||||||
|
TIMEZONE="UTC"
|
||||||
|
fi
|
||||||
|
# save it!
|
||||||
|
echo "$TIMEZONE" > /storage/.cache/timezone
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
ln -sf "/usr/share/zoneinfo/UTC" /var/run/localtime
|
# called from xbmc. save the timezone!
|
||||||
|
TIMEZONE="$1"
|
||||||
|
echo "$TIMEZONE" > /storage/.cache/timezone
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /var/run/localtime
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Timezone data monitor
|
|
||||||
After=local-fs.target
|
|
||||||
|
|
||||||
[Path]
|
|
||||||
PathChanged=/storage/.xbmc/userdata/guisettings.xml
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Timezone data monitor
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/bin/systemctl restart tz-data.service
|
|
||||||
StartLimitInterval=0
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
Loading…
x
Reference in New Issue
Block a user