File koseven.spec of Package koseven

# spec file for package koseven
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2015 Lars Vogdt <>
# 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

%define         apache_serverroot %(%{_sbindir}/apxs2 -q DATADIR)
%define         apache_sysconfdir %(%{_sbindir}/apxs2 -q SYSCONFDIR)
%define         installpath %{apache_serverroot}/%{name}

Name:           koseven
Version:        3.3.7
Release:        0
Summary:        PHP 7 framework that uses the Model View Controller architectural pattern
License:        BSD-3-Clause
Group:          Productivity/Networking/Web/Utilities

Source1:        apache2-%{name}.conf

BuildRequires:  apache2-devel
BuildRequires:  fdupes
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

Requires:       mod_php_any
Requires:       php5-ZendFramework

Requires(pre):  http_daemon

Recommends:     php5-mcrypt

Provides:       kohana3 = %{version}
Obsoletes:      kohana3 < %{version}

Koseven is a PHP 7 framework that uses the Model View Controller architectural
pattern with a loosely coupled architecture and UTF-8 compatibility.

%setup -q -n %{name}-%{version}


mkdir -p %{buildroot}/%{installpath}
cp -r * %{buildroot}/%{installpath}/

find %{buildroot}/%{installpath}/ -type d -exec chmod 755 {} +
find %{buildroot}/%{installpath}/ -type f -exec chmod 644 {} +
find %{buildroot}/%{installpath}/ -type f -name ".gitignore" -delete

for dir in application/logs application/cache; do
  chmod 775 %{buildroot}/%{installpath}/$dir

# install apache config
mkdir -p %{buildroot}/%{apache_sysconfdir}/conf.d/
install -m640 %{SOURCE1} %{buildroot}/%{apache_sysconfdir}/conf.d/%{name}.conf

# move system and modules folder out of webroot
mkdir -p %{buildroot}/%{_datadir}/%{name}/
mv %{buildroot}/%{installpath}/{system,modules} %{buildroot}/%{_datadir}/%{name}/

# remove example file
rm %{buildroot}/%{installpath}/public/example.htaccess

%fdupes %{buildroot}

# enable mod_php5 in apache config
# enable KOHANA3 in /etc/sysconfig/apache2
if [ "$1" = "1" ]; then
  test -x %{_sbindir}/a2enmod && %{_sbindir}/a2enmod php5 >/dev/null
  test -x %{_sbindir}/a2enflag && %{_sbindir}/a2enflag KOHANA3 >/dev/null

%restart_on_update apache2

# deinstallation of the package - remove the apache flag
if [ "$1" = "0" ]; then
  test -x %{_sbindir}/a2disflag && %{_sbindir}/a2disflag KOHANA3 >/dev/null
  %restart_on_update apache2

%dir %{apache_serverroot}/%{name}
%attr(-,wwwrun,www) %{apache_serverroot}/%{name}/application/cache
%attr(-,wwwrun,www) %{apache_serverroot}/%{name}/application/logs
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%dir %{_datadir}/%{name}

openSUSE Build Service is sponsored by