From a53b3b8ab7c26ae533a32caff0103e05e9011435 Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Fri, 7 Oct 2016 13:17:01 -0500 Subject: [PATCH] cleanup conditionals, use upstream unit file --- znc.spec | 59 ++++---------------------------------------------------- 1 file changed, 4 insertions(+), 55 deletions(-) diff --git a/znc.spec b/znc.spec index 081eb50..1953e46 100644 --- a/znc.spec +++ b/znc.spec @@ -2,18 +2,14 @@ %global _hardened_build 1 # Define variables to use in conditionals -%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 -%global use_systemd 1 -%endif # 0%{?fedora} >= 15 || 0%{?rhel} >= 7 - %if 0%{?fedora} || 0%{?rhel} >= 6 %global with_modperl 1 %endif # 0%{?fedora} || 0%{?rhel} >= 6 -%if 0%{?fedora} >= 13 || 0%{?rhel} >= 8 +%if 0%{?fedora} || 0%{?rhel} >= 8 %global __python %{__python3} %global with_modpython 1 -%endif # 0%{?fedora} >= 13 || 0%{?rhel} >= 8 +%endif # 0%{?fedora} || 0%{?rhel} >= 8 Name: znc Version: 1.6.3 @@ -25,16 +21,6 @@ License: ASL 2.0 URL: http://znc.in Source0: %{url}/releases/%{name}-%{version}.tar.gz -%if 0%{?use_systemd} -Source1: znc.service -%else # 0%{?use_systemd} -Source1: znc.init -%endif # 0%{?use_systemd} - -%if 0%{?rhel} && 0%{?rhel} <= 5 -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -%endif # 0%{?rhel} && 0%{?rhel} <= 5 - BuildRequires: automake BuildRequires: c-ares-devel BuildRequires: cyrus-sasl-devel @@ -47,28 +33,18 @@ BuildRequires: perl(ExtUtils::Embed) Obsoletes: znc-extra <= %{version}-%{release} %endif # (0%{?fedora} && 0%{?fedora} <= 24) || (0%{?rhel} && 0%{?rhel} <= 9) -%if 0%{?use_systemd} BuildRequires: systemd-units -%endif Requires(pre): shadow-utils -%if 0%{?use_systemd} Requires(post): systemd-units Requires(post): systemd-sysv Requires(preun): systemd-units Requires(postun): systemd-units -%else # 0%{?use_systemd} -Requires(post): chkconfig -Requires(preun): chkconfig -# This is for /sbin/service -Requires(preun): initscripts -%endif # 0%{?use_systemd} %description ZNC is an IRC bouncer with many advanced features like detaching, multiple users, per channel playback buffer, SSL, IPv6, transparent DCC bouncing, Perl and C++ module support to name a few. - %package devel Summary: Development files needed to compile ZNC modules Group: Development/Libraries @@ -80,7 +56,6 @@ BuildRequires: pkgconfig All includes and program files you need to compile your own znc modules. - %package modtcl Summary: TCL module for ZNC Group: Development/Libraries @@ -136,6 +111,7 @@ chmod -x modules/q.cpp %build %configure \ --with-module-prefix=%{_libdir}/znc \ + --with-systemdsystemunitdir=%{_unitdir} \ %if 0%{?with_modperl} --enable-perl \ %else @@ -155,13 +131,8 @@ chmod -x modules/q.cpp %__rm -Rf "%{buildroot}" %endif # 0%{?rhel} && 0%{?rhel} <= 5 %__make install DESTDIR="%{buildroot}" -%if 0%{?use_systemd} mkdir -p %buildroot%{_unitdir} -install -m 0644 %{SOURCE1} %buildroot%{_unitdir}/znc.service -%else # 0%{?use_systemd} -mkdir -p %buildroot%{_initrddir} -install -Dp -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/znc -%endif # 0%{?use_systemd} +#install -m 0644 %{SOURCE1} %buildroot%{_unitdir}/znc.service %if 0%{?rhel} && 0%{?rhel} <= 5 @@ -180,33 +151,15 @@ chown znc:znc /var/lib/znc %post -%if 0%{?use_systemd} %systemd_post znc.service -%else # 0%{?use_systemd} -# This adds the proper /etc/rc*.d links for the script -/sbin/chkconfig --add znc -%endif # 0%{?use_systemd} %postun -%if 0%{?use_systemd} %systemd_postun_with_restart znc.service -%else # 0%{?use_systemd} -if [ "$1" -ge "1" ] ; then - /sbin/service znc condrestart >/dev/null 2>&1 || : -fi -%endif # 0%{?use_systemd} %preun -%if 0%{?use_systemd} %systemd_preun znc.service -%else # 0%{?use_systemd} -if [ $1 -eq 0 ] ; then - /sbin/service znc stop >/dev/null 2>&1 || : - /sbin/chkconfig --del znc || : -fi -%endif # 0%{?use_systemd} %files @@ -267,11 +220,7 @@ fi %{_libdir}/znc/watch.so %{_libdir}/znc/webadmin.so %{_datadir}/znc/ -%if 0%{?use_systemd} %{_unitdir}/znc.service -%else # 0%{?use_systemd} -%{_initrddir}/znc -%endif # 0%{?use_systemd} %files devel %{_bindir}/znc-buildmod