LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File owncloud.spec of Package owncloud (Project isv:ownCloud:community)

#
# spec file for package owncloud
#
# Copyright (c) 2012 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/
#

#
%if 0%{?suse_version}
%define apache_serverroot /srv/www/htdocs
%define apache_confdir /etc/apache2/conf.d
%define apache_user wwwrun
%define apache_group www
%else
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
%define apache_serverroot /var/www/html
%define apache_confdir /etc/httpd/conf.d
%define apache_user apache
%define apache_group apache
%define __jar_repack 0
%else
%define apache_serverroot /var/www
%define apache_confdir /etc/httpd/conf.d
%define apache_user www
%define apache_group www
%endif
%endif

Name:           owncloud
Version:        6.0.2
Release:        1
Source0:        %{name}-%{version}.tar.bz2
Source1:        apache_secure_data
Source2:        README
Source3:        README.SELinux
Url:            http://www.owncloud.org
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Summary:        ownCloud Server - Private file sync and share server
License:        AGPL-3.0 and MIT
Group:          Productivity/Networking/Web/Utilities

%if 0%{?fedora_version} || 0%{?rhel_version} >= 6 || 0%{?centos_version} >= 6
Requires:       httpd sqlite php php-json php-mbstring php-process php-pear-Net-Curl php-gd php-pear-MDB2-Driver-mysqli php-xml php-zip
BuildRequires:  httpd
%endif

%if 0%{?rhel_version} == 5 || 0%{?centos_version} == 5
Requires:       httpd sqlite php53 php53-json php53-mbstring php53-process php53-pear-Net-Curl php53-gd php53-pear-MDB2-Driver-mysqli php53-xml php53-zip
%endif

%if 0%{?suse_version}
%if 0%{?suse_version} != 1110
# For all SUSEs except SLES 11
Requires:       apache2 apache2-mod_php5 php5 sqlite3 php5-sqlite php5-mbstring php5-zip php5-json php5-posix curl php5-curl php5-gd php5-ctype php5-xmlreader php5-xmlwriter php5-zlib php5-pear php5-iconv
BuildRequires:  apache2 unzip
%else
# SLES 11 requires
# require mysql directly for SLES 11
Requires:       apache2 apache2-mod_php53 php53 mysql php53-sqlite php53-mbstring php53-zip php53-json php53-posix curl php53-curl php53-gd php53-ctype php53-xmlreader php53-xmlwriter php53-zlib php53-pear php53-iconv
BuildRequires:  apache2 unzip
%endif
%endif

Requires:       ntp curl owncloud-3rdparty
%if 0%{?suse_version}
%if 0%{?suse_version} != 1110
Recommends:     php5-mysql mysql php5-imagick libreoffice
%else
Recommends:     php53-mysql mysql php53-imagick
%endif
%else
Requires:       mysql
%endif

%description
ownCloud Server provides you a private file sync and share
cloud. Host this server to easily sync business or private documents
across all your devices, and share those documents with other users of
your ownCloud server on their devices.

ownCloud - Your Cloud, Your Data, Your Way!  www.owncloud.org


%package 3rdparty
License:      PHP-3.01
Group:        Development/Libraries/PHP
Summary:      3rdparty libraries for ownCloud
Requires:     %{name} = %{version}
%description 3rdparty
3rdparty libraries needed for running ownCloud. 
Contained in separate package due to different source code licenses.


%prep
%setup -q -n %{name}
cp %{SOURCE2} .
cp %{SOURCE3} .
#%%patch0 -p0

%build

%install
# no server side java code contained, alarm is false
export NO_BRP_CHECK_BYTECODE_VERSION=true
idir=$RPM_BUILD_ROOT/%{apache_serverroot}/%{name}
mkdir -p $idir
mkdir -p $idir/data
cp -aRf * $idir
cp -aRf .htaccess $idir
rm $idir/l10n/l10n.pl

# Install config to allow .htaccess in the data dir
install -p -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{apache_confdir}/owncloud.conf
ocpath="%{apache_serverroot}/%{name}"
sed -i -e"s|DATAPATH|${ocpath}|g" $RPM_BUILD_ROOT/%{apache_confdir}/owncloud.conf

# clean sources of odfviewer
rm -rf ${idir}/apps/files_odfviewer/src
rm -rf ${idir}/3rdparty/phpass/c
rm -rf ${idir}/3rdparty/phpdocx/pdf/lib/ttf2ufm
rm -rf ${idir}/3rdparty/phpdocx/pdf/tcpdf/fonts/utils/ttf2ufm
rm -rf ${idir}/3rdparty/phpdocx/pdf/tcpdf/fonts/utils/pfm2afm

