[packages/lightdm] add -init package with rc-scripts init; merge -upstart package there as well

glen glen at pld-linux.org
Sun Mar 2 11:14:37 CET 2014


commit aeb930bc178846971569817280c271ffb94e26bb
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Mar 2 09:38:49 2014 +0000

    add -init package with rc-scripts init; merge -upstart package there as well

 lightdm.init | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lightdm.spec | 65 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 123 insertions(+), 21 deletions(-)
---
diff --git a/lightdm.spec b/lightdm.spec
index b74116b..e2b4b5f 100644
--- a/lightdm.spec
+++ b/lightdm.spec
@@ -2,7 +2,7 @@ Summary:	A lightweight display manager
 Summary(hu.UTF-8):	Egy könnyűsúlyú bejelentkezéskezelő
 Name:		lightdm
 Version:	1.7.12
-Release:	5
+Release:	6
 # library/bindings are LGPLv2 or LGPLv3, the rest GPLv3+
 License:	(LGPLv2 or LGPLv3) and GPLv3+
 Group:		X11/Applications
@@ -11,9 +11,10 @@ Source0:	https://launchpad.net/lightdm/1.7/%{version}/+download/%{name}-%{versio
 Source1:	%{name}.pamd
 Source2:	%{name}-autologin.pamd
 Source3:	%{name}-greeter.pamd
+Source4:	%{name}.init
 Patch0:		config.patch
 Patch1:		upstart-path.patch
-Patch2:		lightdm-nodaemon_option.patch
+Patch2:		%{name}-nodaemon_option.patch
 URL:		http://www.freedesktop.org/wiki/Software/LightDM
 BuildRequires:	QtCore-devel
 BuildRequires:	QtDBus-devel
@@ -39,7 +40,7 @@ BuildRequires:	perl-XML-Parser
 BuildRequires:	perl-base
 BuildRequires:	pkgconfig
 BuildRequires:	qt4-build
-BuildRequires:	rpmbuild(macros) >= 1.583
+BuildRequires:	rpmbuild(macros) >= 1.689
 BuildRequires:	tar >= 1:1.22
 BuildRequires:	vala
 BuildRequires:	xz
@@ -113,18 +114,23 @@ Group:		Documentation
 %description apidocs
 lightdm API documentation.
 
-%package upstart
-Summary:	Upstart job for lightdm
-Summary(hu.UTF-8):	Upstart támogatás lightdm-hez
-Group:		Daemons
-Requires:	%{name} = %{epoch}:%{version}-%{release}
-Requires:	upstart >= 0.6
+%package init
+Summary:	Init script for Lightdm
+Summary(pl.UTF-8):	Skrypt init dla Lightdm-a
+Group:		X11/Applications
+Requires(post,preun):	/sbin/chkconfig
+Requires(post,postun):	systemd-units >= 38
+Requires:	%{name} = %{version}-%{release}
+Requires:	rc-scripts >= 0.4.3.0
+Requires:	systemd-units >= 38
+Obsoletes:	lightdm-upstart < 1.7.12-6
+Conflicts:	upstart < 0.6
 
-%description upstart
-Upstart job for lightdm.
+%description init
+Init script for Lightdm.
 
-%description upstart -l hu.UTF-8
-Upstart támogatás lightdm-hez.
+%description init -l pl.UTF-8
+Skrypt init dla Lightdm-a.
 
 %prep
 %setup -q
@@ -155,20 +161,25 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-install -d $RPM_BUILD_ROOT/etc/{pam.d,security,init,dbus-1/system.d} \
+install -d $RPM_BUILD_ROOT/etc/{pam.d,security,init,rc.d/init.d,dbus-1/system.d} \
 	$RPM_BUILD_ROOT/home/services/xdm \
 	$RPM_BUILD_ROOT%{_datadir}/xgreeters \
 	$RPM_BUILD_ROOT%{_datadir}/lightdm/remote-sessions \
+	$RPM_BUILD_ROOT%{systemdunitdir} \
 	$RPM_BUILD_ROOT/var/{log,cache}/lightdm
 
+# initscripts
+cp -p data/init/%{name}.conf $RPM_BUILD_ROOT/etc/init
+install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/lightdm
+ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/lxdm.service
+
 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/pam.d/lightdm
 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/pam.d/lightdm-autologin
 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/lightdm-greeter
 touch $RPM_BUILD_ROOT/etc/security/blacklist.lightdm
-cp -p data/init/%{name}.conf $RPM_BUILD_ROOT/etc/init
 
 # We don't ship AppAmor
-rm -rv $RPM_BUILD_ROOT%{_sysconfdir}/apparmor.d
+rm -rv $RPM_BUILD_ROOT/etc/apparmor.d
 
 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/{lb,wae}
 
@@ -193,11 +204,21 @@ fi
 %post	libs-qt -p /sbin/ldconfig
 %postun	libs-qt -p /sbin/ldconfig
 
-%post upstart
-%upstart_post lightdm
+%post init
+/sbin/chkconfig --add %{name}
+%service -n %{name} restart
+%upstart_post %{name}
+%systemd_reload
+
+%preun
+if [ "$1" = "0" ]; then
+	/sbin/chkconfig --del %{name}
+	%service %{name} stop
+fi
 
-%postun upstart
-%upstart_postun lightdm
+%postun init
+%systemd_reload
+%upstart_postun %{name}
 
 %files -f %{name}.lang
 %defattr(644,root,root,755)
@@ -257,6 +278,8 @@ fi
 %defattr(644,root,root,755)
 %{_gtkdocdir}/lightdm-gobject-1
 
-%files upstart
+%files init
 %defattr(644,root,root,755)
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
 %config(noreplace) %verify(not md5 mtime size) /etc/init/%{name}.conf
+%{systemdunitdir}/lxdm.service
diff --git a/lightdm.init b/lightdm.init
new file mode 100755
index 0000000..fcde977
--- /dev/null
+++ b/lightdm.init
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# lightdm:		Starts the Lightdm Display Manager
+# chkconfig:	5 95 05
+#
+# description:	Starts and stops the Lightdm Display Manager at startup and \
+#		shutdown..
+# hide:		true
+#
+# Source function library
+. /etc/rc.d/init.d/functions
+
+upstart_controlled
+
+start() {
+	# Check if the service is already running?
+	if [ -f /var/lock/subsys/lightdm ]; then
+		msg_already_running "Lightdm Display Manager"
+		return
+	fi
+
+	msg_starting "Lightdm Display Manager"
+	daemon /usr/sbin/lightdm
+	ok
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/lightdm
+}
+
+stop() {
+	if [ ! -f /var/lock/subsys/lightdm ]; then
+		msg_not_running "Lightdm Display Manager"
+		return
+	fi
+
+	# Stop daemons.
+	msg_stopping "Lightdm Display Manager"
+	killproc lightdm
+	rm -f /var/lock/subsys/lightdm
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/lightdm ]; then
+		msg_not_running "Lightdm Display Manager"
+		RETVAL=$1
+		return
+	fi
+
+	stop
+	start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status lightdm
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lightdm.git/commitdiff/7b654e9839d96780f17ddddb7b6fc548859a7401



More information about the pld-cvs-commit mailing list