[gpm] Providing native systemd file for upcoming F14 Feature Systemd
Nikola Pajkovsky
npajkovs at fedoraproject.org
Wed Aug 11 14:14:09 UTC 2010
commit d3732f1270c57fe86a316beb2817899a8d893b20
Author: Nikola Pajkovsky <npajkovs at redhat.com>
Date: Wed Aug 11 15:53:51 2010 +0200
Providing native systemd file for upcoming F14 Feature Systemd
Signed-off-by: Nikola Pajkovsky <npajkovs at redhat.com>
gpm.service | 14 ++++++++++++++
gpm.spec | 28 ++++++++++++++++++----------
2 files changed, 32 insertions(+), 10 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..8e73c8a 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: 10%{?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,11 @@ 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
@@ -107,7 +110,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 || :
@@ -117,18 +120,20 @@ fi
%preun
%ifnarch s390 s390x
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
/sbin/install-info %{_infodir}/gpm.info.gz --delete %{_infodir}/dir || :
-fi
-
+f
%postun
%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
@@ -140,7 +145,7 @@ fi
%{_infodir}/*
%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 +165,9 @@ fi
%{_libdir}/libgpm.a
%changelog
+* 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