From 456c77ec68841d7c199892871687218b75739a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Thu, 30 Jun 2016 21:53:11 +0200 Subject: [PATCH] [enh] Upgrade the package to ship Nextcloud v9.0.51 --- README.md | 31 +++++++------ conf/mount.json | 1 - ...ud-deps.control => nextcloud-deps.control} | 8 ++-- conf/{owncloud.cron => nextcloud.cron} | 0 manifest.json | 36 +++++++-------- scripts/_common.sh | 42 +++++++++--------- scripts/backup | 4 +- scripts/install | 44 +++++++++---------- scripts/remove | 12 +++-- scripts/restore | 20 ++++----- scripts/upgrade | 41 +++++++++-------- 11 files changed, 121 insertions(+), 118 deletions(-) delete mode 100644 conf/mount.json rename conf/{owncloud-deps.control => nextcloud-deps.control} (72%) rename conf/{owncloud.cron => nextcloud.cron} (100%) diff --git a/README.md b/README.md index 46053a0..2f0c5a1 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,43 @@ -ownCloud for YunoHost +Nextcloud for YunoHost --------------------- -[ownCloud](https://owncloud.org) gives you freedom and control over your -own data. A personal cloud which run on your own server. With owncloud +**This is a work-in-progress Nextcloud package for YunoHost.** + +[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. -**Shipped version:** 9.0.2 +**Shipped version:** 9.0.51 -![](https://github.com/owncloud/screenshots/blob/master/files/sidebar_1.png) +![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png) + +## TODO + + * Manage the upgrade from ownCloud ## 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: * Integrate with YunoHost users and SSO - i.e. logout button * 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 not already served - i.e. by Baïkal ## Limitations -To integrate the logout button to the SSO, we have to patch ownCloud sources. -Since this upstream [pull-request](https://github.com/owncloud/core/pull/24642) -will not be integrated, the code source integrity checking has been disabled to -prevent the warning message. +To integrate the logout button to the SSO, we have to patch Nextcloud sources. +In waiting an upstream integration, the source code integrity checking has been +disabled to prevent the warning message. 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. ## Links * 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/ diff --git a/conf/mount.json b/conf/mount.json deleted file mode 100644 index a80f940..0000000 --- a/conf/mount.json +++ /dev/null @@ -1 +0,0 @@ -{"user":{"all":{"\/$user\/files\/Home":{"class":"\\OC\\Files\\Storage\\Local","options":{"datadir":"\/home\/$user"}}}}} diff --git a/conf/owncloud-deps.control b/conf/nextcloud-deps.control similarity index 72% rename from conf/owncloud-deps.control rename to conf/nextcloud-deps.control index 82d5258..107f28b 100644 --- a/conf/owncloud-deps.control +++ b/conf/nextcloud-deps.control @@ -3,12 +3,12 @@ Priority: optional Homepage: https://owncloud.org/ Standards-Version: 3.9.2 -Package: owncloud-deps -Version: 9.0.0-1 +Package: nextcloud-deps +Version: 9.0-1 Depends: acl, php5-cli, php5-apcu, tar, smbclient Architecture: all -Description: meta package for owncloud dependencies - ownCloud gives you universal access to your files through a web +Description: meta package for nextcloud dependencies + Nextcloud gives you universal access to your files through a web interface or WebDAV. It also provides a platform to easily view & sync your contacts, calendars and bookmarks across all your devices and enables basic editing right on the web. diff --git a/conf/owncloud.cron b/conf/nextcloud.cron similarity index 100% rename from conf/owncloud.cron rename to conf/nextcloud.cron diff --git a/manifest.json b/manifest.json index b6219e2..04566e5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,26 +1,26 @@ { "package_format": 1, - "id": "owncloud", - "name": "OwnCloud", + "id": "nextcloud", + "name": "Nextcloud", "description": { - "en": "Sync & share your files, pictures, music, contacts, calendars, and much more!", - "fr": "Synchronisez et partagez vos fichiers, images, musiques, contacts, calendriers, et bien plus !" + "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", + "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", - "version": "9.0.2", + "version": "9.0.51", "maintainer": { "name": "jerome", "email": "jerome@yunohost.org" }, - "multi_instance": "true", + "multi_instance": false, "services": [ "nginx", "php5-fpm", "mysql" ], "requirements": { - "yunohost": ">= 2.3.16" + "yunohost": ">= 2.4.0" }, "arguments": { "install" : [ @@ -28,8 +28,8 @@ "name": "domain", "type": "domain", "ask": { - "en": "Choose a domain for ownCloud", - "fr": "Choisissez un domaine pour ownCloud" + "en": "Choose a domain for Nextcloud", + "fr": "Choisissez un domaine pour Nextcloud" }, "example": "domain.org" }, @@ -37,18 +37,18 @@ "name": "path", "type": "path", "ask": { - "en": "Choose a path for ownCloud", - "fr": "Choisissez un chemin pour ownCloud" + "en": "Choose a path for Nextcloud", + "fr": "Choisissez un chemin pour Nextcloud" }, - "example": "/owncloud", - "default": "/owncloud" + "example": "/nextcloud", + "default": "/nextcloud" }, { "name": "admin", "type": "user", "ask": { - "en": "Choose the ownCloud administrator (must be an existing YunoHost user)", - "fr": "Choisissez l'administrateur d'ownCloud (doit être un utilisateur YunoHost déjà existant)" + "en": "Choose the Nextcloud administrator (must be an existing YunoHost user)", + "fr": "Choisissez l'administrateur de Nextcloud (doit être un utilisateur YunoHost existant)" }, "example": "homer" }, @@ -56,8 +56,8 @@ "name": "user_home", "type": "boolean", "ask": { - "en": "Access the users home folder from ownCloud?", - "fr": "Accéder au dossier personnel des utilisateurs depuis ownCloud ?" + "en": "Access the users home folder from Nextcloud?", + "fr": "Accéder au dossier personnel des utilisateurs depuis Nextcloud ?" }, "default": false } diff --git a/scripts/_common.sh b/scripts/_common.sh index f028266..5688891 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -2,19 +2,19 @@ # Common variables # -APPNAME="owncloud" +APPNAME="nextcloud" -# ownCloud version -VERSION="9.0.2" +# Nextcloud version +VERSION="9.0.51" -# Package name for ownCloud dependencies -DEPS_PKG_NAME="owncloud-deps" +# Package name for Nextcloud dependencies +DEPS_PKG_NAME="nextcloud-deps" -# Remote URL to fetch ownCloud tarball -OWNCLOUD_SOURCE_URL="https://download.owncloud.org/community/owncloud-${VERSION}.tar.bz2" +# Remote URL to fetch Nextcloud tarball +NEXTCLOUD_SOURCE_URL="https://download.nextcloud.com/server/releases/nextcloud-${VERSION}.tar.bz2" -# Remote URL to fetch ownCloud tarball checksum -OWNCLOUD_SOURCE_SHA256="845c43fe981fa0fd07fc3708f41f1ea15ecb11c2a15c65a4de191fc85b237c74" +# Remote URL to fetch Nextcloud tarball checksum +NEXTCLOUD_SOURCE_SHA256="e085a20e9d85d238239e7e9f714325aee1f0fe949dcace2dbc2e7abaf3041e78" # App package root directory should be the parent folder PKGDIR=$(cd ../; pwd) @@ -23,28 +23,28 @@ PKGDIR=$(cd ../; pwd) # Common helpers # -# Download and extract ownCloud sources to the given directory -# usage: extract_owncloud DESTDIR [AS_USER] -extract_owncloud() { +# Download and extract Nextcloud sources to the given directory +# usage: extract_nextcloud DESTDIR [AS_USER] +extract_nextcloud() { local DESTDIR=$1 local AS_USER=${2:-admin} # retrieve and extract Roundcube tarball - oc_tarball="/tmp/owncloud.tar.bz2" - rm -f "$oc_tarball" - wget -q -O "$oc_tarball" "$OWNCLOUD_SOURCE_URL" \ - || ynh_die "Unable to download ownCloud tarball" - echo "$OWNCLOUD_SOURCE_SHA256 $oc_tarball" | sha256sum -c >/dev/null \ + nc_tarball="/tmp/nextcloud.tar.bz2" + rm -f "$nc_tarball" + wget -q -O "$nc_tarball" "$NEXTCLOUD_SOURCE_URL" \ + || ynh_die "Unable to download Nextcloud tarball" + echo "$NEXTCLOUD_SOURCE_SHA256 $nc_tarball" | sha256sum -c >/dev/null \ || ynh_die "Invalid checksum of downloaded tarball" - exec_as "$AS_USER" tar xjf "$oc_tarball" -C "$DESTDIR" --strip-components 1 \ - || ynh_die "Unable to extract ownCloud tarball" - rm -f "$oc_tarball" + exec_as "$AS_USER" tar xjf "$nc_tarball" -C "$DESTDIR" --strip-components 1 \ + || ynh_die "Unable to extract Nextcloud tarball" + rm -f "$nc_tarball" # apply patches (cd "$DESTDIR" \ && for p in ${PKGDIR}/patches/*.patch; do \ 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 diff --git a/scripts/backup b/scripts/backup index 81606b8..8a35241 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,7 +10,7 @@ dbname=$app dbuser=$app # Source app helpers -. /usr/share/yunohost/helpers +source /usr/share/yunohost/helpers # Retrieve app settings 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 # 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 diff --git a/scripts/install b/scripts/install index 6e18111..1913afe 100755 --- a/scripts/install +++ b/scripts/install @@ -2,9 +2,6 @@ set -eu -# Get multi-instances specific variables -app=$YNH_APP_INSTANCE_NAME - # Retrieve arguments domain=$1 path=${2%/} @@ -12,17 +9,18 @@ admin=$3 user_home=$4 # Load common variables -. ./_common.sh +source ./_common.sh # Set app specific variables +app=$APPNAME dbname=$app dbuser=$app # Source app helpers -. /usr/share/yunohost/helpers +source /usr/share/yunohost/helpers # 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." # Check user parameter @@ -47,9 +45,9 @@ ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ dbpass=$(ynh_string_random) # 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" \ -d /var/lib/$app --system --user-group $app \ || 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 sudo mkdir -p "$DESTDIR" "$DATADIR" -# Copy ownCloud configuration file -oc_conf="${DESTDIR}/config.json" +# Copy Nextcloud configuration file +nc_conf="${DESTDIR}/config.json" sed -i "s@#DOMAIN#@${domain}@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 nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" @@ -99,22 +97,22 @@ _exec_occ() { # Set app folders ownership sudo chown -R $app: "$DESTDIR" "$DATADIR" -# Retrieve ownCloud sources -extract_owncloud "$DESTDIR" "$app" +# Retrieve Nextcloud sources +extract_nextcloud "$DESTDIR" "$app" -# Install ownCloud using a temporary admin user +# Install Nextcloud using a temporary admin user _exec_occ maintenance:install \ --database "mysql" --database-name "$dbname" \ --database-user "$dbuser" --database-pass "$dbpass" \ --admin-user "admin" --admin-pass "$(ynh_string_random 6)" \ --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 ldap:create-empty-config -_exec_occ config:import "$oc_conf" -sudo rm -f "$oc_conf" +_exec_occ config:import "$nc_conf" +sudo rm -f "$nc_conf" # Check LDAP configuratio to see if everything worked well _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 # 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');" _exec_occ user:delete admin # 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 sudo mkdir -p "${DATADIR}/${u}" sudo setfacl -m g:$app:rwx "/home/$u" || true @@ -173,8 +171,8 @@ sudo service nginx reload || true # Add cron job cron_path="/etc/cron.d/$app" -sed -i "s@#USER#@${app}@g" ../conf/owncloud.cron -sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/owncloud.cron -sudo cp ../conf/owncloud.cron "$cron_path" +sed -i "s@#USER#@${app}@g" ../conf/nextcloud.cron +sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/nextcloud.cron +sudo cp ../conf/nextcloud.cron "$cron_path" sudo chmod 644 "$cron_path" _exec_occ background:cron diff --git a/scripts/remove b/scripts/remove index d1957f5..e7b807c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,17 +1,15 @@ #!/bin/bash -# Get multi-instances specific variables -app=$YNH_APP_INSTANCE_NAME +# Load common variables and helpers +source ./_common.sh # Set app specific variables +app=$APPNAME dbname=$app dbuser=$app -# Load common variables and helpers -. ./_common.sh - # Source app helpers -. /usr/share/yunohost/helpers +source /usr/share/yunohost/helpers # Remove cron job # 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 # Retrieve domain from app settings -domain=$(ynh_app_setting_get $app domain) +domain=$(ynh_app_setting_get "$app" domain) # Delete app directory and configurations sudo rm -rf "/var/www/${app}" diff --git a/scripts/restore b/scripts/restore index b353f96..ef1312a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,15 +10,15 @@ dbname=$app dbuser=$app # Source app helpers -. /usr/share/yunohost/helpers +source /usr/share/yunohost/helpers # Retrieve old app settings -domain=$(ynh_app_setting_get $app domain) -path=$(ynh_app_setting_get $app path) -dbpass=$(ynh_app_setting_get $app mysqlpwd) +domain=$(ynh_app_setting_get "$app" domain) +path=$(ynh_app_setting_get "$app" path) +dbpass=$(ynh_app_setting_get "$app" mysqlpwd) # 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." # 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." # Install dependencies -ynh_package_install_from_equivs ./owncloud-deps.control \ +ynh_package_install_from_equivs ./nextcloud-deps.control \ || ynh_die "Unable to install dependencies" -# Create a system account for ownCloud +# Create a system account for Nextcloud sudo useradd -c "$app system account" \ -d /var/lib/$app --system --user-group $app \ || ynh_die "Unable to create $app system account" @@ -55,11 +55,11 @@ sudo mkdir -p "$DATADIR" sudo cp -a ./data/. "$DATADIR" # Create and restore the database -ynh_mysql_create_db $dbname $dbuser $dbpass -ynh_mysql_connect_as $dbuser $dbpass $dbname < ./db.sql +ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" +ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql # 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 sudo mkdir -p "${DATADIR}/${u}" sudo setfacl -m g:$app:rwx "/home/$u" || true diff --git a/scripts/upgrade b/scripts/upgrade index 6b84e5a..661116a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -2,18 +2,21 @@ set -eu -# Get multi-instances specific variables -app=$YNH_APP_INSTANCE_NAME - # Load common variables and helpers -. ./_common.sh +source ./_common.sh # Set app specific variables +app=$APPNAME dbname=$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 -. /usr/share/yunohost/helpers +source /usr/share/yunohost/helpers # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) @@ -76,12 +79,12 @@ _exec_occ() { exec_occ "$DESTDIR" "$app" $@ } -# Retrieve new ownCloud sources in a temporary directory +# Retrieve new Nextcloud sources in a temporary directory TMPDIR=$(ynh_mkdir_tmp) -extract_owncloud "$TMPDIR" +extract_nextcloud "$TMPDIR" -# Copy ownCloud configuration file -oc_conf="${DESTDIR}/config.json" +# Copy Nextcloud configuration file +nc_conf="${DESTDIR}/config.json" sed -i "s@#DOMAIN#@${domain}@g" ../conf/config.json sed -i "s@#DATADIR#@${DATADIR}@g" ../conf/config.json sudo cp ../conf/config.json "${TMPDIR}/config.json" @@ -103,16 +106,16 @@ sudo mv "$TMPDIR" "$DESTDIR" # Set app folders ownership 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? _exec_occ maintenance:mode --off _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 config:import "$oc_conf" -sudo rm -f "$oc_conf" +_exec_occ config:import "$nc_conf" +sudo rm -f "$nc_conf" # Guess user_home value if empty 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 # 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 sudo mkdir -p "${DATADIR}/${u}" sudo setfacl -m g:$app:rwx "/home/$u" || true @@ -168,12 +171,12 @@ sudo service nginx reload || true # Add cron job cron_path="/etc/cron.d/$app" -sed -i "s@#USER#@${app}@g" ../conf/owncloud.cron -sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/owncloud.cron -sudo cp ../conf/owncloud.cron "$cron_path" +sed -i "s@#USER#@${app}@g" ../conf/nextcloud.cron +sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/nextcloud.cron +sudo cp ../conf/nextcloud.cron "$cron_path" sudo chmod 644 "$cron_path" _exec_occ background:cron # 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