[gpm/f14/master] add systemd unit

Nikola Pajkovsky npajkovs at fedoraproject.org
Thu Aug 19 09:53:38 UTC 2010


commit 0654e7196d6ae64d59ed66c0fe84b71b6c34bbc3
Author: Nikola Pajkovsky <npajkovs at redhat.com>
Date:   Thu Aug 19 11:35:33 2010 +0200

    add systemd unit
    
    Signed-off-by: Nikola Pajkovsky <npajkovs at redhat.com>

 gpm.service |   14 ++++++++++++++
 gpm.spec    |   23 +++++++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/gpm.service b/gpm.service
new file mode 100644
index 0000000..7e33327
--- /dev/null
+++ b/gpm.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Console Mouse manager
+After=syslog.target
+
+# This could probably benefit from socket activation, but honestly I think it
+# is time for gpm to go away, and hence I am not planning to spend the time
+# to add socket activation here.
+
+[Service]
+ExecStart=/usr/sbin/gpm -m /dev/input/mice -t exps2 -D
+StandardOutput=syslog
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gpm.spec b/gpm.spec
index 8146c67..8e0c6df 100644
--- a/gpm.spec
+++ b/gpm.spec
@@ -1,13 +1,14 @@
 Summary: A mouse server for the Linux console
 Name: gpm
 Version: 1.20.6
-Release: 9%{?dist}
+Release: 11%{?dist}
 License: GPLv2+
 Group: System Environment/Daemons
 URL: http://unix.schottelius.org/gpm/
 Source: http://unix.schottelius.org/gpm/archives/%{name}-%{version}.tar.lzma
 Source1: gpm.init
 Source2: inputattach.c
+Source3: gpm.service
 Patch1: gpm-1.20.6-multilib.patch
 Patch2: gpm-1.20.1-lib-silent.patch
 Patch3: gpm-1.20.3-gcc4.3.patch
@@ -18,6 +19,7 @@ Patch6: gpm-1.20.6-libtool.patch
 Requires(post): /sbin/chkconfig /sbin/install-info /sbin/ldconfig
 Requires(preun): /sbin/chkconfig /sbin/install-info
 Requires(postun): /sbin/ldconfig
+Requires: systemd-units
 # this defines the library version that this package builds.
 %define LIBVER 2.1.0
 BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
@@ -90,10 +92,13 @@ ln -sf libgpm.so.%{LIBVER} %{buildroot}/%{_libdir}/libgpm.so
 
 
 %ifnarch s390 s390x
-mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d  
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d
+mkdir -p %{buildroot}/lib/systemd/system/
 install -m 755 inputattach %{buildroot}%{_sbindir}
 install -m 644 conf/gpm-* %{buildroot}%{_sysconfdir}
 install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/rc.d/init.d/gpm
+install -m 644 %{SOURCE3} %{buildroot}/lib/systemd/system/
+
 %else
 # we're shipping only libraries in s390[x], so
 # remove stuff from the buildroot that we aren't shipping
@@ -108,6 +113,7 @@ rm -rf %{buildroot}
 %post
 %ifnarch s390 s390x
 /sbin/chkconfig --add gpm
+/bin/systemctl enable gpm.service >/dev/null 2>&1 || :
 %endif
 if [ -e %{_infodir}/gpm.info.gz ]; then
   /sbin/install-info %{_infodir}/gpm.info.gz %{_infodir}/dir || :
@@ -119,6 +125,8 @@ fi
 if [ $1 = 0 ]; then
     /sbin/service gpm stop >/dev/null 2>&1
     /sbin/chkconfig --del gpm
+    /bin/systemctl disable gpm.service >/dev/null 2>&1 || :
+    /bin/systemctl stop gpm.service >/dev/null 2>&1 || :
 fi
 %endif
 if [ $1 = 0 -a -e %{_infodir}/gpm.info.gz ]; then
@@ -129,6 +137,10 @@ fi
 %ifnarch s390 s390x
 if [ $1 -ge 1 ]; then
     /sbin/service gpm condrestart >/dev/null 2>&1
+    # On upgrade, reload init system configuration if we changed unit files
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+    # On upgrade, restart the daemon
+    /bin/systemctl try-restart gpm.service >/dev/null 2>&1 || :
 fi
 %endif
 /sbin/ldconfig
@@ -141,6 +153,7 @@ fi
 %ifnarch s390 s390x
 %config(noreplace) %{_sysconfdir}/gpm-*
 %attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/gpm
+/lib/systemd/system/gpm.service
 %{_sbindir}/*
 %{_bindir}/*
 %{_mandir}/man?/*
@@ -160,6 +173,12 @@ fi
 %{_libdir}/libgpm.a
 
 %changelog
+* Thu Aug 19 2010 Nikola Pajkovsky <npajkovs at redhat.com> 1.20.6-11
+- Resolved: #617327, #622665, #624253
+
+* Wed Aug 11 2010 Nikola Pajkovsky <npajkovs at redhat.com> 1.20.6-10
+- Providing native systemd file for upcoming F14 Feature Systemd
+
 * Thu Dec 10 2009 Nikola Pajkovsky <npajkovs at redhat.com> 1.20.6-9
 - add try-restart into gpm.init to be more LSB-compilant
 


More information about the scm-commits mailing list