]> git.pld-linux.org Git - packages/tzdata.git/commitdiff
- rel 2
authorJan Rękorajski <baggins@pld-linux.org>
Fri, 16 Mar 2012 10:55:25 +0000 (10:55 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- systemd support

Changed files:
    timezone.service -> 1.1
    timezone.sh -> 1.1
    tzdata.spec -> 1.115

timezone.service [new file with mode: 0644]
timezone.sh [new file with mode: 0644]
tzdata.spec

diff --git a/timezone.service b/timezone.service
new file mode 100644 (file)
index 0000000..f3ba2c3
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=Set time zone information
+After=syslog.target local-fs.target
+ConditionPathExists=/etc/sysconfig/timezone
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+EnvironmentFile=/etc/sysconfig/timezone
+ExecStart=/lib/systemd/pld-timezone
+
+[Install]
+WantedBy=basic.target
diff --git a/timezone.sh b/timezone.sh
new file mode 100644 (file)
index 0000000..225a486
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+ZONE_FILE="$ZONE_INFO_DIR"
+
+if [ -n "$ZONE_INFO_SCHEME" -a "$ZONE_INFO_SCHEME" != "posix" ]; then
+       ZONE_FILE="$ZONE_FILE/$ZONE_INFO_SCHEME"
+fi
+
+ZONE_FILE="$ZONE_FILE/$TIMEZONE"
+
+[ -L /etc/localtime ] && [ "$(resolvesymlink /etc/localtime)" = "$ZONE_FILE" ] && exit 0
+[ -f "$ZONE_FILE" ] || exit 2
+
+rm -f /etc/localtime
+
+cp -af "$ZONE_FILE" /etc/localtime
+RETVAL=$?
+restorecon /etc/localtime >/dev/null 2>&1
+exit $RETVAL
index 50d7c24f1d2cb45b6a9dae2243183daaf06752b8..34c54579b6b7515583da0b3e20fe84b3340bfdb5 100644 (file)
@@ -36,6 +36,8 @@ Source4:      timezone.sysconfig
 Source5:       javazic.tar.gz
 # Source5-md5: 6a3392cd5f1594d13c12c1a836ac8d91
 Source6:       timezone.upstart
+Source7:       timezone.service
+Source8:       timezone.sh
 Patch1:                javazic-fixup.patch
 Patch2:                install.patch
 URL:           http://www.twinsun.com/tz/tz-link.htm
@@ -154,7 +156,7 @@ cd ..
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_mandir}/man5,%{_includedir}}
+install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_mandir}/man5,%{_includedir},%{systemdunitdir}}
 %{__make} install
 
 %if %{with tests}
@@ -185,6 +187,9 @@ cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
 install -d $RPM_BUILD_ROOT/etc/init
 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/init/timezone.conf
 
+install -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdunitdir}/timezone.service
+install -p %{SOURCE8} $RPM_BUILD_ROOT/lib/systemd/pld-timezone
+
 %if %{with java}
 cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
 %endif
@@ -195,6 +200,7 @@ rm -rf $RPM_BUILD_ROOT
 %post
 /sbin/chkconfig --add timezone
 %service timezone restart
+%systemd_post timezone.service
 
 %preun
 if [ "$1" = "0" ]; then
@@ -203,6 +209,7 @@ if [ "$1" = "0" ]; then
        # save for postun
        cp -f /etc/localtime /etc/localtime.rpmsave
 fi
+%systemd_preun timezone.service
 
 %postun
 if [ "$1" = "0" ]; then
@@ -210,6 +217,7 @@ if [ "$1" = "0" ]; then
                mv -f /etc/localtime{.rpmsave,}
        fi
 fi
+%systemd_reload
 
 %triggerpostun -- rc-scripts < 0.4.1.4
 /sbin/chkconfig --add timezone
@@ -229,6 +237,9 @@ if ! grep -q '^TIMEZONE=' /etc/sysconfig/timezone; then
        %service timezone restart
 fi
 
+%triggerpostun -- tzdata < 2012a-2
+%systemd_trigger timezone.service
+
 %files
 %defattr(644,root,root,755)
 %doc tzcode/README tzcode/Theory tzcode/tz-link.html
@@ -236,6 +247,8 @@ fi
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/timezone
 %attr(754,root,root) /etc/rc.d/init.d/timezone
 %config(noreplace) %verify(not md5 mtime size) /etc/init/timezone.conf
+%{systemdunitdir}/timezone.service
+%attr(755,root,root) /lib/systemd/pld-timezone
 
 %{_datadir}/zoneinfo
 %exclude %{_datadir}/zoneinfo/right
This page took 0.038621 seconds and 4 git commands to generate.