summaryrefslogtreecommitdiff
path: root/user/nextcloud/APKBUILD
blob: d5f62c610930480ac1bd44ed110eaad975743c7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Max Rees <maxcrees@me.com>
pkgname=nextcloud
pkgver=17.0.5
pkgrel=0
pkgdesc="Self-hosted file sync and groupware server"
url="https://nextcloud.com"
arch="noarch"
options="!check"  # No test suite.
license="AGPL-3.0+ AND AGPL-3.0-only AND MIT AND Apache-2.0 AND (MIT OR GPL-2.0-only) AND BSD-3-Clause AND (Apache-2.0 OR GPL-2.0-only) AND GPL-3.0+ AND BSD-2-Clause AND PHP-3.0 AND (Apache-2.0 OR MPL-2.0)"
depends="
	ca-certificates
	openssl
	php7
	php7-ctype
	php7-curl
	php7-dom
	php7-fileinfo
	php7-gd
	php7-iconv
	php7-intl
	php7-json
	php7-mbstring
	php7-openssl
	php7-pcntl
	php7-pdo
	php7-posix
	php7-session
	php7-simplexml
	php7-xml
	php7-xmlreader
	php7-xmlwriter
	php7-zip
	$pkgname-sqlite

	!$pkgname-files_texteditor
	!$pkgname-user_external
"
makedepends="libxml2-utils"
install="$pkgname.pre-install $pkgname.pre-upgrade
	$pkgname-initscript.post-install"
pkgusers="nextcloud"
pkggroups="www-data"
subpackages="$pkgname-doc $pkgname-initscript $pkgname-mysql $pkgname-pgsql
	$pkgname-sqlite $pkgname-default-apps:_default_apps"
source="https://download.nextcloud.com/server/releases/$pkgname-$pkgver.zip
	dont-chmod.patch
	dont-update-htaccess.patch
	disable-integrity-check-as-default.patch
	iconv-ascii-translit-not-supported.patch
	use-external-docs-if-local-not-avail.patch

	$pkgname-config.php
	$pkgname.logrotate
	$pkgname.confd
	$pkgname.cron
	fpm-pool.conf
	occ
	"
builddir="$srcdir/$pkgname"

# $_bundled_apps are included in the main `nextcloud' package - it can't
# work without them. This can be checked against core/shipped.json's
# "alwaysEnabled" entries.
#
# $_apps are separated into subpackages.
#
# `accessibility' & `support' are still bundled for backwards compatibility.
_bundled_apps="accessibility
	cloud_federation_api
	dav
	federatedfilesharing
	files
	lookup_server_connector
	oauth2
	provisioning_api
	support
	twofactor_backupcodes
	workflowengine
	"
for _i in $_bundled_apps; do
	provides="$provides $pkgname-$_i=$pkgver-r$pkgrel"
done
_apps="activity
	admin_audit
	comments
	encryption
	federation
	files_external
	files_pdfviewer
	files_rightclick
	files_sharing
	files_trashbin
	files_versions
	files_videoplayer
	firstrunwizard
	gallery
	logreader
	nextcloud_announcements
	notifications
	password_policy
	privacy
	recommendations
	serverinfo
	sharebymail
	survey_client
	systemtags
	text
	theming
	user_ldap
	viewer
	"
for _i in $_apps; do
	subpackages="$subpackages $pkgname-$_i:_package_app"
done

# Directory for apps shipped with Nextcloud.
_appsdir="usr/share/webapps/$pkgname/apps"

