[znc/el6] Add init script for epel
Nick Bebout
nb at fedoraproject.org
Mon Jan 23 20:13:47 UTC 2012
commit 4ae235b5ea5e8863993546fb2746d442af485a47
Author: Nick Bebout <nb at fedoraproject.org>
Date: Mon Jan 23 14:13:36 2012 -0600
Add init script for epel
znc.spec | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 64 insertions(+), 6 deletions(-)
---
diff --git a/znc.spec b/znc.spec
index 9889c64..21cbdd3 100644
--- a/znc.spec
+++ b/znc.spec
@@ -11,14 +11,20 @@ Summary: An advanced IRC bouncer
Name: znc
Version: 0.204
#Release: 0.1.20110801git%{?dist}
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv2 with exceptions
Group: System Environment/Daemons
URL: http://znc.in
Source0: http://znc.in/releases/znc-0.204.tar.gz
+
%if %{use_systemd}
Source1: znc.service
%endif
+
+%if !%{use_systemd}
+Source1: znc.init
+%endif
+
# git clone https://github.com/znc/znc.git
# cd znc
# git archive --prefix=znc/ HEAD | xz > ../znc-0.097.tar.xz
@@ -27,7 +33,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: perl gcc-c++
BuildRequires: openssl-devel >= 0.9.8
BuildRequires: cyrus-sasl-devel
-BuildRequires: c-ares-devel automake
+BuildRequires: c-ares-devel automake python3-devel
BuildRequires: perl(ExtUtils::Embed) swig tcl-devel
%if %{use_systemd}
BuildRequires: systemd-units
@@ -40,6 +46,13 @@ Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
+%if !%{use_systemd}
+Requires(post): chkconfig
+Requires(preun): chkconfig
+# This is for /sbin/service
+Requires(preun): initscripts
+%endif
+
%description
ZNC is an IRC bouncer with many advanced features like detaching,
multiple users, per channel playback buffer, SSL, IPv6, transparent
@@ -83,6 +96,15 @@ Provides: perl(ZNC::Module) = %{version}-%{release}
%description modperl
perl module for ZNC
+%package modpython
+Summary: python3 module for ZNC
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: python3
+
+%description modpython
+python3 module for ZNC
+
%prep
%setup -q -n %{name}-%{version}
#%patch0 -p1
@@ -93,19 +115,19 @@ chmod -x modules/q.cpp
./autogen.sh
%configure \
--with-module-prefix=%{_libdir}/znc \
- --enable-ipv6 --enable-extra --enable-sasl --enable-perl --enable-tcl
+ --enable-ipv6 --enable-extra --enable-sasl --enable-python --enable-perl --enable-tcl
%__make %{?_smp_mflags}
%pre
-%if %{use_systemd}
+#%if %{use_systemd}
getent group znc >/dev/null || groupadd -r znc
getent passwd znc >/dev/null || \
useradd -r -g znc -d /var/lib/znc -s /sbin/nologin \
-c "Account for ZNC to run as" znc
mkdir -p /var/lib/znc
chown znc:znc /var/lib/znc
-exit 0
-%endif
+#exit 0
+#%endif
%install
%__rm -Rf "%{buildroot}"
@@ -114,11 +136,16 @@ exit 0
mkdir -p %buildroot%{_unitdir}
install -m 0644 %{SOURCE1} %buildroot%{_unitdir}/znc.service
%endif
+%if !%{use_systemd}
+mkdir -p %buildroot%{_initrddir}
+install -Dp -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/znc
+%endif
%clean
%__rm -Rf "%{buildroot}"
%post
+
%if %{use_systemd}
if [ $1 -eq 1 ] ; then
# Initial installation
@@ -126,7 +153,13 @@ if [ $1 -eq 1 ] ; then
fi
%endif
+%if !%{use_systemd}
+# This adds the proper /etc/rc*.d links for the script
+/sbin/chkconfig --add znc
+%endif
+
%postun
+
%if %{use_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
@@ -135,7 +168,14 @@ if [ $1 -ge 1 ] ; then
fi
%endif
+%if !%{use_systemd}
+if [ "$1" -ge "1" ] ; then
+ /sbin/service znc condrestart >/dev/null 2>&1 || :
+fi
+%endif
+
%preun
+
%if %{use_systemd}
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
@@ -144,6 +184,13 @@ if [ $1 -eq 0 ] ; then
fi
%endif
+%if !%{use_systemd}
+if [ $1 -eq 0 ] ; then
+ /sbin/service znc stop >/dev/null 2>&1
+ /sbin/chkconfig --del znc
+fi
+%endif
+
%files
%defattr(-,root,root)
%doc AUTHORS LICENSE LICENSE.OpenSSL README.md
@@ -191,6 +238,9 @@ fi
%if %{use_systemd}
%{_unitdir}/znc.service
%endif
+%if !%{use_systemd}
+%{_initrddir}/znc
+%endif
%files devel
%defattr(-,root,root)
@@ -231,7 +281,15 @@ fi
%{_libdir}/znc/modperl.so
%{_libdir}/znc/perleval.pm
+%files modpython
+%defattr(-,root,root)
+%{_libdir}/znc/modpython/
+%{_libdir}/znc/modpython.so
+
%changelog
+* Mon Jan 23 2012 Nick Bebout <nb at fedoraproject.org> - 0.204-2
+- Add init script for EPEL
+
* Mon Jan 23 2012 Nick Bebout <nb at fedoraproject.org> - 0.204-1
- Update to 0.204 to fix security issue CVE-2012-0033
More information about the scm-commits
mailing list