File ratbox-services-testing.spec of Package ratbox-services-testing
# norootforbuild
%define pkg_name ratbox-services
#
%define dir_prefix ratbox/services
%define home_dir %{_var}/lib/%{pkg_name}
%define log_dir %{_var}/log/%{dir_prefix}
%define run_dir %{_var}/run/%{dir_prefix}
%define conf_dir %{_sysconfdir}/%{dir_prefix}
%define help_dir %{_datadir}/%{dir_prefix}/help
%define lang_dir %{_datadir}/%{dir_prefix}/langs
%define db_path %{home_dir}/%{pkg_name}.db
#
%define with_sqlite3 1
#
%if 0%{?sles_version} == 9
%define with_sqlite3 0
%endif
#
%if 0%{?with_sqlite3}
%define backends mysql pgsql sqlite3
%else
%define backends mysql pgsql
%endif
#
Name: ratbox-services-testing
Version: 1.2.0beta1
Release: 0
#
License: BSD
Group: Productivity/Networking/IRC
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: mysql-devel postgresql-devel flex bison pcre-devel
%if %{with_sqlite3}
BuildRequires: sqlite-devel >= 3
%endif
PreReq: %insserv_prereq %fillup_prereq
Requires: %{pkg_name}_backend
Conflicts: %{pkg_name}
Provides: %{name}
#
URL: http://services.ircd-ratbox.org/index.shtml
Source: http://services.ircd-ratbox.org/download/%{pkg_name}-%{version}.tgz
Source1: ratbox-services.init
Patch: ratbox-services-1.0.3_dbpath.patch
#
Summary: A services package written mostly from scratch for use with ircd-ratbox.
%description
ratbox-services is a services package written mostly from scratch for
use with ircd-ratbox.
It is highly configurable, with nearly all options being set in a
config that can be rehashed rather than set at compile time.
It can interface various popular SQL databases.
Username registration service
Allows users to register usernames, which then form the basis of all
access to channels.
Channel registration services
Allows users to maintain channels, with access levels from 1 to 200.
Nickname registration service
Allows users to register nicknames, registered through a username.
Jupe service
Allows services operators to place jupes on servers, which prevents
the server from reconnecting to the network. Also contains an
optional method for ircops to vote upon jupes and unjupes.
Global message service
Allows services operators to send a message to all users on the
network.
Oper services
Allows services operators to perform mode changes in a channel, and
takeover channels.
Opered bot
The opered bot can be placed in channels, and will then invite or op
ircops in that channel upon request.
List service
Allows users to perform advanced searching of the list of channels.
Searching may take place on name, user count, topic and modes.
Authors:
--------
anfl, Lee Hardy, <lee -at- leeh.co.uk>
%if %{with_sqlite3}
%package backend_sqlite3
Group: Productivity/Networking/IRC
#
Provides: %{pkg_name}_backend
PreReq: %{name}
#
Summary: A services package written mostly from scratch for use with ircd-ratbox. (SQLite3 backend)
%description backend_sqlite3
ratbox-services is a services package written mostly from scratch for
use with ircd-ratbox.
This package holds the binary compiled against SQLite3.
Authors:
--------
anfl, Lee Hardy, <lee -at- leeh.co.uk>
%endif
%package backend_mysql
Group: Productivity/Networking/IRC
#
Provides: %{pkg_name}_backend
PreReq: %{name}
#
Summary: A services package written mostly from scratch for use with ircd-ratbox. (MySQL backend)
%description backend_mysql
ratbox-services is a services package written mostly from scratch for
use with ircd-ratbox.
This package holds the binary compiled against MySQL.
Authors:
--------
anfl, Lee Hardy, <lee -at- leeh.co.uk>
%package backend_pgsql
Group: Productivity/Networking/IRC
#
Provides: %{pkg_name}_backend
PreReq: %{name}
#
Summary: A services package written mostly from scratch for use with ircd-ratbox. (pgSQL backend)
%description backend_pgsql
ratbox-services is a services package written mostly from scratch for
use with ircd-ratbox.
This package holds the binary compiled against pgSQL.
Authors:
--------
anfl, Lee Hardy, <lee -at- leeh.co.uk>
%debug_package
%prep
%setup -n %{pkg_name}-%{version}
%patch
%build
# nick and topic length should ideally match the values in the ircd-ratbox package
export CFLAGS="%{optflags}"
%if %suse_version > 1000
export CFLAGS="$CFLAGS -fstack-protector"
%endif
export COMMON_OPTIONS="\
--sysconfdir=%{conf_dir} \
--with-logdir=%{log_dir} \
--with-rundir=%{run_dir} \
--with-helpdir=%{help_dir} \
--with-langdir=%{lang_dir} \
--bindir=%{_sbindir} \
--includedir=%{_includedir}/%{pkg_name} \
--with-nicklen=32"
#
for backend in %{backends} ; do
%{__make} distclean ||:
%configure $COMMON_OPTIONS --enable-$backend
%{__make}
%{__cp} src/%{pkg_name} %{pkg_name}-$backend
done
%install
%makeinstall
%{__rm} -v %{buildroot}%{_sbindir}/%{pkg_name}
%{__install} -m 0755 %{pkg_name}-* %{buildroot}%{_sbindir}/
%{__ln_s} -f %{pkg_name}-mysql %{buildroot}%{_sbindir}/%{pkg_name}
#
%{__cp} -v %{buildroot}%{conf_dir}/{example,ratbox-services}.conf
#
%{__install} -D -m 0755 %{S:1} %{buildroot}/etc/init.d/%{pkg_name}
%{__ln_s} -f /etc/init.d/%{pkg_name} %{buildroot}%{_sbindir}/rc%{pkg_name}
%{__chmod} -Rv o+rX %{buildroot}%{_prefix}
#
%{__install} -Dd %{buildroot}{%{log_dir},%{run_dir},%{home_dir}}
touch %{buildroot}%{db_path}
mv doc/ChangeLog{,-old}
%clean
%{__rm} -rf %{buildroot}
%pre
/usr/sbin/groupadd -r %{pkg_name} &>/dev/null ||:
/usr/sbin/useradd -r -o -g %{pkg_name} -s /bin/false -c "%{pkg_name} daemon" -d %{home_dir} %{pkg_name} &>/dev/null || :
%preun
%stop_on_removal %{pkg_name}
%post
%fillup_and_insserv %{pkg_name}
%postun
%restart_on_update %{pkg_name}
%insserv_cleanup
%if %{with_sqlite3}
%post backend_sqlite3
#if [ ! -e %{db_path} ] ; then
# sqlite %{db_path} < %{conf_dir}/schema.txt
# chown %{name}:%{name} %{db_path}
# chmod u=rw,g=r,o= %{db_path}
# echo "Created Default database in '%{db_path}'" >&2
#fi
/usr/sbin/update-alternatives --install \
%{_sbindir}/%{pkg_name} %{pkg_name} \
%{_sbindir}/%{pkg_name}-sqlite3 10
%preun backend_sqlite3
if [ "$1" = 0 ] ; then
/usr/sbin/update-alternatives --remove \
%{pkg_name} %{_sbindir}/%{pkg_name}-sqlite3
fi
%endif
%post backend_mysql
/usr/sbin/update-alternatives --install \
%{_sbindir}/%{pkg_name} %{pkg_name} \
%{_sbindir}/%{pkg_name}-mysql 10
%preun backend_mysql
if [ "$1" = 0 ] ; then
/usr/sbin/update-alternatives --remove \
%{pkg_name} %{_sbindir}/%{pkg_name}-mysql
fi
%post backend_pgsql
/usr/sbin/update-alternatives --install \
%{_sbindir}/%{pkg_name} %{pkg_name} \
%{_sbindir}/%{pkg_name}-pgsql 10
%preun backend_pgsql
if [ "$1" = 0 ] ; then
/usr/sbin/update-alternatives --remove \
%{pkg_name} %{_sbindir}/%{pkg_name}-pgsql
fi
%files
%defattr(-,root,root,-)
%dir %attr(0755,root,root) %{_var}/log/ratbox
%dir %attr(0750,%{pkg_name},%{pkg_name}) %{log_dir}
%dir %attr(0755,root,root) %{_var}/run/ratbox
%dir %attr(0750,%{pkg_name},%{pkg_name}) %{run_dir}
%dir %attr(0750,%{pkg_name},%{pkg_name}) %{home_dir}
#
%dir %attr(0755,root,root) %{_sysconfdir}/ratbox
%dir %attr(0750,root,%{pkg_name}) %{conf_dir}/
%config %{conf_dir}/example.conf
%config(noreplace) %{conf_dir}/ratbox-services.conf
#%config(noreplace) %{conf_dir}/schema.txt
%ghost %config(noreplace) %attr(0640,%{pkg_name},%{pkg_name}) %{db_path}
#
%{_sbindir}/ircd-shortcut.pl
%{_sbindir}/dbupgrade.pl
%{_sbindir}/definetolength.pl
%{_sbindir}/%{pkg_name}
%{_includedir}/%{pkg_name}
%dir %{_datadir}/ratbox
%dir %{_datadir}/%{dir_prefix}/
%{help_dir}
%{lang_dir}
#
/etc/init.d/%{pkg_name}
%{_sbindir}/rc%{pkg_name}
#
%doc CREDITS ChangeLog DBMOVE INSTALL* LICENSE README RELEASE_NOTES SVN-Access
%doc doc/* tools/base/ tools/oldschema/
#
%if %{with_sqlite3}
%files backend_sqlite3
%defattr(-,root,root,-)
%{_sbindir}/%{pkg_name}-sqlite3
%endif
%files backend_mysql
%defattr(-,root,root,-)
%{_sbindir}/%{pkg_name}-mysql
%files backend_pgsql
%defattr(-,root,root,-)
%{_sbindir}/%{pkg_name}-pgsql
%changelog