package() {
	_basedir="var/lib/$pkgname"
	_datadir="$_basedir/data"
	_wwwdir="usr/share/webapps/$pkgname"
	_confdir="etc/$pkgname"

	mkdir -p "$pkgdir/${_wwwdir%/*}"
	cp -a "$builddir" "$pkgdir/$_wwwdir"

	chmod +x "$pkgdir/$_wwwdir/occ"
	chmod 664 "$pkgdir/$_wwwdir/.htaccess" "$pkgdir/$_wwwdir/.user.ini"

	# Let's not ship upstream's 'updatenotification' app and updater, which
	# has zero chance of working and a big chance of blowing things up.
	rm -r "$pkgdir/$_wwwdir/apps/updatenotification" \
		"$pkgdir/$_wwwdir/lib/private/Updater"

	# Replace bundled CA bundle with ours.
	ln -sf /etc/ssl/certs/ca-certificates.crt \
		"$pkgdir/$_wwwdir/resources/config/ca-bundle.crt"

	install -dm 770 -o nextcloud -g www-data \
		"$pkgdir/$_confdir" "$pkgdir/$_datadir" "$pkgdir/$_basedir/appstore"
	install -dm 775 -o nextcloud -g www-data "$pkgdir/var/log/$pkgname"

	# Create symlink from web root to site-apps, so web server can find
	# assets w/o explicit configuration for this layout.
	ln -s "/$_basedir/appstore" "$pkgdir/$_wwwdir/appstore"

	mv "$pkgdir/$_wwwdir/config"/* "$pkgdir/$_confdir/"
	rm -r "$pkgdir/$_wwwdir/config"
	ln -s "/$_confdir" "$pkgdir/$_wwwdir/config"

	mkdir -p "$pkgdir/usr/share/doc/$pkgname"
	mv "$pkgdir/$_wwwdir/core/doc" "$pkgdir/usr/share/doc/$pkgname/core"

	install -m 660 -o nextcloud -g www-data \
		"$srcdir/$pkgname-config.php" "$pkgdir/$_confdir/config.php"

	install -Dm 644 "$srcdir/$pkgname.logrotate" "$pkgdir/etc/logrotate.d/$pkgname"
	install -Dm 755 "$srcdir/occ" "$pkgdir/usr/bin/occ"

	install -dm 700 -o nextcloud "$pkgdir/var/log/nextcloud"

	# Clean some unnecessary files.
	find "$pkgdir" -name '.gitignore' -delete \
		-o -name '.bower.json' -delete \
		-o -name 'README*' -delete \
		-o -name 'CHANGELOG*' -delete \
		-o -name 'CONTRIBUTING*' -delete
	find . -name '.github' -type d -prune -exec rm -r {} \;
}

doc() {
	default_doc

	_target="$subpkgdir/usr/share/webapps/$pkgname/core/doc"
	mkdir -p "${_target%/*}"
	ln -s "/usr/share/doc/$pkgname/core" "$_target"
}

initscript() {
	pkgdesc="Init script that runs Nextcloud with php-fpm"
	depends="$pkgname=$pkgver-r$pkgrel php7-fpm"

	install -Dm 644 "$srcdir/fpm-pool.conf" "$subpkgdir/etc/php/php-fpm.d/$pkgname.conf"
	install -Dm 644 "$srcdir/$pkgname.confd" "$subpkgdir/etc/conf.d/$pkgname"
	install -Dm 755 "$srcdir/$pkgname.cron" "$subpkgdir/etc/periodic/15min/$pkgname"

	mkdir -p "$subpkgdir/etc/init.d"
	ln -s php-fpm "$subpkgdir/etc/init.d/$pkgname"

	install -dm 700 -o nextcloud "$subpkgdir/var/tmp/$pkgname"
}

pgsql() {
	pkgdesc="Nextcloud PostgreSQL support"
	depends="$pkgname=$pkgver-r$pkgrel php7-pgsql php7-pdo_pgsql"
	mkdir -p "$subpkgdir"
}

sqlite() {
	pkgdesc="Nextcloud SQLite support"
	depends="$pkgname=$pkgver-r$pkgrel php7-sqlite3 php7-pdo_sqlite"
	mkdir -p "$subpkgdir"
}

mysql() {
	pkgdesc="Nextcloud MySQL support"
	depends="$pkgname=$pkgver-r$pkgrel php7-pdo_mysql"
	mkdir -p "$subpkgdir"
}

_default_apps() {
	pkgdesc="Nextcloud default apps"
	depends="$pkgname=$pkgver-r$pkgrel"

	for _path in $pkgdir/$_appsdir/*; do
		if grep -q '<default_enable\s*/>' "$_path/appinfo/info.xml"; then
			depends="$depends $pkgname-${_path##*/}"
		fi
		if ! list_has "${_path##*/}" $_apps \
				&& ! list_has "${_path##*/}" $_bundled_apps; then
			warning "Maybe new app: nextcloud-${_path##*/}"
		fi
	done

	mkdir -p "$subpkgdir"
}

