commit 18b31da413bf424fd5ce4ca1acc04cee0af9dd06
Author: Elan Ruusamäe <g...@pld-linux.org>
Date:   Tue Aug 8 18:19:33 2017 +0300

    replace dbus activation with initscript
    
    https://github.com/elogind/elogind/issues/25

 elogind-service.patch |  15 --------
 elogind.init          | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++
 elogind.spec          |  22 +++++++++--
 3 files changed, 119 insertions(+), 19 deletions(-)
---
diff --git a/elogind.spec b/elogind.spec
index 09e69ef..3007fdd 100644
--- a/elogind.spec
+++ b/elogind.spec
@@ -2,13 +2,13 @@ Summary:      Elogind User, Seat and Session Manager
 Summary(pl.UTF-8):     Elogind - zarządca użytkowników, stanowisk i sesji
 Name:          elogind
 Version:       234.2
-Release:       1
+Release:       1.1
 License:       LGPL v2.1+
 Group:         Daemons
 # Source0Download: https://github.com/elogind/elogind/releases
 Source0:       
https://github.com/elogind/elogind/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5: d3c52e4af85dddeb3d323a18c341164f
-Patch0:                %{name}-service.patch
+Source1:       %{name}.init
 URL:           https://github.com/elogind/elogind
 BuildRequires: acl-devel
 BuildRequires: autoconf >= 2.64
@@ -35,9 +35,11 @@ BuildRequires:       pam-devel >= 1:1.1.2
 BuildRequires: pkgconfig
 BuildRequires: rpmbuild(macros) >= 1.719
 BuildRequires: udev-devel
+Requires(post,preun):  /sbin/chkconfig
 Requires:      %{name}-libs = %{version}-%{release}
 Requires:      dbus >= 1.4.0
 Requires:      pam >= 1:1.3.0-3
+Requires:      rc-scripts
 Requires:      udev-core >= 1:185
 Conflicts:     systemd
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -121,7 +123,6 @@ Pliki nagłówkowe biblioteki elogind.
 
 %prep
 %setup -q
-%patch0 -p1
 
 %build
 #install -d docs
@@ -145,10 +146,12 @@ Pliki nagłówkowe biblioteki elogind.
 
 %install
 rm -rf $RPM_BUILD_ROOT
-
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libelogind.la \
        $RPM_BUILD_ROOT/%{_lib}/security/*.la
 
@@ -172,6 +175,16 @@ rm -rf $RPM_BUILD_ROOT
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+/sbin/chkconfig --add %{name}
+%service %{name} restart
+
+%preun
+if [ "$1" = "0" ]; then
+       %service -q %{name} stop
+       /sbin/chkconfig --del %{name}
+fi
+
 %post  libs -p /sbin/ldconfig
 %postun        libs -p /sbin/ldconfig
 
@@ -184,6 +197,7 @@ rm -rf $RPM_BUILD_ROOT
 /lib/udev/rules.d/70-uaccess.rules
 /lib/udev/rules.d/71-seat.rules
 /lib/udev/rules.d/73-seat-late.rules
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(755,root,root) /%{_lib}/security/pam_elogind.so
 %attr(755,root,root) %{_bindir}/loginctl
 %attr(755,root,root) %{_bindir}/elogind-inhibit
diff --git a/elogind-service.patch b/elogind-service.patch
deleted file mode 100644
index 8f5e2a2..0000000
--- a/elogind-service.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-
-start the daemon via dbus activation
-
-https://github.com/elogind/elogind/issues/25
-
---- elogind-234.2/src/login/org.freedesktop.login1.service~    2017-07-28 
10:38:57.000000000 +0300
-+++ elogind-234.2/src/login/org.freedesktop.login1.service     2017-08-06 
10:31:26.815479309 +0300
-@@ -7,6 +7,6 @@
- 
- [D-BUS Service]
- Name=org.freedesktop.login1
--Exec=/bin/false
-+Exec=@elogind@
- User=root
- SystemdService=dbus-org.freedesktop.login1.service
diff --git a/elogind.init b/elogind.init
new file mode 100755
index 0000000..25ccbfb
--- /dev/null
+++ b/elogind.init
@@ -0,0 +1,101 @@
+#!/bin/sh
+#
+# elogind      elogind short service description
+#
+# chkconfig:   345 10 90
+#
+# description: elogind long service description
+#
+# processname: elogind
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; 
then
+               msg_network_down "elogind"
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/elogind ] && . /etc/sysconfig/elogind
+
+pidfile="/var/run/elogind.pid"
+
+start() {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/elogind ]; then
+               msg_already_running "elogind"
+               return
+       fi
+
+       msg_starting "elogind"
+       daemon /usr/lib64/elogind/elogind
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/elogind
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/elogind ]; then
+               msg_not_running "elogind"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "elogind"
+       killproc --pidfile $pidfile elogind -TERM
+
+       rm -f /var/lock/subsys/elogind
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/elogind ]; then
+               msg_not_running "elogind"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
+restart() {
+       stop
+       start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       restart
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
+  status)
+       status --pidfile $pidfile elogind
+       RETVAL=$?
+       ;;
+  *)
+       msg_usage "$0 
{start|stop|restart|try-restart|reload|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/elogind.git/commitdiff/a2d9de2c224daa81ed903530c1a9b7551d6ca11a

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to