1 |
%define major_version 20 |
2 |
%define version %{major_version}.0.1 |
3 |
%define rel 2 |
4 |
|
5 |
%define prerel %{nil} |
6 |
%define name_root nextcloud |
7 |
|
8 |
%if "%{prerel}" != "%{nil}" |
9 |
%define lc_prerel %(echo %{prerel} | tr "A-Z" "a-z") |
10 |
%define release %mkrel 1.%{lc_prerel}.%{rel} |
11 |
%else |
12 |
%define release %mkrel %{rel} |
13 |
%endif |
14 |
|
15 |
# exclude PHP dependencies as long as their usage is not proven |
16 |
%define __requires_exclude_from ^%{_datadir}/.*$ |
17 |
%define __jar_repack %{nil} |
18 |
|
19 |
Summary: Open personal cloud |
20 |
Name: %{name_root} |
21 |
Version: %{version} |
22 |
Release: %{release} |
23 |
License: AGPLv3 |
24 |
Group: Networking/WWW |
25 |
Url: http://nextcloud.com |
26 |
Source0: https://download.nextcloud.com/server/releases/%{name_root}-%{version}%{?prerel}.tar.bz2 |
27 |
Source1: %{name_root}-httpd.conf |
28 |
Source2: %{name_root}-httpd.inc |
29 |
Source4: %{name_root}-mysql.txt |
30 |
Source5: %{name_root}-postgresql.txt |
31 |
Source7: %{name_root}-config.php |
32 |
Source8: %{name_root}-fpm.conf |
33 |
|
34 |
#patch for |
35 |
#https://github.com/nextcloud/server/pull/23606 |
36 |
Source10: https://raw.githubusercontent.com/nextcloud/server/master/lib/private/legacy/OC_Helper.php |
37 |
|
38 |
Requires: php-webinterface >= 3:7.2.0 |
39 |
Requires: php-curl >= 3:7.2.0 |
40 |
Requires: php-dom >= 3:7.2.0 |
41 |
Requires: php-exif >= 3:7.2.0 |
42 |
Requires: php-fileinfo >= 3:7.2.0 |
43 |
Requires: php-gd >= 3:7.2.0 |
44 |
Requires: php-iconv >= 3:7.2.0 |
45 |
Requires: php-imagick |
46 |
Recommends: php-intl >= 3:7.2.0 |
47 |
Requires: php-json >= 3:7.2.0 |
48 |
Requires: php-ldap >= 3:7.2.0 |
49 |
Requires: php-mbstring >= 3:7.2.0 |
50 |
Requires: php-openssl >= 3:7.2.0 |
51 |
Requires: php-pcre >= 3:7.2.0 |
52 |
Recommends: php-pcntl >= 3:7.2.0 |
53 |
Requires: php-pdo >= 3:7.2.0 |
54 |
Requires: php-session >= 3:7.2.0 |
55 |
Requires: php-simplexml >= 3:7.2.0 |
56 |
Requires: php-xmlwriter >= 3:7.2.0 |
57 |
Requires: php-zip >= 3:7.2.0 |
58 |
Requires: php-filter >= 3:7.2.0 |
59 |
Requires: %{name}-database = %{version}-%{release} |
60 |
Requires: openssl >= 1.0.2f |
61 |
Obsoletes: nextcloud17 <= 18.0.0.0 |
62 |
Obsoletes: nextcloud18 < %{version} |
63 |
BuildArch: noarch |
64 |
|
65 |
%description |
66 |
A personal cloud server which runs on you personal server |
67 |
and enables accessing your data from everywhere and sharing |
68 |
with other people. |
69 |
|
70 |
%package mysql |
71 |
Summary: MySQL database support for NextCloud |
72 |
Provides: %{name}-database = %{version}-%{release} |
73 |
Requires: %{name} = %{version}-%{release} |
74 |
# From getSupportedDatabases, mysql => pdo, mysql |
75 |
Requires: php-pdo_mysql >= 3:7.2.0 |
76 |
|
77 |
%description mysql |
78 |
This package ensures the necessary dependencies are in place for NextCloud to |
79 |
work with MySQL / MariaDB databases. It does not require a MySQL / MariaDB |
80 |
server to be installed, as you may well wish to use a remote database |
81 |
server. |
82 |
If you want the database to be on the same system as NextCloud itself, you must |
83 |
also install and enable a MySQL / MariaDB server package. See README.mysql for |
84 |
more details. |
85 |
|
86 |
%package postgresql |
87 |
Summary: PostgreSQL database support for NextCloud |
88 |
Provides: %{name}-database = %{version}-%{release} |
89 |
Requires: %{name} = %{version}-%{release} |
90 |
# From getSupportedDatabases, pgsql => function, pg_connect |
91 |
Requires: php-pdo_pgsql >= 3:7.2.0 |
92 |
|
93 |
%description postgresql |
94 |
This package ensures the necessary dependencies are in place for NextCloud to |
95 |
work with a PostgreSQL database. It does not require the PostgreSQL server |
96 |
package to be installed, as you may well wish to use a remote database |
97 |
server. |
98 |
If you want the database to be on the same system as NextCloud itself, you must |
99 |
also install and enable the PostgreSQL server package. See README.postgresql |
100 |
for more details. |
101 |
|
102 |
%package sqlite |
103 |
Summary: SQLite 3 database support for NextCloud |
104 |
Provides: %{name}-database = %{version}-%{release} |
105 |
Requires: %{name} = %{version}-%{release} |
106 |
# From getSupportedDatabases, pgsql => class, SQLite3 |
107 |
Requires: php-pdo_sqlite >= 3:7.2.0 |
108 |
Requires: php-pcre >= 3:7.2.0 |
109 |
|
110 |
%description sqlite |
111 |
This package ensures the necessary dependencies are in place for NextCloud to |
112 |
work with an SQLite 3 database stored on the local system. |
113 |
|
114 |
%prep |
115 |
%setup -q -n nextcloud |
116 |
cp %{SOURCE4} README.mysql |
117 |
cp %{SOURCE5} README.postgresql |
118 |
cp %{SOURCE10} lib/private/legacy/OC_Helper.php |
119 |
|
120 |
# drop upstream update notification app |
121 |
rm -rf apps/updatenotification |
122 |
# also remove the actual updater |
123 |
rm -rf updater |
124 |
|
125 |
%install |
126 |
install -d -m 755 %{buildroot}%{_datadir}/%{name_root} |
127 |
# create nextcloud datadir |
128 |
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name_root}/data |
129 |
# create writable app dir for appstore |
130 |
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name_root}/apps |
131 |
# create nextcloud sysconfdir |
132 |
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name_root} |
133 |
|
134 |
# install content |
135 |
for d in $(find . -mindepth 1 -maxdepth 1 -type d | grep -v config); do |
136 |
cp -a "$d" %{buildroot}%{_datadir}/%{name_root} |
137 |
done |
138 |
|
139 |
for f in {*.php,*.html,occ,robots.txt}; do |
140 |
install -p -m 644 "$f" %{buildroot}%{_datadir}/%{name_root} |
141 |
done |
142 |
|
143 |
# symlink config dir |
144 |
ln -sf %{_sysconfdir}/%{name_root} %{buildroot}%{_datadir}/%{name_root}/config |
145 |
|
146 |
# nextcloud looks for ca-bundle.crt in config dir |
147 |
ln -sf %{_sysconfdir}/pki/tls/certs/ca-bundle.crt %{buildroot}%{_sysconfdir}/%{name_root}/ca-bundle.crt |
148 |
|
149 |
# set default config |
150 |
install -p -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/%{name_root}/config.php |
151 |
|
152 |
install -D -m 644 %{SOURCE1} %{buildroot}%{webappconfdir}/%{name_root}.conf |
153 |
install -D -m 644 %{SOURCE2} %{buildroot}%{webappconfdir}/%{name_root}.inc |
154 |
install -D -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/php-fpm.d/%{name_root}.conf |
155 |
|
156 |
cat > %{buildroot}%{_datadir}/%{name_root}/.htaccess <<EOF |
157 |
# Version: %{version} |
158 |
EOF |
159 |
|
160 |
install -d -m 755 %{buildroot}%{_sysconfdir}/cron.d |
161 |
cat > %{buildroot}%{_sysconfdir}/cron.d/%{name_root} <<EOF |
162 |
# Run cron from to execute task even when no user connected |
163 |
*/15 * * * * apache /usr/bin/php -f /usr/share/nextcloud/cron.php |
164 |
EOF |
165 |
|
166 |
|
167 |
%pre |
168 |
# on update from previous release, move data directory from |
169 |
# %{_localstatedir}/lib/%{name} to %{_localstatedir}/lib/%{name}/data |
170 |
if [ $1 -gt 1 ] ; then |
171 |
if [ -d %{_localstatedir}/lib/%{name_root}/ -a ! -d %{_localstatedir}/lib/%{name_root}/data ]; then |
172 |
mv %{_localstatedir}/lib/%{name_root} %{_localstatedir}/lib/%{name_root}.tmp |
173 |
mkdir %{_localstatedir}/lib/%{name_root} |
174 |
mv %{_localstatedir}/lib/%{name_root}.tmp %{_localstatedir}/lib/%{name_root}/data |
175 |
fi |
176 |
fi |
177 |
|
178 |
%post |
179 |
touch '%{_sysconfdir}/%{name}/CAN_INSTALL' |
180 |
/usr/bin/chown apache:apache '%{_sysconfdir}/%{name}/CAN_INSTALL' |
181 |
|
182 |
%files |
183 |
%doc AUTHORS config/config.sample.php |
184 |
|
185 |
%dir %attr(-,apache,apache) %{_sysconfdir}/%{name_root} |
186 |
%config(noreplace) %attr(0600,apache,apache) %{_sysconfdir}/%{name_root}/config.php |
187 |
%{_sysconfdir}/%{name_root}/ca-bundle.crt |
188 |
|
189 |
%{_datadir}/%{name_root} |
190 |
|
191 |
%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name_root} |
192 |
%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name_root}/apps |
193 |
%dir %attr(0750,apache,apache) %{_localstatedir}/lib/%{name_root}/data |
194 |
|
195 |
%config(noreplace) %{webappconfdir}/nextcloud.conf |
196 |
%config(noreplace) %{webappconfdir}/nextcloud.inc |
197 |
%config(noreplace) %{_sysconfdir}/cron.d/%{name_root} |
198 |
%config(noreplace) %{_sysconfdir}/php-fpm.d/%{name_root}.conf |
199 |
|
200 |
%files mysql |
201 |
%doc README.mysql |
202 |
|
203 |
%files postgresql |
204 |
%doc README.postgresql |
205 |
|
206 |
%files sqlite |