From ada812a79cfe0d9fb4bed918d5659e53a60dbf2f Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 4 May 2018 20:50:12 +0200 Subject: [PATCH 1/4] Add multimedia support --- scripts/_common.sh | 36 +++++++++++++++++++++++++++++++++--- scripts/install | 15 ++++++++++++++- scripts/restore | 9 +++++++++ scripts/upgrade | 15 ++++++++++++++- 4 files changed, 70 insertions(+), 5 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7a7b3b9..f1618eb 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -19,10 +19,12 @@ exec_occ() { php occ --no-interaction --no-ansi "$@") } -# Create the external storage for the home folders and enable sharing -create_home_external_storage() { +# Create the external storage for the given folders and enable sharing +create_external_storage() { + local datadir="$1" + local mount_name="$2" local mount_id=`exec_occ files_external:create --output=json \ - 'Home' 'local' 'null::null' -c 'datadir=/home/$user' || true` + "$2" 'local' 'null::null' -c "datadir=$datadir" || true` ! [[ $mount_id =~ ^[0-9]+$ ]] \ && echo "Unable to create external storage" >&2 \ || exec_occ files_external:option "$mount_id" enable_sharing true @@ -315,3 +317,31 @@ ynh_handle_app_migration () { migration_process=1 fi } + + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= +#================================================= +# YUNOHOST MULTIMEDIA INTEGRATION +#================================================= + +# Install or update the main directory yunohost.multimedia +# +# usage: ynh_multimedia_build_main_dir +ynh_multimedia_build_main_dir () { + wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/master.zip 2>&1 + unzip -q master.zip + ./yunohost.multimedia-master/script/ynh_media_build.sh +} + +# Allow an user to have an write authorisation in multimedia directories +# +# usage: ynh_multimedia_addaccess user_name +# +# | arg: user_name - The name of the user which gain this access. +ynh_multimedia_addaccess () { + local user_name=$1 + groupadd -f multimedia + usermod -a -G multimedia $user_name +} diff --git a/scripts/install b/scripts/install index cf22534..6900ed2 100755 --- a/scripts/install +++ b/scripts/install @@ -182,7 +182,7 @@ exec_occ ldap:test-config \'\' \ # Enable External Storage and create local mount to home folder if [ $user_home -eq 1 ]; then exec_occ app:enable files_external - create_home_external_storage + create_external_storage "/home/\$user" "Home" fi #================================================= @@ -237,6 +237,19 @@ exec_occ background:cron # Set system group in hooks ynh_replace_string "#GROUP#" "$app" ../hooks/post_user_create +#================================================= +# YUNOHOST MULTIMEDIA INTEGRATION +#================================================= + +# Build YunoHost multimedia directories +ynh_multimedia_build_main_dir +# Mount the user directory in Nextcloud +exec_occ app:enable files_external +create_external_storage "/home/yunohost.multimedia/\$user" "Multimedia" +create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia" +# Allow nextcloud to write into these directories +ynh_multimedia_addaccess $app + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index b476d80..44a7f58 100755 --- a/scripts/restore +++ b/scripts/restore @@ -134,6 +134,15 @@ for u in $(ynh_user_list); do setfacl -m g:$app:rwx "/home/$u" || true done +#================================================= +# YUNOHOST MULTIMEDIA INTEGRATION +#================================================= + +# Build YunoHost multimedia directories +ynh_multimedia_build_main_dir +# Allow nextcloud to write into these directories +ynh_multimedia_addaccess $app + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 099d842..5997003 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -272,7 +272,7 @@ if [ $user_home -eq 1 ]; then exec_occ app:enable files_external exec_occ files_external:list --output=json \ | grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \ - || create_home_external_storage + || create_external_storage "/home/\$user" "Home" fi #================================================= @@ -303,6 +303,19 @@ exec_occ background:cron # Set system group in hooks ynh_replace_string "#GROUP#" "$app" ../hooks/post_user_create +#================================================= +# YUNOHOST MULTIMEDIA INTEGRATION +#================================================= + +# Build YunoHost multimedia directories +ynh_multimedia_build_main_dir +# Mount the user directory in Nextcloud +exec_occ app:enable files_external +create_external_storage "/home/yunohost.multimedia/\$user" "Multimedia" +create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia" +# Allow nextcloud to write into these directories +ynh_multimedia_addaccess $app + #================================================= # GENERIC FINALIZATION #================================================= From 628cead60fa17dccb8eaf0f0e518e5fa70557e82 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 5 May 2018 19:42:58 +0200 Subject: [PATCH 2/4] Use a checksum for yunohost.multimedia --- scripts/_common.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f1618eb..ae524d8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -330,8 +330,19 @@ ynh_handle_app_migration () { # # usage: ynh_multimedia_build_main_dir ynh_multimedia_build_main_dir () { - wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/master.zip 2>&1 - unzip -q master.zip + local ynh_media_release="v1.0" + local checksum="4852c8607db820ad51f348da0dcf0c88" + + # Download yunohost.multimedia scripts + wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz + + # Check the control sum + echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ + || ynh_die "Corrupt source" + + # Extract + mkdir yunohost.multimedia-master + tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1 ./yunohost.multimedia-master/script/ynh_media_build.sh } From 055d750d98b95ab175fd18576024a38e6f84ccc8 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 12 May 2018 19:30:55 +0200 Subject: [PATCH 3/4] Upgrade to upstream version 13.0.2 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 05205e1..cb5426d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 13.0.1 +**Shipped version:** 13.0.2 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png) diff --git a/manifest.json b/manifest.json index 7021b04..2f8cd21 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "13.0.1~ynh1", + "version": "13.0.2~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index f19c2e2..2e25020 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,7 +1,7 @@ #!/bin/bash # Last available nextcloud version -next_version="13.0.1" +next_version="13.0.2" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="5743314a71e972ae46a14b36b37394d4545915aa5f32d9e12ba786d04c1f1d11" +nextcloud_source_sha256="7396f98a1a53a9f4b144f55360d87c89cb6ee899feef1cfbf29a736219f9c47d" From 56e4620128d46302c5c6996b24a651e898e63bbe Mon Sep 17 00:00:00 2001 From: JimboJoe Date: Sat, 12 May 2018 19:56:46 +0200 Subject: [PATCH 4/4] Fix typos --- scripts/_common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ae524d8..b5f113d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -336,7 +336,7 @@ ynh_multimedia_build_main_dir () { # Download yunohost.multimedia scripts wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz - # Check the control sum + # Verify checksum echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ || ynh_die "Corrupt source" @@ -346,11 +346,11 @@ ynh_multimedia_build_main_dir () { ./yunohost.multimedia-master/script/ynh_media_build.sh } -# Allow an user to have an write authorisation in multimedia directories +# Grant write access to multimedia directories to a specified user # # usage: ynh_multimedia_addaccess user_name # -# | arg: user_name - The name of the user which gain this access. +# | arg: user_name - User to be granted write access ynh_multimedia_addaccess () { local user_name=$1 groupadd -f multimedia