You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

179 lines
6.9 KiB

##
## nextcloud.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2020 OpenPKG Project <http://openpkg.org/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: nextcloud
Summary: Cloud Storage Service
URL: https://nextcloud.com/
Vendor: ownCloud Inc.
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: PLUS
Group: Web
License: AGPL
Version: 17.0.2
Release: 20191220
# package options
%option with_ldap no
# list of sources
Source0: http://download.nextcloud.com/server/releases/nextcloud-%{version}.zip
Source1: nextcloud-apache.conf
Source2: rc.nextcloud
Source3: nextcloud-config.php
Patch0: nextcloud.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101
PreReq: apache
PreReq: apache-php
PreReq: apache-php::with_json = yes
PreReq: apache-php::with_gd = yes
PreReq: apache-php::with_fileinfo = yes
PreReq: apache-php::with_sqlite = yes
PreReq: apache-php::with_curl = yes
PreReq: apache-php::with_json = yes
PreReq: apache-php::with_xml = yes
PreReq: apache-php::with_simplexml = yes
PreReq: apache-php::with_zip = yes
PreReq: apache-php::with_mbstring = yes
PreReq: apache-php::with_session = yes
PreReq: apache-php::with_ctype = yes
PreReq: apache-php::with_dom = yes
PreReq: apache-php::with_mhash = yes
PreReq: apache-php::with_iconv = yes
%if "%{with_ldap}" == "yes"
PreReq: apache-php::with_openldap = yes
%endif
%description
NextCloud enables universal access to files through the widely
implemented WebDAV standard, providing a platform to easily view
and sync contacts, calendars and bookmarks across devices while
supporting sharing, viewing and editing via the web interface.
Installation has minimal server requirements, doesn't need special
permissions and is quick. NextCloud is extendable via a simple,
powerful API for applications. NextCloud is a fork of OwnCloud.
%track
prog nextcloud = {
version = %{version}
url = https://nextcloud.org/install/
regex = nextcloud-(\d+\.\d+\.\d+)\.zip
}
%prep
%setup -q -c
%patch -p0
%build
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/nextcloud \
$RPM_BUILD_ROOT%{l_prefix}/lib/nextcloud \
$RPM_BUILD_ROOT%{l_prefix}/var/nextcloud/data \
$RPM_BUILD_ROOT%{l_prefix}/var/nextcloud/run \
$RPM_BUILD_ROOT%{l_prefix}/var/nextcloud/run/session \
$RPM_BUILD_ROOT%{l_prefix}/var/nextcloud/log \
$RPM_BUILD_ROOT%{l_prefix}/var/nextcloud/tmp
# install default ownCloud configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
-e "s;@l_version@;%{version};g" \
%{SOURCE nextcloud-config.php} \
$RPM_BUILD_ROOT%{l_prefix}/etc/nextcloud/config.php
# install default Apache webserver configuration
l_hostname=`%{l_shtool} echo -e %h`
l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
%{l_shtool} install -c -m 644 %{l_value -s -a} \
-e "s;@l_hostname@;$l_hostname;g" \
-e "s;@l_domainname@;$l_domainname;g" \
%{SOURCE nextcloud-apache.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/nextcloud/
# remove nasty files (containing whitespaces)
rm -f "nextcloud/core/skeleton/Nextcloud Manual.pdf"
rm -f "nextcloud/core/skeleton/Nextcloud intro.mp4"
rm -f "nextcloud/3rdparty/LICENSE INFO"
rm -f "nextcloud/3rdparty/rackspace/php-opencloud/docs/changelog/Upgrading to 1.7.0.md"
rm -rf "nextcloud/apps/gallery/build/documentation/reports/code coverage"
rm -f "nextcloud/apps/files_texteditor/css/DroidSansMono/Google Android License.txt"
rm -f "nextcloud/core/skeleton/Documents/Nextcloud Flyer.pdf"
rm -f "nextcloud/core/skeleton/Nextcloud Community.jpeg"
rm -f "nextcloud/apps/support/resources/Why the Nextcloud Subscription.pdf"
rm -f "nextcloud/core/skeleton/Documents/User Data Manifesto.pdf"
rm -f "nextcloud/core/skeleton/Photos/Nextcloud Community.jpg"
# remove empty directories
rm -rf nextcloud/config nextcloud/data
# move ownCloud program files into place
cp -rp nextcloud/.[a-z]* nextcloud/* \
$RPM_BUILD_ROOT%{l_prefix}/lib/nextcloud/
# link data and config directories to our location
( cd $RPM_BUILD_ROOT%{l_prefix}/lib/nextcloud
ln -s ../../var/nextcloud/data data
ln -s ../../etc/nextcloud config
) || exit $?
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.nextcloud} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/nextcloud' \
'%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/nextcloud/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/nextcloud/apps' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/nextcloud/.[a-z]*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/nextcloud/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/nextcloud/*/*'
%files -f files
%clean
%post
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} nextcloud status 2>/dev/null`
[ ".$nextcloud_active" = .yes ] && %{l_rc} nextcloud restart
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} nextcloud stop 2>/dev/null
rm -rf $RPM_INSTALL_PREFIX/var/nextcloud/data/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/nextcloud/log/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/nextcloud/run/*/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/nextcloud/run/* >/dev/null 2>&1 || true
exit 0