_package_app() {
	_appname="${subpkgname#$pkgname-}"
	_appinfo="$pkgdir/$_appsdir/$_appname/appinfo/info.xml"

	_name="$(xmllint --xpath '//info/name/text()' "$_appinfo" 2>/dev/null)"
	pkgdesc="Nextcloud ${_name:-$_appname} app"
	_php_deps="$(xmllint --xpath 'info/dependencies/lib/text()' \
		"$_appinfo" 2>/dev/null | sed 's/^/php7-/')"

	case "$_appname" in
	files_external) _php_deps="$_php_deps php7-ftp";;
	# TODO: add php7-imap, php7-smbclient
	esac

	case "$_appname" in
	# Announcements are delivered via the notifications pane
	nextcloud_announcements) app_deps="$pkgname-notifications";;
	esac

	depends="$pkgname=$pkgver-r$pkgrel $_php_deps $app_deps"

	mkdir -p "$subpkgdir/$_appsdir"
	mv "$pkgdir/$_appsdir/$_appname" "$subpkgdir/$_appsdir/"
}

sha512sums="c23cc36ba7f1a203422485e90d7284e399282406f5672b6c82c345a9dea3908d9c135621d391eb91a03f5a1e42a233bea9cd82efe2089be38d259619e3dbe0f9  nextcloud-17.0.5.zip
3336c2f534de1e380d64bb87f07dcaeb617db5b7bb9446ed845e78be917c1c87eb6f7da71a6b4382198d977e21e550b3165d0b276b07b68a0a569a383766c75d  dont-chmod.patch
aef3c92497d738d6968e0f0b0d415b4953500db24ae14af41ef972665cf7eff00cb6c53dc953845fdbb389c3c965a75b8b14b9247513c05cf4130fe1cfc61731  dont-update-htaccess.patch
d2100a837fef1eeae5f706650ab4c985d9e00f61efa5526ef76c7c1f5811c3906eb6c3c13c151eff9677a0c303faab64411a5a84d6792728bc520d2c618d7d5b  disable-integrity-check-as-default.patch
de1b433c2fb2582b599cb25e718e454fc4b93543a5a60eee39a03bcccf35d281594611395bdebe02319bedd9a894507eef97010ebdfca381e0f1a09df283d375  iconv-ascii-translit-not-supported.patch
478f5cd7c5d30380ea619d3e8ec623217a06a09b27534266f00297545c7d276b068c5d984673eebc5676e8bac7f45112549498944ce3fa678ac8a69541d7c430  use-external-docs-if-local-not-avail.patch
4d01c89d5fd86190fb3bd6a5ca97bc623ec55d92cbf030c18c5811d711cea557485d334a6588e458eea4e0b3ad82f4defd7cb5a9d4f393ce4d5b32abf45db596  nextcloud-config.php
7388458a9e8b7afd3d3269718306410ffa59c3c23da4bef367a4d7f6d2570136fae9dd421b19c1441e7ffb15a5405e18bb5da67b1a15f9f45e8b98d3fda532ba  nextcloud.logrotate
dcc57735d7d4af4a7ebbdd1186d301e51d2ae4675022aea6bf1111222dfa188a3a490ebd6e7c8a7ac30046cb7d93f81cec72a51acbc60d0c10b7fb64630c637a  nextcloud.confd
921b0e5f087f24e705dce62c078dea4d2f524c40a746ed7b19f1cff3405b9ea489c10a6dbcea87be6068f575be565b77b02c9f2c3ae6a7fb85367dbe3b7300c5  nextcloud.cron
b829ed942916660065dd1030f9f35fa2f8c45a36dc791417108761c15b081777c302f305fd6490ea47d0ae41b8589c8d62e01e0f163105bd6b29fd3bed36ddcd  fpm-pool.conf
959852e34f010e635470829d66713f3e22c47717ec2c6487759eed2b6aeff9fd1421fe0271d494a02781bd1c98beb2823583623ee2cf03057cd5db794627d6c2  occ"