timezone-data: add systemd support

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-08-12 13:26:42 +02:00
parent 3727ab75ac
commit 6bc7e8dbac
5 changed files with 49 additions and 12 deletions

View File

@ -53,4 +53,12 @@ post_makeinstall_target() {
mkdir -p $INSTALL/etc
ln -sf /var/run/localtime $INSTALL/etc/localtime
mkdir -p $INSTALL/usr/lib/openelec
cp -PR $PKG_DIR/scripts/tzdata-setup $INSTALL/usr/lib/openelec
}
post_install() {
enable_service tz-data-monitor.path
enable_service tz-data.service
}

View File

@ -1,3 +1,4 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
@ -18,17 +19,14 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
#
# make variable directory structure
#
# runlevels: openelec, textmode
progress "setting timezone"
GUISETTINGS="/storage/.xbmc/userdata/guisettings.xml"
if [ -f "$GUISETTINGS" ] ; then
TIMEZONE=`sed -n -e 's/.*<timezone>\(.*\)<\/timezone>.*/\1/p' /storage/.xbmc/userdata/guisettings.xml`
fi
if [ ! "$TIMEZONE" == "" -a -f "/usr/share/zoneinfo/$TIMEZONE" ] ; then
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /var/run/localtime
fi
GUISETTINGS="/storage/.xbmc/userdata/guisettings.xml"
if [ -f "$GUISETTINGS" ] ; then
TIMEZONE=`sed -n -e 's/.*<timezone>\(.*\)<\/timezone>.*/\1/p' /storage/.xbmc/userdata/guisettings.xml`
fi
if [ ! "$TIMEZONE" == "" -a -f "/usr/share/zoneinfo/$TIMEZONE" ] ; then
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /var/run/localtime
fi

View File

@ -0,0 +1,9 @@
[Unit]
Description=Timezone data monitor
After=local-fs.target
[Path]
PathModified=/storage/.xbmc/userdata/guisettings.xml
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,9 @@
[Unit]
Description=Timezone data monitor
[Service]
Type=oneshot
ExecStart=/bin/systemctl restart tz-data.service
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=Setup Timezone data
Before=xbmc.service
ConditionPathExists=/storage/.xbmc/userdata/guisettings.xml
[Service]
Type=oneshot
ExecStart=/usr/lib/openelec/tzdata-setup
RemainAfterExit=yes
[Install]
WantedBy=xbmc.service