File partkeepr.spec of Package partkeepr

#
# spec file for package partkeepr
#
# 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/
#

%define realname PartKeepr

Name:           partkeepr
Version:        1.4.0
Release:        0
License:        GPL-3.0-or-later
Summary:        Open Source Inventory Software
Url:            http://partkeepr.org/
Group:          Productivity/Networking/Web/Frontends
Source:         %{realname}-%{version}.tar.bz2
Source1:        %{name}.abstraction.apparmor
Source2:        %{name}.conf
Source3:        partkeepr-rpmlintrc
BuildRequires:  fdupes
BuildRequires:  apache2
BuildRequires:  sed
BuildRequires:  fdupes
BuildRequires:  apparmor-profiles
Recommends:     apache2-mod_apparmor
Requires:       http_daemon
Requires:       mod_php_any >= 5.6
Requires:       php-bcmath
Requires:       php-composer
Requires:       php-ctype
Requires:       php-curl
Requires:       php-dom
Requires:       php-gd
Requires:       php-ldap
Requires:       php-mbstring
Requires:       php-pcntl
Requires:       php-pdo
Requires:       php-tokenizer
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define         app_dir %{_datadir}/%{name}
%define         app_config_dir %{_sysconfdir}/%{name}

%description
PartKeepr is an inventory management software, primarily designed for
electronic components.

PartKeepr is written in PHP and using the Symfony2 framework.

%prep
%setup -q -n %{realname}-%{version}
for file in .travis.yml .gitignore .gitmodules .styleci.yml .jshintrc .keep; do
	find . -name $file -delete
done
rm -rf .github
sed -i "s|/usr/bin/env php|%{_bindir}/php|g" app/console app/setupconsole

%build
#

%install
install -d -m 0755 %{buildroot}%{app_dir}
cp -r app data src theme web %{buildroot}%{app_dir}/
find %{buildroot}%{app_dir} -name .htaccess -delete

# apache & apparmor hat
install -D -m 0640 %{S:1} %{buildroot}%{_sysconfdir}/apparmor.d/abstractions/%{name}
install -D -m 0640 %{S:2} %{buildroot}%{_sysconfdir}/apache2/vhosts.d/%{name}.conf

# sysconfig
mkdir -p %{buildroot}/%{app_config_dir}
cp %{buildroot}%{app_dir}/app/config/parameters.php.dist %{buildroot}/%{app_config_dir}/parameters.php
ln -s %{app_config_dir}/parameters.php %{buildroot}%{app_dir}/app/config/parameters.php
mv %{buildroot}%{app_dir}/theme/overrides.css %{buildroot}/%{app_config_dir}/
ln -s %{app_config_dir}/overrides.css %{buildroot}%{app_dir}/theme/overrides.css


# fdupes
%fdupes %{buildroot}%{app_dir}


%post 
# enable modules in apache config
if [ -x %{_sbindir}/a2enmod ]; then
  %{_sbindir}/a2enmod php7 2>/dev/null || :
  %{_sbindir}/a2enmod rewrite 2>/dev/null || :
fi

%files
%defattr(0644,root,root,0755)
%doc *.md THANKS documentation
%license LICENSE*
%dir %{app_dir}
%dir %{app_config_dir}
%{app_dir}/app
%{app_dir}/src
%{app_dir}/theme
%{app_dir}/web
%attr(0755,root,root) %{app_dir}/app/*console
%config(noreplace) %{_sysconfdir}/apparmor.d/abstractions/%{name}
%config(noreplace) %{_sysconfdir}/apache2/vhosts.d/%{name}.conf
%config(noreplace) %attr(0640,root,www) %{app_config_dir}/*
%defattr(0640,wwwrun,root,0750)
%{app_dir}/data

%changelog

openSUSE Build Service is sponsored by