aboutsummaryrefslogtreecommitdiffstats
path: root/community/nextcloud/APKBUILD
blob: ee1f3a9c4de50aea26d6c394222baad66d2d384a (plain)
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
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=nextcloud
pkgver=12.0.0
pkgrel=4
pkgdesc="A safe home for all your data"
url="http://nextcloud.com"
arch="noarch"
license="AGPL"
_php=php7
_php_mods="-ctype -curl -dom -gd -fileinfo -iconv -json -mbstring -openssl
	-posix -session -simplexml -xml -xmlreader -xmlwriter -zlib -zip"
depends="$_php ${_php_mods//-/$_php-}"
makedepends="xmlstarlet"
install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade"
subpackages="$pkgname-initscript $pkgname-mysql $pkgname-pgsql $pkgname-sqlite
	$pkgname-default-apps:_default_apps"
source="https://download.nextcloud.com/server/releases/$pkgname-$pkgver.zip
	nextcloud10-dont-chmod-config.patch
	dont-update-htaccess.patch
	disable-integrity-check-as-default.patch
	app-encryption-info-add-mcrypt.patch
	$pkgname-config.php
	$pkgname.logrotate
	$pkgname.confd
	$pkgname.cron
	fpm-pool.conf"
options="!check"
pkgusers="nextcloud"
pkggroups="www-data"
builddir="$srcdir"/$pkgname

# List of bundled apps to separate into subpackages. Keep it in sync!
# Note: Don't add "files" and "dav" here, these should be always installed.
_apps="activity
	admin_audit
	comments
	encryption
	federatedfilesharing
	federation
	files_external
	files_pdfviewer
	files_sharing
	files_texteditor
	files_trashbin
	files_versions
	files_videoplayer
	firstrunwizard
	gallery
	logreader
	lookup_server_connector
	nextcloud_announcements
	notifications
	oauth2
	password_policy
	provisioning_api
	serverinfo
	sharebymail
	survey_client
	systemtags
	theming
	twofactor_backupcodes
	user_external
	user_ldap
	workflowengine
	"
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() {
	local basedir="var/lib/$pkgname"
	local datadir="$basedir/data"
	local wwwdir="usr/share/webapps/$pkgname"
	local confdir="etc/$pkgname"

	mkdir -p "$pkgdir"
	cd "$pkgdir"

	mkdir -p ./${wwwdir%/*}
	cp -a "$builddir" ./$wwwdir

	chmod +x ./$wwwdir/occ
	chmod 664 ./$wwwdir/.htaccess \
		./$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 ./$wwwdir/apps/updatenotification \
		./$wwwdir/updater

	install -d -m 770 -o nextcloud -g www-data \
		./$confdir ./$datadir ./$basedir/apps

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

	mv ./$wwwdir/config/* ./$confdir/
	rm -r ./$wwwdir/config
	ln -s /$confdir ./$wwwdir/config

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

	install -m644 -D "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/$pkgname
	install -m775 -o nextcloud -g www-data -d ./var/log/$pkgname

	# Clean some unnecessary files.
	find . -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 {} \;
}

initscript() {
	pkgdesc="Init script that runs Nextcloud with php-fpm"
	depends="$pkgname $_php-fpm"
	install="$subpkgname.post-install"

	local confdir="$subpkgdir/etc/$_php/php-fpm.d"
	local fpm_name="php-fpm${_php#php}"

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

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

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

pgsql() {
	pkgdesc="Nextcloud PostgreSQL support"
	depends="$pkgname $_php-pgsql $_php-pdo_pgsql"
	mkdir -p "$subpkgdir"
}

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

mysql() {
	pkgdesc="Nextcloud MySQL support"
	depends="$pkgname $_php-pdo_mysql"
	mkdir -p "$subpkgdir"
}

_default_apps() {
	pkgdesc="Nextcloud default apps"
	depends="$pkgname"

	local path; for path in "$pkgdir"/$_appsdir/*; do
		if grep -q '<default_enable\s*/>' "$path"/appinfo/info.xml; then
			depends="$depends $pkgname-${path##*/}"
		fi
	done

	mkdir -p "$subpkgdir"
}

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

	local name=$(xmlstarlet sel -t -v 'info/name/text()' "$appinfo")
	pkgdesc="Nextcloud ${name:-$appname} app"

	local php_deps=$(xmlstarlet sel -t -v 'info/dependencies/lib/text()' "$appinfo" \
		| xargs -r -n1 printf "$_php-%s\n")
	depends="$pkgname $php_deps"

	# XXX: Provides/replaces for backward compatibility with <12.0.0-r2.
	case "$appname" in
		files_pdfviewer | files_texteditor | files_videoplayer)
			provides="$pkgname-${appname#files_}"
			replaces="$provides"
		;;
		user_ldap)
			provides="$pkgname-ldap"
			replaces="$provides"
		;;
	esac

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

sha512sums="0e409eedbcc0f4e1652085c3e384db373858b0cc116c70361a4d066a08afbd6e75792332f95d08773cbed78c1520532886268249d514f2da70acb3ba120420d5  nextcloud-12.0.0.zip
a12a73a38bc009d3307ce97bb32fc62ac93e125a77a3d36b31c9d2212953fa17bd5c31f819e0759a0645b1c285817b067143b0b9c3673ce4ab3043fae426a67c  nextcloud10-dont-chmod-config.patch
ec3921d4d463ed82be0be073af8064048a20f638424d1d39ab46db4252036e87ef2614570be91a5cef0c25c6bcaaf1a2725d2468bdb4a0fbee2b504a4dd0fbc8  dont-update-htaccess.patch
04783385ca35be9e8b895e91294b082cd2a1f50c4e17dc195901885ecd421db9a6fe45360d7eac623873ae4efad80b92f31ebde59f4ed76d832c8cac450dac85  disable-integrity-check-as-default.patch
8d3cb1436aa79f1ac0a7b4b3370fcfb5c50dbe811e631cabcb8170fb80da5967a88a15bc39cd04eaccffb3177bdf90fcba2a512e28e034e16d6bc9b445d2d137  app-encryption-info-add-mcrypt.patch
89c941e2719629ee633421c4c75b55026c1a0a6b255e7f1f2c14612c10325045051b16dc5f17975af4a2a34ec187008de2eb15a53ac4cd06d26a5cbbd79fb73a  nextcloud-config.php
f224d72799ee5819979089eb58978225454223bee597c938681a4f6279eb49297fe9250ac54ccf8bcb33ae262bce43d085affb77723492ee662263710d4008c9  nextcloud.logrotate
35cf156839215113b5d8fb8842b4c1e19a50be3c16be7048879fdd808674e4875dbacf3e2dd884fd182258595b7a137d7d3c2dc602a7ff5613c8b65fae0abe67  nextcloud.confd
edb699ea6127b231793254115b334006c2d50a0d2ecc846188c3521ddffc3c0e19c5e2944f03cae81e6c645c859258380691081b1c522a22d40939b31db36e8a  nextcloud.cron
ebe88e451de5dc84ee8bbcd9af48e2ceae4807546b9c069cf15ecc73e2c408a6e8c7502870f7b45a2e5e0632fc7dec878cad24c1d3a20ff3b812067dd7b07de8  fpm-pool.conf"