cleanup conditionals, use upstream unit file

This commit is contained in:
Nick Bebout 2016-10-07 13:17:01 -05:00
parent 42b83a035c
commit a53b3b8ab7
1 changed files with 4 additions and 55 deletions

View File

@ -2,18 +2,14 @@
%global _hardened_build 1 %global _hardened_build 1
# Define variables to use in conditionals # 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 %if 0%{?fedora} || 0%{?rhel} >= 6
%global with_modperl 1 %global with_modperl 1
%endif # 0%{?fedora} || 0%{?rhel} >= 6 %endif # 0%{?fedora} || 0%{?rhel} >= 6
%if 0%{?fedora} >= 13 || 0%{?rhel} >= 8 %if 0%{?fedora} || 0%{?rhel} >= 8
%global __python %{__python3} %global __python %{__python3}
%global with_modpython 1 %global with_modpython 1
%endif # 0%{?fedora} >= 13 || 0%{?rhel} >= 8 %endif # 0%{?fedora} || 0%{?rhel} >= 8
Name: znc Name: znc
Version: 1.6.3 Version: 1.6.3
@ -25,16 +21,6 @@ License: ASL 2.0
URL: http://znc.in URL: http://znc.in
Source0: %{url}/releases/%{name}-%{version}.tar.gz 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: automake
BuildRequires: c-ares-devel BuildRequires: c-ares-devel
BuildRequires: cyrus-sasl-devel BuildRequires: cyrus-sasl-devel
@ -47,28 +33,18 @@ BuildRequires: perl(ExtUtils::Embed)
Obsoletes: znc-extra <= %{version}-%{release} Obsoletes: znc-extra <= %{version}-%{release}
%endif # (0%{?fedora} && 0%{?fedora} <= 24) || (0%{?rhel} && 0%{?rhel} <= 9) %endif # (0%{?fedora} && 0%{?fedora} <= 24) || (0%{?rhel} && 0%{?rhel} <= 9)
%if 0%{?use_systemd}
BuildRequires: systemd-units BuildRequires: systemd-units
%endif
Requires(pre): shadow-utils Requires(pre): shadow-utils
%if 0%{?use_systemd}
Requires(post): systemd-units Requires(post): systemd-units
Requires(post): systemd-sysv Requires(post): systemd-sysv
Requires(preun): systemd-units Requires(preun): systemd-units
Requires(postun): 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 %description
ZNC is an IRC bouncer with many advanced features like detaching, ZNC is an IRC bouncer with many advanced features like detaching,
multiple users, per channel playback buffer, SSL, IPv6, transparent multiple users, per channel playback buffer, SSL, IPv6, transparent
DCC bouncing, Perl and C++ module support to name a few. DCC bouncing, Perl and C++ module support to name a few.
%package devel %package devel
Summary: Development files needed to compile ZNC modules Summary: Development files needed to compile ZNC modules
Group: Development/Libraries Group: Development/Libraries
@ -80,7 +56,6 @@ BuildRequires: pkgconfig
All includes and program files you need to compile your own znc All includes and program files you need to compile your own znc
modules. modules.
%package modtcl %package modtcl
Summary: TCL module for ZNC Summary: TCL module for ZNC
Group: Development/Libraries Group: Development/Libraries
@ -136,6 +111,7 @@ chmod -x modules/q.cpp
%build %build
%configure \ %configure \
--with-module-prefix=%{_libdir}/znc \ --with-module-prefix=%{_libdir}/znc \
--with-systemdsystemunitdir=%{_unitdir} \
%if 0%{?with_modperl} %if 0%{?with_modperl}
--enable-perl \ --enable-perl \
%else %else
@ -155,13 +131,8 @@ chmod -x modules/q.cpp
%__rm -Rf "%{buildroot}" %__rm -Rf "%{buildroot}"
%endif # 0%{?rhel} && 0%{?rhel} <= 5 %endif # 0%{?rhel} && 0%{?rhel} <= 5
%__make install DESTDIR="%{buildroot}" %__make install DESTDIR="%{buildroot}"
%if 0%{?use_systemd}
mkdir -p %buildroot%{_unitdir} mkdir -p %buildroot%{_unitdir}
install -m 0644 %{SOURCE1} %buildroot%{_unitdir}/znc.service #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}
%if 0%{?rhel} && 0%{?rhel} <= 5 %if 0%{?rhel} && 0%{?rhel} <= 5
@ -180,33 +151,15 @@ chown znc:znc /var/lib/znc
%post %post
%if 0%{?use_systemd}
%systemd_post znc.service %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 %postun
%if 0%{?use_systemd}
%systemd_postun_with_restart znc.service %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 %preun
%if 0%{?use_systemd}
%systemd_preun znc.service %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 %files
@ -267,11 +220,7 @@ fi
%{_libdir}/znc/watch.so %{_libdir}/znc/watch.so
%{_libdir}/znc/webadmin.so %{_libdir}/znc/webadmin.so
%{_datadir}/znc/ %{_datadir}/znc/
%if 0%{?use_systemd}
%{_unitdir}/znc.service %{_unitdir}/znc.service
%else # 0%{?use_systemd}
%{_initrddir}/znc
%endif # 0%{?use_systemd}
%files devel %files devel
%{_bindir}/znc-buildmod %{_bindir}/znc-buildmod