aboutsummaryrefslogtreecommitdiffstats
path: root/community/nextcloud
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-06-23 01:12:19 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-06-25 02:42:47 +0200
commit56340e0c374f9f287da09df6dbf52894d2ea4861 (patch)
tree38ab315800769c98fb614ca62811f0b2c23d6bbf /community/nextcloud
parent4c0262e02aa02fdedae18155d3ca87aeebeec87f (diff)
downloadaports-56340e0c374f9f287da09df6dbf52894d2ea4861.tar.bz2
aports-56340e0c374f9f287da09df6dbf52894d2ea4861.tar.xz
community/nextcloud: move bundled apps to /usr/share
It's totally wrong to install pkg's files into /var/lib and make them writable by webserver! Moreover when Nextcloud supports multiple app paths. So we use two apps locations: * /usr/share/webapps/nextcloud/apps - for apps installed by apk, * /var/lib/nextcloud/apps - for apps installed from AppStore. BTW Fedora uses the same approach.
Diffstat (limited to 'community/nextcloud')
-rw-r--r--community/nextcloud/APKBUILD27
-rw-r--r--community/nextcloud/nextcloud-config.php17
-rw-r--r--community/nextcloud/nextcloud.post-upgrade19
-rw-r--r--community/nextcloud/nextcloud.pre-upgrade10
4 files changed, 57 insertions, 16 deletions
diff --git a/community/nextcloud/APKBUILD b/community/nextcloud/APKBUILD
index 0a38c44b47..2cb2d4979d 100644
--- a/community/nextcloud/APKBUILD
+++ b/community/nextcloud/APKBUILD
@@ -13,7 +13,7 @@ depends="$_php ${_php_mods//-/$_php-}"
_apps="-activity -encryption -firstrunwizard -gallery -ldap -logreader -mysql
-notifications -password_policy -pdfviewer -pgsql -sqlite -texteditor
-videoplayer"
-install="$pkgname.pre-install"
+install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-initscript ${_apps//-/$pkgname-}"
source="https://download.nextcloud.com/server/releases/$pkgname-$pkgver.zip
nextcloud10-dont-chmod-config.patch
@@ -26,11 +26,12 @@ pkgusers="nextcloud"
pkggroups="www-data"
builddir="$srcdir"/$pkgname
-_basedir="var/lib/$pkgname"
-_appsdir="$_basedir/apps"
+# Directory for apps shipped with Nextcloud.
+_appsdir="usr/share/webapps/$pkgname/apps"
package() {
- local datadir="$_basedir/data"
+ local basedir="var/lib/$pkgname"
+ local datadir="$basedir/data"
local wwwdir="usr/share/webapps/$pkgname"
local confdir="etc/$pkgname"
@@ -44,7 +45,12 @@ package() {
chmod 664 ./$wwwdir/.htaccess \
./$wwwdir/.user.ini
- install -d -m 770 -o nextcloud -g www-data ./$confdir ./$datadir
+ 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
@@ -53,12 +59,6 @@ package() {
install -m 660 -o nextcloud -g www-data \
"$srcdir"/$pkgname-config.php ./$confdir/config.php
- mkdir -p ./${_appsdir%/*}
- mv ./$wwwdir/apps ./$_appsdir
- chown -R nextcloud:www-data ./$_appsdir
- chmod -R 770 ./$_appsdir
- ln -s /$_appsdir ./$wwwdir/apps
-
install -m644 -D "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/$pkgname
install -m775 -o nextcloud -g www-data -d ./var/log/$pkgname
@@ -179,14 +179,11 @@ _mv_app() {
pkg) mv "$pkgdir"/$_appsdir/$dirname "$subpkgdir"/$_appsdir/;;
src) mv "$srcdir"/$dirname "$subpkgdir"/$_appsdir/$appname;;
esac
-
- chown -R :www-data "$subpkgdir"/$_appsdir
- chmod 770 "$subpkgdir"/$_appsdir
}
sha512sums="0e409eedbcc0f4e1652085c3e384db373858b0cc116c70361a4d066a08afbd6e75792332f95d08773cbed78c1520532886268249d514f2da70acb3ba120420d5 nextcloud-12.0.0.zip
a12a73a38bc009d3307ce97bb32fc62ac93e125a77a3d36b31c9d2212953fa17bd5c31f819e0759a0645b1c285817b067143b0b9c3673ce4ab3043fae426a67c nextcloud10-dont-chmod-config.patch
-dca5ba4d6e09e762fd1b14e8b253eed0cd26ec28ae7f413b149e64dcdd7409c68ae08a8a38c531ba874d38ebe6a6b70e190a05509260143d9305d66a68eae10a nextcloud-config.php
+7b54660441fccb60f204a98a6f55dc02ba99a4af159e590a9b380f1d7683b856bfa4c9fc9ee14603cc0923a134e5191bc713b9428d7a8b52017b93aa3c915792 nextcloud-config.php
f224d72799ee5819979089eb58978225454223bee597c938681a4f6279eb49297fe9250ac54ccf8bcb33ae262bce43d085affb77723492ee662263710d4008c9 nextcloud.logrotate
35cf156839215113b5d8fb8842b4c1e19a50be3c16be7048879fdd808674e4875dbacf3e2dd884fd182258595b7a137d7d3c2dc602a7ff5613c8b65fae0abe67 nextcloud.confd
b5cdccdffb35e868ec1acb15ec2849cc1c2a00f6064ad21eb591b9694e84df4576f03248f5e814000a48c38096a2a1588dfc79be66691415f2f4ef3b4105d032 fpm-pool.conf"
diff --git a/community/nextcloud/nextcloud-config.php b/community/nextcloud/nextcloud-config.php
index 957df795f3..09a74cf41b 100644
--- a/community/nextcloud/nextcloud-config.php
+++ b/community/nextcloud/nextcloud-config.php
@@ -1,5 +1,20 @@
<?php
$CONFIG = array (
'datadirectory' => '/var/lib/nextcloud/data',
- 'logfile' => '/var/log/nextcloud/nextcloud.log'
+ 'logfile' => '/var/log/nextcloud/nextcloud.log',
+ 'apps_paths' => array (
+ // Read-only location for apps shipped with Nextcloud and installed by apk.
+ 0 => array (
+ 'path' => '/usr/share/webapps/nextcloud/apps',
+ 'url' => '/apps',
+ 'writable' => false,
+ ),
+ // Writable location for apps installed from AppStore.
+ 1 => array (
+ 'path' => '/var/lib/nextcloud/apps',
+ 'url' => '/apps-appstore',
+ 'writable' => true,
+ ),
+ ),
+ 'installed' => false,
);
diff --git a/community/nextcloud/nextcloud.post-upgrade b/community/nextcloud/nextcloud.post-upgrade
new file mode 100644
index 0000000000..657f17e0b1
--- /dev/null
+++ b/community/nextcloud/nextcloud.post-upgrade
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+ver_old="$2"
+
+if [ $(apk version -t "$ver_old" '12.0.0-r2') = '<' ] \
+ && [ "$(ls -A /var/lib/nextcloud/apps)" ]
+then
+ cat >&2 <<-EOF
+ *
+ * Nextcloud's bundled apps have been moved from /var/lib/nextcloud/apps
+ * to /usr/share/webapps/nextcloud/apps. Only apps installed from App Store
+ * should be stored in /var/lib/nextcloud/apps.
+ *
+ * It seems that you have installed some apps from App Store, so you have to
+ * add /var/lib/nextcloud/apps to your apps_paths. Copy "apps_paths" key
+ * from /etc/nextcloud/config.php.apk-new to your config.php.
+ *
+ EOF
+fi
diff --git a/community/nextcloud/nextcloud.pre-upgrade b/community/nextcloud/nextcloud.pre-upgrade
new file mode 100644
index 0000000000..f444e78f49
--- /dev/null
+++ b/community/nextcloud/nextcloud.pre-upgrade
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+ver_old="$2"
+apps_link='/usr/share/webapps/nextcloud/apps'
+
+# Remove apps symlink before replacing files to avoid losing installed apps.
+# This is a workaround for some issue in apk.
+if [ $(apk version -t "$ver_old" '12.0.0-r2') = '<' ] && [ -L "$apps_link" ]; then
+ rm "$apps_link"
+fi