# TODO
-# - bncsetup still not working, needs newer dialog
+# - bncsetup working partially, needs newer dialog
Summary: Simple IRC bouncer
-Summary(pl): Proste narzêdzie do tunelowania irc
+Summary(pl): Proste narzêdzie do tunelowania IRC
Name: bnc
-Version: 2.9.3
-Release: 0.9
+Version: 2.9.4
+Release: 3
License: GPL
Group: Networking/Utilities
-# http://gotbnc.com/files/%{name}%{version}.tar.gz - doesn't work with distfiles, reason unknown
-#Source0: ftp://distfiles.pld-linux.org/src/%{name}%{version}.tar.gz
Source0: http://www.gotbnc.com/files/%{name}%{version}.tar.gz
-# Source0-md5: 5012f3eb112f0fda545b1aaf66a06150
+# Source0-md5: 190486d2346415e30f6381377e82eb3b
Source1: %{name}.sysconfig
Source2: %{name}.init
Source3: %{name}.conf
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: openssl-devel
-BuildRequires: rpmbuild(macros) >= 1.177
+BuildRequires: rpmbuild(macros) >= 1.268
+Requires: dialog >= 1:0.69
Provides: group(bnc)
Provides: user(bnc)
-Requires: dialog >= 1:0.69
-Requires: /sbin/start-stop-daemon
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define _sysconfdir /etc/%{name}
-
-%define userid 142
-%define groupid 142
+%define _sysconfdir /etc/%{name}
%description
BNC is a great IRC (Internet Relay Chat) proxying server under the GPL
BNC zosta³o uruchomione. Mówi±c w skrócie, BNC przekazuje informacje
od u¿ytkownika do serwera i vice versa.
+%package init
+Summary: Simple IRC bouncer daemon
+Summary(pl): Prosty demon do tunelowania IRC
+Group: Networking/Utilities
+Requires(post): grep
+Requires(post,preun): /sbin/chkconfig
+Requires(postun): /usr/sbin/groupdel
+Requires(postun): /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires: %{name} = %{version}-%{release}
+Requires: /sbin/start-stop-daemon
+
+%description init
+This package contains the initscript to start bnc as system service.
+
+%description init -l pl
+Ten pakiet zawiera skrypt init do uruchamiania bnc jako us³ugi
+systemowej.
+
%prep
%setup -q -n %{name}%{version}
%patch0 -p1
--with-ssl
%{__make} \
- CFLAGS="%{rpmcflags}" \
- OFLAGS="%{rpmcflags}" \
+ CFLAGS="%{rpmcflags} -include config.h"
%install
rm -rf $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
-%pre
-if [ -n "`/usr/bin/getgid %{name}`" ]; then
- if [ "`/usr/bin/getgid %{name}`" != %{groupid} ]; then
- echo "Error: group %{name} doesn't have gid=%{groupid}. Correct this before installing %{name}." 1>&2
- exit 1
- fi
-else
- /usr/sbin/groupadd -g %{groupid} %{name}
-fi
-if [ -n "`/bin/id -u %{name} 2>/dev/null`" ]; then
- if [ "`/bin/id -u %{name}`" != %{userid} ]; then
- echo "Error: user %{name} doesn't have uid=%{userid}. Correct this before installing %{name}." 1>&2
- exit 1
- fi
-else
- /usr/sbin/useradd -u %{userid} -d /var/run/%{name} -s /bin/false \
- -c "%{name} User" -g %{name} %{name} 1>&2
-fi
+%pre init
+%groupadd -g 142 %{name}
+%useradd -u 142 -d /var/run/%{name} -s /bin/false -c "%{name} User" -g %{name} %{name}
-%post
+%post init
if ! egrep -q '^(adminpass|password)' /etc/bnc/bnc.conf; then
%banner %{name} -e <<EOF
-You need to setup passwords in /etc/bnc/bnc.conf!
+You need to setup passwords in %{_sysconfdir}/%{name}.conf!
The daemon will not start unless you've set them!
EOF
# ' vim
fi
+/sbin/chkconfig --add %{name}
+%service %{name} restart "%{name} daemon"
-# add service just once
-[ "$1" = "1" ] && /sbin/chkconfig --add %{name}
-
-if [ -f /var/lock/subsys/%{name} ]; then
- /etc/rc.d/init.d/%{name} restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/%{name} start\" to start %{name} daemon."
-fi
-
-%preun
+%preun init
if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/%{name} ]; then
- /etc/rc.d/init.d/%{name} stop 1>&2
- fi
+ %service %{name} stop
/sbin/chkconfig --del %{name}
fi
-%postun
+%postun init
if [ "$1" = "0" ]; then
- %userremove bnc
- %groupremove bnc
+ %userremove %{name}
+ %groupremove %{name}
fi
%files
%defattr(644,root,root,755)
%doc README Changelog motd example.conf bncchk
-%dir %attr(750,bnc,bnc) %{_sysconfdir}
-%config(noreplace) %verify(not size mtime md5) %attr(640,bnc,bnc) %{_sysconfdir}/*
-
%attr(755,root,root) %{_bindir}/*
-%attr(754,root,root) /etc/rc.d/init.d/%{name}
-%config(noreplace) %verify(not size mtime md5) /etc/sysconfig/%{name}
-%dir %attr(750,bnc,bnc) /var/run/%{name}
+%files init
+%defattr(644,root,root,755)
+%dir %attr(750,root,bnc) %{_sysconfdir}
+%config(noreplace) %verify(not md5 mtime size) %attr(640,root,bnc) %{_sysconfdir}/*
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%dir %attr(770,root,bnc) /var/run/%{name}
%attr(620,bnc,bnc) %ghost /var/log/%{name}.log