[gkrellm] Migrate daemon to systemd (#661656). Do icon dir timestamp update in %post with lua.

Ville Skyttä scop at fedoraproject.org
Fri Jul 29 20:40:31 UTC 2011


commit c7ec836d254b70e3339dfefc31d874208f7f6fed
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Jul 29 23:39:51 2011 +0300

    Migrate daemon to systemd (#661656).
    Do icon dir timestamp update in %post with lua.

 ...1.28-config.patch => gkrellm-2.3.5-config.patch |   18 +----
 gkrellm.spec                                       |   57 +++++++++------
 gkrellmd.init                                      |   76 --------------------
 gkrellmd.service                                   |    9 +++
 4 files changed, 46 insertions(+), 114 deletions(-)
---
diff --git a/gkrellm-2.1.28-config.patch b/gkrellm-2.3.5-config.patch
similarity index 73%
rename from gkrellm-2.1.28-config.patch
rename to gkrellm-2.3.5-config.patch
index b774d5d..c623059 100644
--- a/gkrellm-2.1.28-config.patch
+++ b/gkrellm-2.3.5-config.patch
@@ -1,7 +1,7 @@
 diff -up gkrellm-2.3.5/server/gkrellmd.conf.config gkrellm-2.3.5/server/gkrellmd.conf
---- gkrellm-2.3.5/server/gkrellmd.conf.config	2010-09-14 16:26:19.000000000 +0200
-+++ gkrellm-2.3.5/server/gkrellmd.conf	2010-10-10 09:08:05.110736001 +0200
-@@ -22,26 +22,27 @@
+--- gkrellm-2.3.5/server/gkrellmd.conf.config	2010-09-14 17:26:19.000000000 +0300
++++ gkrellm-2.3.5/server/gkrellmd.conf	2011-06-19 19:17:56.398591498 +0300
+@@ -22,16 +22,17 @@
  # List of hosts allowed to connect.  If no hosts are specified in a
  # gkrellmd.conf file or on the command line, all hosts will be allowed.
  #
@@ -23,18 +23,6 @@ diff -up gkrellm-2.3.5/server/gkrellmd.conf.config gkrellm-2.3.5/server/gkrellmd
  
  # Create a PID file for the running gkrellmd.  Default is no PID file.
  # NOTE: Option ignored on Windows
- #
--#pidfile /var/run/gkrellmd.pid
-+pidfile /var/run/gkrellmd.pid
- 
- # Run in background and detach from the controlling terminal
- # NOTE: Option ignored on Windows
- #
--#detach
-+detach
- 
- # Enable writing logging message to the system syslog file
- # NOTE: On windows this enables logging to the windows event log
 @@ -76,7 +77,7 @@
  # Minimum is 2 (less than 2 for no I/O disconnecting and is the default).
  # Requires at least 2.1.8 versions of both gkrellmd and gkrellm.
diff --git a/gkrellm.spec b/gkrellm.spec
index 8f43737..4f8eaf6 100644
--- a/gkrellm.spec
+++ b/gkrellm.spec
@@ -1,19 +1,21 @@
 Name:           gkrellm
 Version:        2.3.5
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Multiple stacked system monitors in one process
 Group:          Applications/System
 License:        GPLv3+
 URL:            http://www.gkrellm.net/
 Source0:        http://members.dslextreme.com/users/billw/gkrellm/%{name}-%{version}.tar.bz2
-Source1:        gkrellmd.init
+Source1:        gkrellmd.service
 Source2:        gkrellm.desktop
 Source3:        gkrellm.png
-Patch1:         gkrellm-2.1.28-config.patch
+# The next time gkrellmd.conf changes after 2.3.5-5, remember to set it
+# config(noreplace) again.
+Patch1:         gkrellm-2.3.5-config.patch
 Patch2:         gkrellm-2.2.4-sansfont.patch
 Patch3:         gkrellm-2.2.7-width.patch
 BuildRequires:  gtk2-devel openssl-devel libSM-devel desktop-file-utils gettext
-BuildRequires:  lm_sensors-devel libntlm-devel
+BuildRequires:  lm_sensors-devel libntlm-devel systemd-units
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 %description
@@ -33,11 +35,10 @@ Additional features are:
 %package daemon
 Summary:        The GNU Krell Monitors Server
 Group:          System Environment/Daemons
-Requires(pre):  shadow-utils
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig
-Requires(preun): /sbin/service
-Requires(postun): /sbin/service
+Requires(pre):  shadow-utils systemd-sysv chkconfig
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description daemon
 gkrellmd listens for connections from gkrellm clients. When a gkrellm
@@ -74,7 +75,6 @@ make %{?_smp_mflags} INSTALLROOT=%{_prefix} PKGCONFIGDIR=%{_libdir}/pkgconfig \
 
 %install
 rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT%{_initrddir}
 mkdir -p $RPM_BUILD_ROOT%{_datadir}/gkrellm2/themes
 mkdir -p $RPM_BUILD_ROOT%{_libdir}/gkrellm2/plugins
 
@@ -86,8 +86,9 @@ make install \
     PKGCONFIGDIR=$RPM_BUILD_ROOT%{_libdir}/pkgconfig \
     INCLUDEDIR=$RPM_BUILD_ROOT%{_includedir} \
     STRIP=""
-install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/gkrellmd
-install -m 644 server/gkrellmd.conf $RPM_BUILD_ROOT%{_sysconfdir}/gkrellmd.conf
+install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/gkrellmd.service
+install -Dpm 644 server/gkrellmd.conf \
+    $RPM_BUILD_ROOT%{_sysconfdir}/gkrellmd.conf
 %find_lang %name
 
 # below is the desktop file and icon stuff.
@@ -100,8 +101,8 @@ install -p -m 644 %{SOURCE3} \
   $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps
 
 
-%post
-touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
+%post -p <lua>
+posix.utime("%{_datadir}/icons/hicolor")
 
 %postun
 if [ $1 -eq 0 ] ; then
@@ -116,21 +117,25 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 getent group gkrellmd >/dev/null || groupadd -r gkrellmd
 getent passwd gkrellmd >/dev/null || \
 useradd -r -g gkrellmd -M -d / -s /sbin/nologin -c "GNU Krell daemon" gkrellmd
+if [ $1 -gt 1 ] && [ ! -e %{_unitdir}/gkrellmd.service ] && \
+   [ -e %{_initddir}/gkrellmd ] ; then
+    systemd-sysv-convert --save gkrellmd &>/dev/null
+    chkconfig --del gkrellmd &>/dev/null
+fi
 :
 
 %post daemon
-/sbin/chkconfig --add gkrellmd || :
+systemctl daemon-reload &>/dev/null || :
 
 %preun daemon
-if [ "$1" = "0" ]; then
-    /sbin/service gkrellmd stop > /dev/null 2>&1 || :
-    /sbin/chkconfig --del gkrellmd || :
+if [ $1 -eq 0 ] ; then
+    systemctl --no-reload disable gkrellmd.service &>/dev/null
+    systemctl stop gkrellmd.service &>/dev/null || :
 fi
 
 %postun daemon
-if [ "$1" -ge "1" ]; then
-    /sbin/service gkrellmd condrestart > /dev/null 2>&1 || :
-fi
+systemctl daemon-reload &>/dev/null
+[ $1 -gt 0 ] && systemctl try-restart gkrellmd.service &>/dev/null || :
 
 
 %clean
@@ -156,13 +161,19 @@ rm -rf $RPM_BUILD_ROOT
 %files daemon
 %defattr(-,root,root,-)
 %doc COPYRIGHT
-%{_initrddir}/gkrellmd
+%{_unitdir}/gkrellmd.service
 %{_sbindir}/gkrellmd
 %{_mandir}/man1/gkrellmd.*
-%config(noreplace) %{_sysconfdir}/gkrellmd.conf
+# Temporarily not noreplace so systemd related changes take effect.
+# See comments next to the config PatchX: above.
+%config %{_sysconfdir}/gkrellmd.conf
 
 
 %changelog
+* Mon Jun 20 2011 Ville Skyttä <ville.skytta at iki.fi> - 2.3.5-5
+- Migrate daemon to systemd (#661656).
+- Do icon dir timestamp update in %%post with lua.
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.3.5-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 
diff --git a/gkrellmd.service b/gkrellmd.service
new file mode 100644
index 0000000..469e010
--- /dev/null
+++ b/gkrellmd.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=GNU Krell Monitors server
+After=network.target syslog.target hddtemp.service
+
+[Service]
+ExecStart=/usr/sbin/gkrellmd
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list