APKBUILD 7.87 KB
Newer Older
Leonardo Arena's avatar
Leonardo Arena committed
1
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
2
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
Leonardo Arena's avatar
Leonardo Arena committed
3
pkgname=nextcloud
4
pkgver=13.0.11
5
pkgrel=0
Leonardo Arena's avatar
Leonardo Arena committed
6 7 8
pkgdesc="A safe home for all your data"
url="http://nextcloud.com"
arch="noarch"
9
license="AGPL-3.0-only"
Leonardo Arena's avatar
Leonardo Arena committed
10
_php=php7
11
_php_mods="-ctype -curl -dom -gd -fileinfo -iconv -json -mbstring -openssl
12
	-pcntl -posix -session -simplexml -xml -xmlreader -xmlwriter -zlib -zip"
13
depends="ca-certificates $_php ${_php_mods//-/$_php-}"
14
makedepends="xmlstarlet"
15 16
provides="$pkgname-dav=$pkgver-r$pkgrel
	$pkgname-files=$pkgver-r$pkgrel
17 18 19 20
	$pkgname-provisioning_api=$pkgver-r$pkgrel
	$pkgname-federatedfilesharing=$pkgver-r$pkgrel"
install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade
	$pkgname-initscript.post-install"
21
subpackages="$pkgname-doc $pkgname-initscript $pkgname-mysql $pkgname-pgsql $pkgname-sqlite
22
	$pkgname-default-apps:_default_apps"
Leonardo Arena's avatar
Leonardo Arena committed
23
source="https://download.nextcloud.com/server/releases/$pkgname-$pkgver.zip
24
	nextcloud10-dont-chmod.patch
25
	dont-update-htaccess.patch
26
	disable-integrity-check-as-default.patch
27
	app-encryption-info-add-mcrypt.patch
28
	iconv-ascii-translit-not-supported.patch
29
	use-external-docs-if-local-not-avail.patch
30

31 32
	$pkgname-config.php
	$pkgname.logrotate
33
	$pkgname.confd
34
	$pkgname.cron
35
	fpm-pool.conf
36
	occ
37
	"
38
options="!check"
39
pkgusers="nextcloud"
Leonardo Arena's avatar
Leonardo Arena committed
40
pkggroups="www-data"
41
builddir="$srcdir"/$pkgname
Leonardo Arena's avatar
Leonardo Arena committed
42

43
# List of bundled apps to separate into subpackages. Keep it in sync!
44 45
# Note: Don't add "files", "dav", and "provisioning_api" here, these should
# be always installed.
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
_apps="activity
	admin_audit
	comments
	encryption
	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
	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

80 81
# Directory for apps shipped with Nextcloud.
_appsdir="usr/share/webapps/$pkgname/apps"
Leonardo Arena's avatar
Leonardo Arena committed
82 83