#%%if 0%%{?suse_version}
# link duplicate doc files
#%%fdupes $RPM_BUILD_ROOT/%%{apache_serverroot}/%%{name}
#%%endif


%post
# fix timeserver configuration
cat /etc/ntp.conf | grep '^server' | grep -v -e '^#' -e '127\.127\.1' > /dev/null || ( echo "# NTP Pool servers added by ownCloud installation" ; echo "server 0.pool.ntp.org iburst" ; echo "server 1.pool.ntp.org iburst" ) >> /etc/ntp.conf
# relabel data directory for SELinux to allow ownCloud write access on redhat platforms
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
if [ -x /usr/sbin/sestatus ] ; then \
  sestatus | grep -E '^(SELinux status|Current).*(enforcing|permissive)' > /dev/null && { 
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data'
    restorecon '/var/www/html/owncloud/data'
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
    restorecon '/var/www/html/owncloud/config'
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
    restorecon '/var/www/html/owncloud/apps'
  }
fi
true
%endif


%postun
# remove SELinux ownCloud label if not updating
[ $1 -eq 0 ] || exit 0
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
if [ -x /usr/sbin/sestatus ] ; then \
  sestatus | grep -E '^(SELinux status|Current).*(enforcing|permissive)' > /dev/null && { 
    semanage fcontext -l | grep '/var/www/owncloud/data' && {
      semanage fcontext -d -t httpd_sys_rw_content_t '/var/www/html/owncloud/data'
      restorecon '/var/www/html/owncloud/data'
    }
    semanage fcontext -l | grep '/var/www/html/owncloud/config' && {
      semanage fcontext -d -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
      restorecon '/var/www/html/owncloud/config'
    }
    semanage fcontext -l | grep '/var/www/html/owncloud/apps' && {
      semanage fcontext -d -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
      restorecon '/var/www/html/owncloud/apps'
    }
  }
fi
true
%endif


%clean
rm -rf "$RPM_BUILD_ROOT"

#%%config

%files
%defattr(0640,root,%{apache_group},0750)
%exclude %{apache_serverroot}/%{name}/3rdparty/PEAR*
%exclude %{apache_serverroot}/%{name}/3rdparty/System.php
%exclude %{apache_serverroot}/%{name}/3rdparty/XML/Parser.php

%dir %{apache_serverroot}/%{name}
%{apache_serverroot}/%{name}/3rdparty
%doc %{apache_serverroot}/%{name}/AUTHORS
%doc %{apache_serverroot}/%{name}/COPYING-AGPL
%{apache_serverroot}/%{name}/core
%{apache_serverroot}/%{name}/db_structure.xml
%{apache_serverroot}/%{name}/index.php
%{apache_serverroot}/%{name}/l10n
%{apache_serverroot}/%{name}/lib
%{apache_serverroot}/%{name}/ocs
%{apache_serverroot}/%{name}/public.php
%doc %{apache_serverroot}/%{name}/README*
%{apache_serverroot}/%{name}/remote.php
%{apache_serverroot}/%{name}/search
%{apache_serverroot}/%{name}/settings
%{apache_serverroot}/%{name}/status.php
%{apache_serverroot}/%{name}/themes
%{apache_serverroot}/%{name}/cron.php
%{apache_serverroot}/%{name}/.htaccess
%{apache_serverroot}/%{name}/robots.txt
%{apache_serverroot}/%{name}/index.html
%{apache_serverroot}/%{name}/console.php
%{apache_serverroot}/%{name}/occ
%{apache_serverroot}/%{name}/version.php

%defattr(-,%{apache_user},%{apache_group},0770)
%{apache_serverroot}/%{name}/data
# config can be chown-ed to root:www after the initial DB config is done.
%dir %{apache_serverroot}/%{name}/config
%dir %{apache_serverroot}/%{name}/apps

%defattr(0640,root,%{apache_group},0750)
%{apache_serverroot}/%{name}/apps/*
%{apache_serverroot}/%{name}/config/*

%config %attr(0644,root,root) %{apache_confdir}/owncloud.conf

%doc README README.SELinux

%files 3rdparty
%defattr(0640,root,%{apache_group},0750)
%{apache_serverroot}/%{name}/3rdparty/PEAR/
%{apache_serverroot}/%{name}/3rdparty/PEAR.php
%{apache_serverroot}/%{name}/3rdparty/PEAR5.php
%{apache_serverroot}/%{name}/3rdparty/PEAR-LICENSE
%{apache_serverroot}/%{name}/3rdparty/System.php
%{apache_serverroot}/%{name}/3rdparty/XML/Parser.php


%changelog