# # spec file for package matomo # # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # See also http://en.opensuse.org/openSUSE:Specfile_guidelines %define apxs %{_sbindir}/apxs2 %define ap_sysconfdir %(%{apxs} -q SYSCONFDIR) %define ap_serverroot %(%{apxs} -q PREFIX) %if 0%{?suse_version} %define ap_usr wwwrun %define ap_grp www %else %define ap_usr nobody %define ap_grp nogroup %endif %if 0%{?suse_version} >= 1210 %define has_systemd 1 %endif Name: matomo Version: 3.3.0 Release: 0 Summary: Open Source web analytics License: GPL-2.0 Group: Applications/Internet Url: http://matomo.org/ Source0: http://builds.matomo.org/piwik.zip Source1: %{name}.conf Source2: %{name}-README.SUSE Source99: %{name}.rpmlintrc BuildArch: noarch BuildRequires: apache2-devel BuildRequires: cron BuildRequires: fdupes BuildRequires: mariadb %if 0%{?has_systemd} BuildRequires: systemd %{?systemd_requires} %else PreReq: %insserv_prereq %endif BuildRequires: unzip Requires: apache2 Requires: cron Requires: mod_php_any >= 5.5.9 Requires: mariadb Requires: php-json Requires: php-mysql Requires: php-curl Requires: php-gd Recommends: php-geoip Recommends: apache2-mod_geoip Conflicts: piwik %description Matomo, formerly Piwik, is the leading open source web analytics platform that gives you valuable insights into your website’s visitors, your marketing campaigns and much more, so you can optimize your strategy and online experience of your visitors. %prep %setup -q -n piwik install -m644 %{SOURCE2} README.SUSE # remove unwanted files find . -type f -name .htaccess -delete find . -type f -name .travis.sh -delete #%%{__rm} -r `find . -name ".git*"` %{__rm} `find . -name "*.c" -or -name "*.h"` %build #%%configure #make %%{?_smp_mflags} %install # make directories %{__install} -d -m0755 $RPM_BUILD_ROOT%{ap_serverroot}/%{name} %{__install} -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name} %{__install} -d -m0755 $RPM_BUILD_ROOT%{_defaultdocdir}/%{name} # copy src from build to buildroot %{__mv} *SUSE $RPM_BUILD_ROOT%{_defaultdocdir}/%{name} %{__mv} LEGALNOTICE $RPM_BUILD_ROOT%{_defaultdocdir}/%{name} %{__mv} LICENSE $RPM_BUILD_ROOT%{_defaultdocdir}/%{name} %{__mv} "misc/How to install Matomo.html" $RPM_BUILD_ROOT%{_defaultdocdir}/%{name} %{__mv} *md $RPM_BUILD_ROOT%{_defaultdocdir}/%{name} %{__cp} -dR * $RPM_BUILD_ROOT%{ap_serverroot}/%{name} # install matomo.conf to apache conf.d %{__install} -D -m0640 %{SOURCE1} $RPM_BUILD_ROOT%{ap_sysconfdir}/conf.d/%{name}.conf # move config to etc/matomo and make symlink %{__mv} $RPM_BUILD_ROOT%{ap_serverroot}/%{name}/config/* \ $RPM_BUILD_ROOT%{_sysconfdir}/%{name} %{__rm} -d $RPM_BUILD_ROOT%{ap_serverroot}/%{name}/config %{__ln_s} %{_sysconfdir}/%{name} $RPM_BUILD_ROOT%{ap_serverroot}/%{name}/config # install cronscript %{__install} -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.d %{__install} -d -m0755 $RPM_BUILD_ROOT/var/log/%{name} cat >> $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}-archive << EOF # without CLI #5 * * * * wwwrun %{_bindir}/php %{ap_serverroot}/%{name}/misc/cron/archive.php --url=http://localhost/matomo/ > /var/log/%{name}/%{name}-archive.log # with CLI 5 * * * * wwwrun %{_bindir}/php %{ap_serverroot}/%{name}/console core:archive --url=http://localhost/matomo/ > /var/log/%{name}/%{name}-archive.log EOF %fdupes ${RPM_BUILD_ROOT} %post %{__chown} -R %{ap_usr}:%{ap_grp} %{ap_serverroot}/%{name} %if 0%{?has_systemd} %service_add_post apache2.service %else %restart_on_update apache2 %endif # TODO #if [ "$1" = 2 ]; then # %%{_bindir}/php %%{ap_serverroot}/%%{name}/console core:update #fi %postun %if 0%{?has_systemd} %service_del_postun apache2.service %else %restart_on_update apache2 %endif %files %defattr(-,root,root,-) #%%doc README.SUSE CHANGELOG.md CONTRIBUTING.md LEGALNOTICE README.md SECURITY.md %dir %{_defaultdocdir}/%{name} %{_defaultdocdir}/%{name}/* %config(noreplace) %{_sysconfdir}/cron.d/%{name}-archive %config(noreplace) %{ap_sysconfdir}/conf.d/%{name}.conf %dir %attr(0750,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name} %dir %attr(0750,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/environment %defattr(640,%{ap_usr},%{ap_grp},750) %dir %{ap_serverroot}/%{name} %dir /var/log/%{name} %config(noreplace) %attr(600,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/*php %{_sysconfdir}/%{name}/environment/*php %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/console %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc/cron/archive.sh %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc/log-analytics/import_logs.py %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc/composer/clean-xhprof.sh %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc/composer/build-xhprof.sh %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/leafo/lessphp/package.sh %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/leafo/lessphp/lessify %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/leafo/lessphp/plessc %attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/pear/archive_tar/sync-php4 %{ap_serverroot}/%{name}/* %changelog