package() {
84 85
	local basedir="var/lib/$pkgname"
	local datadir="$basedir/data"
86 87 88 89 90 91 92 93 94 95 96 97 98
	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

99 100 101
	# 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 \
102
		./$wwwdir/lib/private/Updater
103

104 105 106
	# Replace bundled CA bundle with ours.
	ln -sf /etc/ssl/certs/ca-certificates.crt ./$wwwdir/resources/config/ca-bundle.crt

107 108
	install -d -m 770 -o nextcloud -g www-data \
		./$confdir ./$datadir ./$basedir/apps
109 110
	install -d -m 775 -o nextcloud -g www-data \
		./var/log/$pkgname
111 112 113 114

	# 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
115

116 117 118 119
	mv ./$wwwdir/config/* ./$confdir/
	rm -r ./$wwwdir/config
	ln -s /$confdir ./$wwwdir/config

120 121 122
	mkdir -p ./usr/share/doc/$pkgname
	mv ./$wwwdir/core/doc ./usr/share/doc/$pkgname/core

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

126 127
	install -m 644 -D "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/$pkgname

128
	install -m 755 -D "$srcdir"/occ ./usr/bin/occ
129

130 131 132 133 134 135 136
	# 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 {} \;
137 138
}

139 140 141 142 143 144 145 146
doc() {
	default_doc

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

147 148
initscript() {
	pkgdesc="Init script that runs Nextcloud with php-fpm"
149
	depends="$pkgname $_php-fpm"
150 151 152 153 154 155

	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
156
	install -m 755 -D "$srcdir"/$pkgname.cron "$subpkgdir"/etc/periodic/15min/$pkgname
157 158 159 160 161 162 163

	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
}

Leonardo Arena's avatar
Leonardo Arena committed
164 165
pgsql() {
	pkgdesc="Nextcloud PostgreSQL support"
166
	depends="$pkgname $_php-pgsql $_php-pdo_pgsql"
167
	mkdir -p "$subpkgdir"
Leonardo Arena's avatar
Leonardo Arena committed
168 169 170 171
}

sqlite() {
	pkgdesc="Nextcloud SQLite support"
172
	depends="$pkgname $_php-sqlite3 $_php-pdo_sqlite"
173
	mkdir -p "$subpkgdir"
Leonardo Arena's avatar
Leonardo Arena committed
174 175 176 177
}

mysql() {
	pkgdesc="Nextcloud MySQL support"
178
	depends="$pkgname $_php-pdo_mysql"
179
	mkdir -p "$subpkgdir"
Leonardo Arena's avatar
Leonardo Arena committed
180 181
}

182 183
_default_apps() {
	pkgdesc="Nextcloud default apps"
184
	depends="$pkgname"
Leonardo Arena's avatar
Leonardo Arena committed
185

186 187 188 189 190
	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
Leonardo Arena's avatar
Leonardo Arena committed
191

192
	mkdir -p "$subpkgdir"
Leonardo Arena's avatar
Leonardo Arena committed
193 194
}

195
_package_app() {
196
	local appname="${subpkgname#$pkgname-}"
197 198 199 200 201 202 203
	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")
204
	local app_deps=""
205 206

	case "$appname" in
207 208 209
		files_sharing) app_deps="-federatedfilesharing";;

		# XXX: Provides/replaces for backward compatibility with <12.0.0-r2.
210 211 212 213 214 215 216 217 218
		files_pdfviewer | files_texteditor | files_videoplayer)
			provides="$pkgname-${appname#files_}"
			replaces="$provides"
		;;
		user_ldap)
			provides="$pkgname-ldap"
			replaces="$provides"
		;;
	esac
219

220 221
	depends="$pkgname $php_deps ${app_deps//-/$pkgname-}"

222
	mkdir -p "$subpkgdir"/$_appsdir
223
	mv "$pkgdir"/$_appsdir/$appname "$subpkgdir"/$_appsdir/
224 225
}

226
sha512sums="3ffbc7195b15fe902e257b7f0efe4109da61cf74b99bf772c0c868d0cc1c1a1d04067e66fd6207be6d125324e7c3718efdd4ead66d05becd151580e0c14d2f86  nextcloud-13.0.11.zip
227
9c20237c4952ff543171768160c17c3608cc43ad9592fecccaeb337787d566f039f27f30f118359dfff7db58cd12d811c05be15e5994efee57a9ed75787d71f5  nextcloud10-dont-chmod.patch
228
aef3c92497d738d6968e0f0b0d415b4953500db24ae14af41ef972665cf7eff00cb6c53dc953845fdbb389c3c965a75b8b14b9247513c05cf4130fe1cfc61731  dont-update-htaccess.patch
229
04783385ca35be9e8b895e91294b082cd2a1f50c4e17dc195901885ecd421db9a6fe45360d7eac623873ae4efad80b92f31ebde59f4ed76d832c8cac450dac85  disable-integrity-check-as-default.patch
230 231
d6f951cbcb7ca48beb88d77e02a8669677e87bc32189b1eb7e63edc29c293bd6e1ee471c37b622e6b38fd2baf6cf198c872f92b256ffab17c92c31a3a05b5aa0  app-encryption-info-add-mcrypt.patch
7d60ba2f1c012b0a1cded30f757b7ec0efe7fc4bfa7b5c6879f35eb80711ac1d5e6c894356346222a0de68b0808c99bac358aaae1c69124a855da2a98cdff6ec  iconv-ascii-translit-not-supported.patch
232
478f5cd7c5d30380ea619d3e8ec623217a06a09b27534266f00297545c7d276b068c5d984673eebc5676e8bac7f45112549498944ce3fa678ac8a69541d7c430  use-external-docs-if-local-not-avail.patch
233
5f73cd9399fa484ef15bd47e803c93381deffbc7699eceadbb5c27e43b20156806d74e5021a64d28f0165ef87b519e962780651711a37bceb9f0b04455dfdce1  nextcloud-config.php
234
f224d72799ee5819979089eb58978225454223bee597c938681a4f6279eb49297fe9250ac54ccf8bcb33ae262bce43d085affb77723492ee662263710d4008c9  nextcloud.logrotate
235
dcc57735d7d4af4a7ebbdd1186d301e51d2ae4675022aea6bf1111222dfa188a3a490ebd6e7c8a7ac30046cb7d93f81cec72a51acbc60d0c10b7fb64630c637a  nextcloud.confd
236
edb699ea6127b231793254115b334006c2d50a0d2ecc846188c3521ddffc3c0e19c5e2944f03cae81e6c645c859258380691081b1c522a22d40939b31db36e8a  nextcloud.cron
237 238
ee9073a6df4286cba2d1d855cf40863968f20677729b2c7848ab50a70d4915b8e84c957a850a03a707231256c11312e5792e7817dd50afbf73efe767fef2112d  fpm-pool.conf
959852e34f010e635470829d66713f3e22c47717ec2c6487759eed2b6aeff9fd1421fe0271d494a02781bd1c98beb2823583623ee2cf03057cd5db794627d6c2  occ"