%define _requires_exceptions ^pear( Summary: Web frontend for the rTorrent bittorrent client Name: rutorrent Version: 3.4 Release: %mkrel 4 License: GPLv3 Group: Networking/File transfer URL: http://code.google.com/p/rutorrent/ Source: http://rutorrent.googlecode.com/files/%{name}-%{version}.tar.gz # Plugins are here in the same .spec for simplicity as they mostly share # rutorrent's version number. If this changes in the future or it is otherwise # seemed better, this can be splitted to one or more separate src.rpms. # - Anssi 08/2010 Source1: http://rutorrent.googlecode.com/files/plugins-%{version}.tar.gz Patch0: rutorrent-fhs.patch Patch1: rutorrent-log.patch # Load a "backup" config file before the actual config file. # In case of an unhandled .rpmnew file, the possible newly added configuration # options are loaded from the backup file. This is similar in how e.g. normal # initscript configurations are handled. - Anssi 08/2010 Patch2: rutorrent-defaults.patch # Disable non-service plugins by default, but allow the user to enable them # via GUI. http://code.google.com/p/rutorrent/wiki/Plugins recommends to not # enable unused plugins, and this way we don't have to split them in many # packages. - Anssi 03/2012 Patch3: rutorrent-disable-plugins-by-default.patch BuildArch: noarch Requires: webserver # suggests to allow other webservers: Suggests: apache-mod_php # for apache user: Requires(pre): webserver-base %description rutorrent is a web frontend for the rTorrent bittorrent client. Official plugins are included in %name-plugins subpackage. Note that you need to either configure an SCGI module for your web server or install %name-plugins and enable rpc or httprpc plugins for rutorrent to work. See the online documentation for more details. All configuration files, including plugin configuration, are in %{_sysconfdir}/%{name}. %package plugins Summary: Official plugins for ruTorrent Group: Networking/File transfer Requires: %name = %version %define old_plugins autotools chunks cookies cpuload create data datadir diskspace edit erasedata extsearch feeds geoip _getdir httprpc loginmgr ratio retrackers rpc rss rssurlrewrite scheduler seedingtime show_peers_like_wtorrent source theme throttle tracklabels trafic unpack Obsoletes: %(for plugin in %old_plugins; do echo -n "rutorrent-plugin-$plugin < 3.4-1 "; done) %description plugins This package contains the official plugins for ruTorrent. The plugins are disabled by default, they can be enabled via GUI or in %{_sysconfdir}/%name/plugins.ini. %prep %setup -q -n %name -a 1 %apply_patches find -name '*.00??*' -print -delete # make sure a directory layout change is not missed [ $(ls | wc -l) -eq 10 ] # make sure the fhs patch does not miss anything grep -R -e 'conf/' -e "'/share" . && exit 1 # for defaults.patch: cp -a conf/config.php php/defaults-rpm.php cat > README.install.urpmi <<EOF Note that you will need to either configure an SCGI module for your web server or install %name-plugins and enable rpc or httprpc in %{_sysconfdir}/%{name}/plugins.ini for rutorrent to work. See the online documentation for more details: http://code.google.com/p/rutorrent/wiki/WebSERVER The official plugins are contained in the %name-plugins subpackage. On this %product_distribution packaging of rutorrent and its plugins, all configuration files are in %{_sysconfdir}/%{name}. The access configuration is in %{_webappconfdir}/%{name}.conf. By default only localhost is allowed to use rutorrent. EOF cat > README.3.4.upgrade.urpmi <<EOF All the plugins have been moved to a single %name-plugins subpackage. The plugins are disabled by default. They can be enabled via GUI or in %{_sysconfdir}/%name/plugins.ini. EOF %install install -d -m755 %{buildroot}%{_webappconfdir} cat > %{buildroot}%{_webappconfdir}/%{name}.conf <<EOF Alias /%{name} %{_datadir}/%{name} <Directory %{_datadir}/%{name}> %if %{mgaversion} < 3 Order deny,allow Deny from all Allow from 127.0.0.1 %endif %if %{mgaversion} >= 3 Require local granted %endif </Directory> EOF install -d -m755 %{buildroot}%{_sysconfdir}/logrotate.d cat > %{buildroot}%{_sysconfdir}/logrotate.d/%{name} <<EOF %{_logdir}/%{name}/*.log { missingok } EOF install -d -m755 %{buildroot}%{_datadir}/%{name} cp -a *.html *.ico css images js lang php plugins %{buildroot}%{_datadir}/%{name} install -d -m755 %{buildroot}%{_localstatedir}/lib/%{name} cp -a share %{buildroot}%{_localstatedir}/lib/%{name} install -d -m755 %{buildroot}%{_sysconfdir}/%{name} cp -a conf/* %{buildroot}%{_sysconfdir}/%{name} install -d -m755 %{buildroot}%{_logdir}/%{name} rm -rf lists mkdir lists rm -rf plugindocs mkdir plugindocs for dir in %{buildroot}%{_datadir}/%{name}/plugins/*; do plugin=$(basename "$dir") version=$(sed -n 's,plugin.version: ,,p' "$dir/plugin.info" | tr -d '\r') # check that rpm version is set correctly: [ "%version" = "$version" ] touch lists/$plugin.list echo %{_datadir}/%{name}/plugins/$plugin > lists/$plugin.list if [ -e "$dir/conf.php" ]; then install -d -m755 %{buildroot}%{_sysconfdir}/%{name}/plugins/$plugin cp "$dir/conf.php" %{buildroot}%{_sysconfdir}/%{name}/plugins/$plugin mv "$dir/conf.php" "$dir/defaults-rpm.php" sed -i '/rtorrent.php.error/s/conf.php/defaults-rpm.php/' $dir/plugin.info echo "%dir %{_sysconfdir}/%{name}/plugins/$plugin" >> lists/$plugin.list echo "%config(noreplace) %{_sysconfdir}/%{name}/plugins/$plugin/conf.php" >> lists/$plugin.list fi for file in $dir/readme*.txt; do [ -e "$file" ] || continue mkdir -p plugindocs/$plugin mv "$file" plugindocs/$plugin/ #echo "%%doc plugins/$plugin/$(basename "$file")" >> lists/$plugin.list done done # include all plugins in a single package cat lists/*.list > all-plugins.list %files %doc README.*urpmi %config(noreplace) %{_webappconfdir}/%{name}.conf %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/access.ini %config(noreplace) %{_sysconfdir}/%{name}/config.php %config(noreplace) %{_sysconfdir}/%{name}/plugins.ini %dir %{_sysconfdir}/%{name}/plugins %dir %{_sysconfdir}/%{name}/users %dir %{_datadir}/%{name} %{_datadir}/%{name}/css %{_datadir}/%{name}/favicon.ico %{_datadir}/%{name}/images %{_datadir}/%{name}/index.html %{_datadir}/%{name}/js %{_datadir}/%{name}/lang %{_datadir}/%{name}/php %dir %{_datadir}/%{name}/plugins %dir %{_localstatedir}/lib/%{name} %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}/share %attr(0755,apache,apache) %dir %{_logdir}/%{name} %files plugins -f all-plugins.list %doc plugindocs/* %changelog * Sat Dec 29 2012 oden <oden> 3.4-4.mga3 + Revision: 336097 - apapt the apache config * Sun Mar 25 2012 anssi <anssi> 3.4-3.mga2 + Revision: 226397 - require webserver-base instead of apache to allow lighttpd use * Thu Mar 08 2012 kamil <kamil> 3.4-2.mga2 + Revision: 221417 - fix a requirement and use now apache (apache-conf is obsoleted by apache) - clean .spec a bit * Wed Mar 07 2012 anssi <anssi> 3.4-1.mga2 + Revision: 221264 - new version 3.4 - merge all plugins into rutorrent-plugins package, and disable them by default (disable-plugins-by-default.patch); they can be enabled either via the GUI (plugins tab) or via /etc/rutorrent/plugins.ini - update description and clean .spec - replace mdv/Mandriva occurrences with Mageia or rpm - actually install the README.install.urpmi file - rediff and adapt patches - imported package rutorrent