mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
[enh] Upgrade the package to ship Nextcloud v9.0.51
This commit is contained in:
parent
85dff2bf2a
commit
456c77ec68
11 changed files with 121 additions and 118 deletions
31
README.md
31
README.md
|
@ -1,38 +1,43 @@
|
||||||
ownCloud for YunoHost
|
Nextcloud for YunoHost
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
[ownCloud](https://owncloud.org) gives you freedom and control over your
|
**This is a work-in-progress Nextcloud package for YunoHost.**
|
||||||
own data. A personal cloud which run on your own server. With owncloud
|
|
||||||
|
[Nextcloud](https://nextcloud.com) gives you freedom and control over your
|
||||||
|
own data. A personal cloud which run on your own server. With Nextcloud
|
||||||
you can synchronize your files over your devices.
|
you can synchronize your files over your devices.
|
||||||
|
|
||||||
**Shipped version:** 9.0.2
|
**Shipped version:** 9.0.51
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
* Manage the upgrade from ownCloud
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
In addition to ownCloud core features, the following are made available with
|
In addition to Nextcloud core features, the following are made available with
|
||||||
this package:
|
this package:
|
||||||
|
|
||||||
* Integrate with YunoHost users and SSO - i.e. logout button
|
* Integrate with YunoHost users and SSO - i.e. logout button
|
||||||
* Allow one user to be the administrator (set at the installation)
|
* Allow one user to be the administrator (set at the installation)
|
||||||
* Optionally access the user home folder from ownCloud files (set at the installation)
|
* Optionally access the user home folder from Nextcloud files (set at the installation)
|
||||||
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's
|
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's
|
||||||
not already served - i.e. by Baïkal
|
not already served - i.e. by Baïkal
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
To integrate the logout button to the SSO, we have to patch ownCloud sources.
|
To integrate the logout button to the SSO, we have to patch Nextcloud sources.
|
||||||
Since this upstream [pull-request](https://github.com/owncloud/core/pull/24642)
|
In waiting an upstream integration, the source code integrity checking has been
|
||||||
will not be integrated, the code source integrity checking has been disabled to
|
disabled to prevent the warning message.
|
||||||
prevent the warning message.
|
|
||||||
|
|
||||||
Also, note we made the choice to disable third-parties applications at the
|
Also, note we made the choice to disable third-parties applications at the
|
||||||
upgrade. It allows to prevent an unstable - and sometimes broken - ownCloud
|
upgrade. It allows to prevent an unstable - and sometimes broken - Nextcloud
|
||||||
installation. You will just have to manually activate them after the upgrade.
|
installation. You will just have to manually activate them after the upgrade.
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* Report a bug: https://dev.yunohost.org/projects/apps/issues
|
* Report a bug: https://dev.yunohost.org/projects/apps/issues
|
||||||
* ownCloud website: https://owncloud.org/
|
* Nextcloud website: https://nextcloud.com/
|
||||||
* YunoHost website: https://yunohost.org/
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
{"user":{"all":{"\/$user\/files\/Home":{"class":"\\OC\\Files\\Storage\\Local","options":{"datadir":"\/home\/$user"}}}}}
|
|
|
@ -3,12 +3,12 @@ Priority: optional
|
||||||
Homepage: https://owncloud.org/
|
Homepage: https://owncloud.org/
|
||||||
Standards-Version: 3.9.2
|
Standards-Version: 3.9.2
|
||||||
|
|
||||||
Package: owncloud-deps
|
Package: nextcloud-deps
|
||||||
Version: 9.0.0-1
|
Version: 9.0-1
|
||||||
Depends: acl, php5-cli, php5-apcu, tar, smbclient
|
Depends: acl, php5-cli, php5-apcu, tar, smbclient
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Description: meta package for owncloud dependencies
|
Description: meta package for nextcloud dependencies
|
||||||
ownCloud gives you universal access to your files through a web
|
Nextcloud gives you universal access to your files through a web
|
||||||
interface or WebDAV. It also provides a platform to easily view & sync
|
interface or WebDAV. It also provides a platform to easily view & sync
|
||||||
your contacts, calendars and bookmarks across all your devices and
|
your contacts, calendars and bookmarks across all your devices and
|
||||||
enables basic editing right on the web.
|
enables basic editing right on the web.
|
|
@ -1,26 +1,26 @@
|
||||||
{
|
{
|
||||||
"package_format": 1,
|
"package_format": 1,
|
||||||
"id": "owncloud",
|
"id": "nextcloud",
|
||||||
"name": "OwnCloud",
|
"name": "Nextcloud",
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Sync & share your files, pictures, music, contacts, calendars, and much more!",
|
"en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms",
|
||||||
"fr": "Synchronisez et partagez vos fichiers, images, musiques, contacts, calendriers, et bien plus !"
|
"fr": "Accédez et partagez vos fichiers, calendriers, contacts, mail et bien plus depuis n'importe quel appareil, selon vos conditions"
|
||||||
},
|
},
|
||||||
"url": "https://owncloud.org",
|
"url": "https://nextcloud.com",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"version": "9.0.2",
|
"version": "9.0.51",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "jerome",
|
"name": "jerome",
|
||||||
"email": "jerome@yunohost.org"
|
"email": "jerome@yunohost.org"
|
||||||
},
|
},
|
||||||
"multi_instance": "true",
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php5-fpm",
|
"php5-fpm",
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.3.16"
|
"yunohost": ">= 2.4.0"
|
||||||
},
|
},
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install" : [
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a domain for ownCloud",
|
"en": "Choose a domain for Nextcloud",
|
||||||
"fr": "Choisissez un domaine pour ownCloud"
|
"fr": "Choisissez un domaine pour Nextcloud"
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
|
@ -37,18 +37,18 @@
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a path for ownCloud",
|
"en": "Choose a path for Nextcloud",
|
||||||
"fr": "Choisissez un chemin pour ownCloud"
|
"fr": "Choisissez un chemin pour Nextcloud"
|
||||||
},
|
},
|
||||||
"example": "/owncloud",
|
"example": "/nextcloud",
|
||||||
"default": "/owncloud"
|
"default": "/nextcloud"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the ownCloud administrator (must be an existing YunoHost user)",
|
"en": "Choose the Nextcloud administrator (must be an existing YunoHost user)",
|
||||||
"fr": "Choisissez l'administrateur d'ownCloud (doit être un utilisateur YunoHost déjà existant)"
|
"fr": "Choisissez l'administrateur de Nextcloud (doit être un utilisateur YunoHost existant)"
|
||||||
},
|
},
|
||||||
"example": "homer"
|
"example": "homer"
|
||||||
},
|
},
|
||||||
|
@ -56,8 +56,8 @@
|
||||||
"name": "user_home",
|
"name": "user_home",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Access the users home folder from ownCloud?",
|
"en": "Access the users home folder from Nextcloud?",
|
||||||
"fr": "Accéder au dossier personnel des utilisateurs depuis ownCloud ?"
|
"fr": "Accéder au dossier personnel des utilisateurs depuis Nextcloud ?"
|
||||||
},
|
},
|
||||||
"default": false
|
"default": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
# Common variables
|
# Common variables
|
||||||
#
|
#
|
||||||
|
|
||||||
APPNAME="owncloud"
|
APPNAME="nextcloud"
|
||||||
|
|
||||||
# ownCloud version
|
# Nextcloud version
|
||||||
VERSION="9.0.2"
|
VERSION="9.0.51"
|
||||||
|
|
||||||
# Package name for ownCloud dependencies
|
# Package name for Nextcloud dependencies
|
||||||
DEPS_PKG_NAME="owncloud-deps"
|
DEPS_PKG_NAME="nextcloud-deps"
|
||||||
|
|
||||||
# Remote URL to fetch ownCloud tarball
|
# Remote URL to fetch Nextcloud tarball
|
||||||
OWNCLOUD_SOURCE_URL="https://download.owncloud.org/community/owncloud-${VERSION}.tar.bz2"
|
NEXTCLOUD_SOURCE_URL="https://download.nextcloud.com/server/releases/nextcloud-${VERSION}.tar.bz2"
|
||||||
|
|
||||||
# Remote URL to fetch ownCloud tarball checksum
|
# Remote URL to fetch Nextcloud tarball checksum
|
||||||
OWNCLOUD_SOURCE_SHA256="845c43fe981fa0fd07fc3708f41f1ea15ecb11c2a15c65a4de191fc85b237c74"
|
NEXTCLOUD_SOURCE_SHA256="e085a20e9d85d238239e7e9f714325aee1f0fe949dcace2dbc2e7abaf3041e78"
|
||||||
|
|
||||||
# App package root directory should be the parent folder
|
# App package root directory should be the parent folder
|
||||||
PKGDIR=$(cd ../; pwd)
|
PKGDIR=$(cd ../; pwd)
|
||||||
|
@ -23,28 +23,28 @@ PKGDIR=$(cd ../; pwd)
|
||||||
# Common helpers
|
# Common helpers
|
||||||
#
|
#
|
||||||
|
|
||||||
# Download and extract ownCloud sources to the given directory
|
# Download and extract Nextcloud sources to the given directory
|
||||||
# usage: extract_owncloud DESTDIR [AS_USER]
|
# usage: extract_nextcloud DESTDIR [AS_USER]
|
||||||
extract_owncloud() {
|
extract_nextcloud() {
|
||||||
local DESTDIR=$1
|
local DESTDIR=$1
|
||||||
local AS_USER=${2:-admin}
|
local AS_USER=${2:-admin}
|
||||||
|
|
||||||
# retrieve and extract Roundcube tarball
|
# retrieve and extract Roundcube tarball
|
||||||
oc_tarball="/tmp/owncloud.tar.bz2"
|
nc_tarball="/tmp/nextcloud.tar.bz2"
|
||||||
rm -f "$oc_tarball"
|
rm -f "$nc_tarball"
|
||||||
wget -q -O "$oc_tarball" "$OWNCLOUD_SOURCE_URL" \
|
wget -q -O "$nc_tarball" "$NEXTCLOUD_SOURCE_URL" \
|
||||||
|| ynh_die "Unable to download ownCloud tarball"
|
|| ynh_die "Unable to download Nextcloud tarball"
|
||||||
echo "$OWNCLOUD_SOURCE_SHA256 $oc_tarball" | sha256sum -c >/dev/null \
|
echo "$NEXTCLOUD_SOURCE_SHA256 $nc_tarball" | sha256sum -c >/dev/null \
|
||||||
|| ynh_die "Invalid checksum of downloaded tarball"
|
|| ynh_die "Invalid checksum of downloaded tarball"
|
||||||
exec_as "$AS_USER" tar xjf "$oc_tarball" -C "$DESTDIR" --strip-components 1 \
|
exec_as "$AS_USER" tar xjf "$nc_tarball" -C "$DESTDIR" --strip-components 1 \
|
||||||
|| ynh_die "Unable to extract ownCloud tarball"
|
|| ynh_die "Unable to extract Nextcloud tarball"
|
||||||
rm -f "$oc_tarball"
|
rm -f "$nc_tarball"
|
||||||
|
|
||||||
# apply patches
|
# apply patches
|
||||||
(cd "$DESTDIR" \
|
(cd "$DESTDIR" \
|
||||||
&& for p in ${PKGDIR}/patches/*.patch; do \
|
&& for p in ${PKGDIR}/patches/*.patch; do \
|
||||||
exec_as "$AS_USER" patch -p1 < $p; done) \
|
exec_as "$AS_USER" patch -p1 < $p; done) \
|
||||||
|| ynh_die "Unable to apply patches to ownCloud"
|
|| ynh_die "Unable to apply patches to Nextcloud"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute a command as another user
|
# Execute a command as another user
|
||||||
|
|
|
@ -10,7 +10,7 @@ dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
@ -36,4 +36,4 @@ mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./db.sql
|
||||||
|
|
||||||
# Copy the control file of the dependency package
|
# Copy the control file of the dependency package
|
||||||
# FIXME: find a way to retrieve package name from _common.sh?
|
# FIXME: find a way to retrieve package name from _common.sh?
|
||||||
dpkg-query -s owncloud-deps > ./owncloud-deps.control
|
dpkg-query -s nextcloud-deps > ./nextcloud-deps.control
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Get multi-instances specific variables
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=${2%/}
|
path=${2%/}
|
||||||
|
@ -12,17 +9,18 @@ admin=$3
|
||||||
user_home=$4
|
user_home=$4
|
||||||
|
|
||||||
# Load common variables
|
# Load common variables
|
||||||
. ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Set app specific variables
|
# Set app specific variables
|
||||||
|
app=$APPNAME
|
||||||
dbname=$app
|
dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# TODO: Check domain/path availability with app helper
|
# TODO: Check domain/path availability with app helper
|
||||||
sudo yunohost app checkurl $domain$path -a $app \
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
|| ynh_die "The path ${domain}${path} is not available for app installation."
|
|| ynh_die "The path ${domain}${path} is not available for app installation."
|
||||||
|
|
||||||
# Check user parameter
|
# Check user parameter
|
||||||
|
@ -47,9 +45,9 @@ ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \
|
||||||
dbpass=$(ynh_string_random)
|
dbpass=$(ynh_string_random)
|
||||||
|
|
||||||
# Initialize database
|
# Initialize database
|
||||||
ynh_mysql_create_db $dbname $dbuser $dbpass
|
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
||||||
|
|
||||||
# Create a system account for ownCloud
|
# Create a system account for Nextcloud
|
||||||
sudo useradd -c "$app system account" \
|
sudo useradd -c "$app system account" \
|
||||||
-d /var/lib/$app --system --user-group $app \
|
-d /var/lib/$app --system --user-group $app \
|
||||||
|| ynh_die "Unable to create $app system account"
|
|| ynh_die "Unable to create $app system account"
|
||||||
|
@ -60,11 +58,11 @@ sed -i "s@#GROUP#@${app}@g" ../hooks/post_user_create
|
||||||
# Create app folders
|
# Create app folders
|
||||||
sudo mkdir -p "$DESTDIR" "$DATADIR"
|
sudo mkdir -p "$DESTDIR" "$DATADIR"
|
||||||
|
|
||||||
# Copy ownCloud configuration file
|
# Copy Nextcloud configuration file
|
||||||
oc_conf="${DESTDIR}/config.json"
|
nc_conf="${DESTDIR}/config.json"
|
||||||
sed -i "s@#DOMAIN#@${domain}@g" ../conf/config.json
|
sed -i "s@#DOMAIN#@${domain}@g" ../conf/config.json
|
||||||
sed -i "s@#DATADIR#@${DATADIR}@g" ../conf/config.json
|
sed -i "s@#DATADIR#@${DATADIR}@g" ../conf/config.json
|
||||||
sudo cp ../conf/config.json "$oc_conf"
|
sudo cp ../conf/config.json "$nc_conf"
|
||||||
|
|
||||||
# Copy and set nginx configuration
|
# Copy and set nginx configuration
|
||||||
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
@ -99,22 +97,22 @@ _exec_occ() {
|
||||||
# Set app folders ownership
|
# Set app folders ownership
|
||||||
sudo chown -R $app: "$DESTDIR" "$DATADIR"
|
sudo chown -R $app: "$DESTDIR" "$DATADIR"
|
||||||
|
|
||||||
# Retrieve ownCloud sources
|
# Retrieve Nextcloud sources
|
||||||
extract_owncloud "$DESTDIR" "$app"
|
extract_nextcloud "$DESTDIR" "$app"
|
||||||
|
|
||||||
# Install ownCloud using a temporary admin user
|
# Install Nextcloud using a temporary admin user
|
||||||
_exec_occ maintenance:install \
|
_exec_occ maintenance:install \
|
||||||
--database "mysql" --database-name "$dbname" \
|
--database "mysql" --database-name "$dbname" \
|
||||||
--database-user "$dbuser" --database-pass "$dbpass" \
|
--database-user "$dbuser" --database-pass "$dbpass" \
|
||||||
--admin-user "admin" --admin-pass "$(ynh_string_random 6)" \
|
--admin-user "admin" --admin-pass "$(ynh_string_random 6)" \
|
||||||
--data-dir "$DATADIR" \
|
--data-dir "$DATADIR" \
|
||||||
|| ynh_die "Unable to install ownCloud"
|
|| ynh_die "Unable to install Nextcloud"
|
||||||
|
|
||||||
# Enable plugins and set ownCloud configuration
|
# Enable plugins and set Nextcloud configuration
|
||||||
_exec_occ app:enable user_ldap
|
_exec_occ app:enable user_ldap
|
||||||
_exec_occ ldap:create-empty-config
|
_exec_occ ldap:create-empty-config
|
||||||
_exec_occ config:import "$oc_conf"
|
_exec_occ config:import "$nc_conf"
|
||||||
sudo rm -f "$oc_conf"
|
sudo rm -f "$nc_conf"
|
||||||
|
|
||||||
# Check LDAP configuratio to see if everything worked well
|
# Check LDAP configuratio to see if everything worked well
|
||||||
_exec_occ ldap:test-config \'\' \
|
_exec_occ ldap:test-config \'\' \
|
||||||
|
@ -138,12 +136,12 @@ _exec_occ config:system:get logout_url >/dev/null 2>&1 \
|
||||||
\" >> ${DESTDIR}/config/config.php" -- $app
|
\" >> ${DESTDIR}/config/config.php" -- $app
|
||||||
|
|
||||||
# Set the user as admin and delete admin user
|
# Set the user as admin and delete admin user
|
||||||
ynh_mysql_connect_as $dbuser $dbpass $dbname \
|
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" \
|
||||||
<<< "INSERT INTO oc_group_user VALUES ('admin','$admin');"
|
<<< "INSERT INTO oc_group_user VALUES ('admin','$admin');"
|
||||||
_exec_occ user:delete admin
|
_exec_occ user:delete admin
|
||||||
|
|
||||||
# Iterate over users to extend their home folder permissions - for the external
|
# Iterate over users to extend their home folder permissions - for the external
|
||||||
# storage plugin usage - and create relevant ownCloud directories
|
# storage plugin usage - and create relevant Nextcloud directories
|
||||||
for u in $(ynh_user_list); do
|
for u in $(ynh_user_list); do
|
||||||
sudo mkdir -p "${DATADIR}/${u}"
|
sudo mkdir -p "${DATADIR}/${u}"
|
||||||
sudo setfacl -m g:$app:rwx "/home/$u" || true
|
sudo setfacl -m g:$app:rwx "/home/$u" || true
|
||||||
|
@ -173,8 +171,8 @@ sudo service nginx reload || true
|
||||||
|
|
||||||
# Add cron job
|
# Add cron job
|
||||||
cron_path="/etc/cron.d/$app"
|
cron_path="/etc/cron.d/$app"
|
||||||
sed -i "s@#USER#@${app}@g" ../conf/owncloud.cron
|
sed -i "s@#USER#@${app}@g" ../conf/nextcloud.cron
|
||||||
sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/owncloud.cron
|
sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/nextcloud.cron
|
||||||
sudo cp ../conf/owncloud.cron "$cron_path"
|
sudo cp ../conf/nextcloud.cron "$cron_path"
|
||||||
sudo chmod 644 "$cron_path"
|
sudo chmod 644 "$cron_path"
|
||||||
_exec_occ background:cron
|
_exec_occ background:cron
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Get multi-instances specific variables
|
# Load common variables and helpers
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
source ./_common.sh
|
||||||
|
|
||||||
# Set app specific variables
|
# Set app specific variables
|
||||||
|
app=$APPNAME
|
||||||
dbname=$app
|
dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
|
|
||||||
# Load common variables and helpers
|
|
||||||
. ./_common.sh
|
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Remove cron job
|
# Remove cron job
|
||||||
# TODO: Ensure that cron job is not running
|
# TODO: Ensure that cron job is not running
|
||||||
|
@ -22,7 +20,7 @@ ynh_mysql_drop_db "$dbname" 2>/dev/null || true
|
||||||
ynh_mysql_drop_user "$dbuser" 2>/dev/null || true
|
ynh_mysql_drop_user "$dbuser" 2>/dev/null || true
|
||||||
|
|
||||||
# Retrieve domain from app settings
|
# Retrieve domain from app settings
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
|
||||||
# Delete app directory and configurations
|
# Delete app directory and configurations
|
||||||
sudo rm -rf "/var/www/${app}"
|
sudo rm -rf "/var/www/${app}"
|
||||||
|
|
|
@ -10,15 +10,15 @@ dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve old app settings
|
# Retrieve old app settings
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
path=$(ynh_app_setting_get $app path)
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
dbpass=$(ynh_app_setting_get $app mysqlpwd)
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||||
|
|
||||||
# TODO: Check domain/path availability with app helper
|
# TODO: Check domain/path availability with app helper
|
||||||
sudo yunohost app checkurl $domain$path -a $app \
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
|| ynh_die "The path ${domain}${path} is not available for app installation."
|
|| ynh_die "The path ${domain}${path} is not available for app installation."
|
||||||
|
|
||||||
# Check destination directory
|
# Check destination directory
|
||||||
|
@ -41,10 +41,10 @@ phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
|
||||||
You should safely delete it before restoring this app."
|
You should safely delete it before restoring this app."
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
ynh_package_install_from_equivs ./owncloud-deps.control \
|
ynh_package_install_from_equivs ./nextcloud-deps.control \
|
||||||
|| ynh_die "Unable to install dependencies"
|
|| ynh_die "Unable to install dependencies"
|
||||||
|
|
||||||
# Create a system account for ownCloud
|
# Create a system account for Nextcloud
|
||||||
sudo useradd -c "$app system account" \
|
sudo useradd -c "$app system account" \
|
||||||
-d /var/lib/$app --system --user-group $app \
|
-d /var/lib/$app --system --user-group $app \
|
||||||
|| ynh_die "Unable to create $app system account"
|
|| ynh_die "Unable to create $app system account"
|
||||||
|
@ -55,11 +55,11 @@ sudo mkdir -p "$DATADIR"
|
||||||
sudo cp -a ./data/. "$DATADIR"
|
sudo cp -a ./data/. "$DATADIR"
|
||||||
|
|
||||||
# Create and restore the database
|
# Create and restore the database
|
||||||
ynh_mysql_create_db $dbname $dbuser $dbpass
|
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
||||||
ynh_mysql_connect_as $dbuser $dbpass $dbname < ./db.sql
|
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql
|
||||||
|
|
||||||
# Iterate over users to extend their home folder permissions - for the external
|
# Iterate over users to extend their home folder permissions - for the external
|
||||||
# storage plugin usage - and create relevant ownCloud directories
|
# storage plugin usage - and create relevant Nextcloud directories
|
||||||
for u in $(ynh_user_list); do
|
for u in $(ynh_user_list); do
|
||||||
sudo mkdir -p "${DATADIR}/${u}"
|
sudo mkdir -p "${DATADIR}/${u}"
|
||||||
sudo setfacl -m g:$app:rwx "/home/$u" || true
|
sudo setfacl -m g:$app:rwx "/home/$u" || true
|
||||||
|
|
|
@ -2,18 +2,21 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Get multi-instances specific variables
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
# Load common variables and helpers
|
# Load common variables and helpers
|
||||||
. ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Set app specific variables
|
# Set app specific variables
|
||||||
|
app=$APPNAME
|
||||||
dbname=$app
|
dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
|
|
||||||
|
# FIXME: Upgrading from ownCloud is not supported yet,
|
||||||
|
# see http://blog.jospoortvliet.com/2016/06/migrating-to-nextcloud-9.html
|
||||||
|
[[ $YNH_APP_INSTANCE_NAME == $app ]] || ynh_die \
|
||||||
|
"Upgrading from ownCloud to Nextcloud is not supported yet."
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
@ -76,12 +79,12 @@ _exec_occ() {
|
||||||
exec_occ "$DESTDIR" "$app" $@
|
exec_occ "$DESTDIR" "$app" $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Retrieve new ownCloud sources in a temporary directory
|
# Retrieve new Nextcloud sources in a temporary directory
|
||||||
TMPDIR=$(ynh_mkdir_tmp)
|
TMPDIR=$(ynh_mkdir_tmp)
|
||||||
extract_owncloud "$TMPDIR"
|
extract_nextcloud "$TMPDIR"
|
||||||
|
|
||||||
# Copy ownCloud configuration file
|
# Copy Nextcloud configuration file
|
||||||
oc_conf="${DESTDIR}/config.json"
|
nc_conf="${DESTDIR}/config.json"
|
||||||
sed -i "s@#DOMAIN#@${domain}@g" ../conf/config.json
|
sed -i "s@#DOMAIN#@${domain}@g" ../conf/config.json
|
||||||
sed -i "s@#DATADIR#@${DATADIR}@g" ../conf/config.json
|
sed -i "s@#DATADIR#@${DATADIR}@g" ../conf/config.json
|
||||||
sudo cp ../conf/config.json "${TMPDIR}/config.json"
|
sudo cp ../conf/config.json "${TMPDIR}/config.json"
|
||||||
|
@ -103,16 +106,16 @@ sudo mv "$TMPDIR" "$DESTDIR"
|
||||||
# Set app folders ownership
|
# Set app folders ownership
|
||||||
sudo chown -R $app: "$DESTDIR" "$DATADIR"
|
sudo chown -R $app: "$DESTDIR" "$DATADIR"
|
||||||
|
|
||||||
# Upgrade ownCloud (SUCCESS = 0, UP_TO_DATE = 3)
|
# Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3)
|
||||||
# TODO: Restore old directory in case of failure?
|
# TODO: Restore old directory in case of failure?
|
||||||
_exec_occ maintenance:mode --off
|
_exec_occ maintenance:mode --off
|
||||||
_exec_occ upgrade \
|
_exec_occ upgrade \
|
||||||
|| ([[ $? -eq 3 ]] || ynh_die "Unable to upgrade ownCloud")
|
|| ([[ $? -eq 3 ]] || ynh_die "Unable to upgrade Nextcloud")
|
||||||
|
|
||||||
# Enable plugins and set ownCloud configuration
|
# Enable plugins and set Nextcloud configuration
|
||||||
_exec_occ app:enable user_ldap
|
_exec_occ app:enable user_ldap
|
||||||
_exec_occ config:import "$oc_conf"
|
_exec_occ config:import "$nc_conf"
|
||||||
sudo rm -f "$oc_conf"
|
sudo rm -f "$nc_conf"
|
||||||
|
|
||||||
# Guess user_home value if empty
|
# Guess user_home value if empty
|
||||||
if [[ -z "${user_home:-}" ]]; then
|
if [[ -z "${user_home:-}" ]]; then
|
||||||
|
@ -143,7 +146,7 @@ _exec_occ config:system:get logout_url >/dev/null 2>&1 \
|
||||||
\" >> ${DESTDIR}/config/config.php" -- $app
|
\" >> ${DESTDIR}/config/config.php" -- $app
|
||||||
|
|
||||||
# Iterate over users to extend their home folder permissions - for the external
|
# Iterate over users to extend their home folder permissions - for the external
|
||||||
# storage plugin usage - and create relevant ownCloud directories
|
# storage plugin usage - and create relevant Nextcloud directories
|
||||||
for u in $(ynh_user_list); do
|
for u in $(ynh_user_list); do
|
||||||
sudo mkdir -p "${DATADIR}/${u}"
|
sudo mkdir -p "${DATADIR}/${u}"
|
||||||
sudo setfacl -m g:$app:rwx "/home/$u" || true
|
sudo setfacl -m g:$app:rwx "/home/$u" || true
|
||||||
|
@ -168,12 +171,12 @@ sudo service nginx reload || true
|
||||||
|
|
||||||
# Add cron job
|
# Add cron job
|
||||||
cron_path="/etc/cron.d/$app"
|
cron_path="/etc/cron.d/$app"
|
||||||
sed -i "s@#USER#@${app}@g" ../conf/owncloud.cron
|
sed -i "s@#USER#@${app}@g" ../conf/nextcloud.cron
|
||||||
sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/owncloud.cron
|
sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/nextcloud.cron
|
||||||
sudo cp ../conf/owncloud.cron "$cron_path"
|
sudo cp ../conf/nextcloud.cron "$cron_path"
|
||||||
sudo chmod 644 "$cron_path"
|
sudo chmod 644 "$cron_path"
|
||||||
_exec_occ background:cron
|
_exec_occ background:cron
|
||||||
|
|
||||||
# Warn about possible disabled apps
|
# Warn about possible disabled apps
|
||||||
echo "Note that if you've installed some third-parties ownCloud applications, \
|
echo "Note that if you've installed some third-parties Nextcloud applications, \
|
||||||
they are probably disabled and you'll have to manually activate them again." >&2
|
they are probably disabled and you'll have to manually activate them again." >&2
|
||||||
|
|
Loading…
Add table
Reference in a new issue