[glick2] Support non-systemd in specfile
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glick2] Support non-systemd in specfile
- Date: Wed, 30 Nov 2011 08:08:54 +0000 (UTC)
commit 2948018bed9ab755979b1c6f93805a311bd3db4a
Author: Alexander Larsson <alexl redhat com>
Date: Tue Nov 29 22:19:30 2011 +0100
Support non-systemd in specfile
glick2.spec | 41 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/glick2.spec b/glick2.spec
index a56cf91..95cf114 100644
--- a/glick2.spec
+++ b/glick2.spec
@@ -1,3 +1,9 @@
+%if 0%{?fedora} < 15 && 0%{?rhel} <= 6
+%define use_binfmt_d 0
+%else
+%define use_binfmt_d 1
+%endif
+
Name: glick2
Version: 0.0.1
Release: 1%{?dist}
@@ -36,6 +42,14 @@ make V=1 %{?_smp_mflags}
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
+# Check for pre-systemd OSes and switch to sysv init for binfmt registration
+%if !%{use_binfmt_d}
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/
+install glick2.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/glick2
+rm -rf $RPM_BUILD_ROOT/%{_sysconfdir}/binfmt.d
+%endif
+
+
%clean
rm -rf %{buildroot}
@@ -47,7 +61,11 @@ rm -rf %{buildroot}
%attr(4755,root,root) %{_bindir}/glick-session
%attr(4755,root,root) %{_libexecdir}/glick-helper
%{_datadir}/mime/packages/glick2.xml
-%config %{_sysconfdir}/binfmt.d/glick2.conf
+%if %{use_binfmt_d}
+%{_sysconfdir}/binfmt.d/glick2.conf
+%else
+%{_sysconfdir}/init.d/glick2
+%endif
%{_sysconfdir}/xdg/autostart/glick.desktop
%dir /opt/bundle
%dir /opt/session
@@ -55,8 +73,29 @@ rm -rf %{buildroot}
%post
/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || :
+%if %{use_binfmt_d}
+/bin/systemctl --system try-restart systemd-binfmt.service &>/dev/null || :
+%else
+/sbin/chkconfig --add glick2
+%endif
+
+%preun
+%if !%{use_binfmt_d}
+if [ $1 -eq 0 ]; then
+ /sbin/service glick2 stop &>/dev/null || :
+ /sbin/chkconfig --del glick2
+fi
+%endif
+
%postun
/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || :
+%if %{use_binfmt_d}
+/bin/systemctl --system try-restart systemd-binfmt.service &>/dev/null || :
+%else
+if [ $1 -ge 1 ]; then
+ /sbin/service glick2 condrestart &>/dev/null || :
+fi
+%endif
%files tools
%{_bindir}/glick-mkbundle
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]