From 916e510210f7292891e6d799b7e4b9588286e2bc Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 12 Mar 2019 17:58:00 +0100 Subject: [PATCH 01/60] update --- conf/app.src | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/app.src b/conf/app.src index 7c17c2d..9298cb3 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/moodle/moodle/archive/v3.5.1.tar.gz -SOURCE_SUM=ccabd372fcdb253a404428196c1cf0a16529797717b443572250103a29ce1799 -SOURCE_SUM_PRG=sha256sum +SOURCE_URL=https://download.moodle.org/stable36/moodle-3.6.3.tgz +SOURCE_SUM=9a583064321ee0929e3df2b194c783dd5322b6d6e7642fdbf9d18cc511b82f73e8007e234998ea2553cb8147dc22fa4d178f2104c6eb2ebc322a9850afba19c5 +SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR= -SOURCE_FILENAME= +SOURCE_FILENAME=moodle.tgz \ No newline at end of file From aa42f7601bd94586b0dc466293678b453542b9c9 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 12 Mar 2019 18:10:10 +0100 Subject: [PATCH 02/60] Update remove --- scripts/remove | 75 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 9 deletions(-) diff --git a/scripts/remove b/scripts/remove index 778e471..f820418 100644 --- a/scripts/remove +++ b/scripts/remove @@ -13,49 +13,96 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) +port=$(ynh_app_setting_get $app port) db_name=$(ynh_app_setting_get $app psql_db) +db_user=$db_name final_path=$(ynh_app_setting_get $app final_path) +back_path=/opt/pia-back #================================================= # STANDARD REMOVE #================================================= +# REMOVE SERVICE FROM ADMIN PANEL +#================================================= + +# Remove a service from the admin panel, added by `yunohost service add` +if yunohost service status $app >/dev/null 2>&1 +then + ynh_print_info "Removing $app service" + yunohost service remove $app +fi + +#================================================= +# STOP AND REMOVE SERVICE +#================================================= +ynh_print_info "Stopping and removing the systemd service" + +# Remove the dedicated systemd config +ynh_remove_systemd_config + +#================================================= +# REMOVE THE POSTGRESQL DATABASE +#================================================= +ynh_print_info "Removing the PostgreSQL database" + +# Remove a database if it exists, along with the associated user +ynh_psql_remove_db $db_name $db_name + #================================================= # REMOVE DEPENDENCIES #================================================= +ynh_print_info "Removing dependencies" # Remove metapackage and its dependencies ynh_remove_app_dependencies -#================================================= -# REMOVE THE psql DATABASE -#================================================= -# Remove a database if it exists, along with the associated user -ynh_psql_remove_db "$db_name" "$app" - #================================================= # REMOVE APP MAIN DIR #================================================= +ynh_print_info "Removing app main directory" # Remove the app directory securely ynh_secure_remove "$final_path" +ynh_secure_remove "$back_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= +ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config #================================================= -# REMOVE PHP-FPM CONFIGURATION +# REMOVE PHP-FPM CONFIGURATION #================================================= +#ynh_print_info "Removing php-fpm configuration" # Remove the dedicated php-fpm config -ynh_remove_fpm_config +#ynh_remove_fpm_config + +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_print_info "Removing logrotate configuration" + +# Remove the app-specific logrotate config +ynh_remove_logrotate + +#================================================= +# CLOSE A PORT +#================================================= + +if yunohost firewall list | grep -q "\- $port$" +then + ynh_print_info "Closing port $port" + ynh_exec_warn_less yunohost firewall disallow TCP $port +fi #================================================= # SPECIFIC REMOVE @@ -67,13 +114,23 @@ ynh_remove_fpm_config ynh_secure_remove "/etc/cron.d/$app" # Remove a directory securely -ynh_secure_remove "/home/yunohost.app/$app" +ynh_secure_remove "/etc/$app/" + +# Remove the log files +ynh_secure_remove "/var/log/$app/" #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= +ynh_print_info "Removing the dedicated system user" # Delete a system user ynh_system_user_delete $app + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Removal of $app completed" From e87732ac2b715276c37a4d1d06a4d45cf2d9ce1c Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 12 Mar 2019 18:12:29 +0100 Subject: [PATCH 03/60] Update remove --- scripts/remove | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/remove b/scripts/remove index f820418..0f0f155 100644 --- a/scripts/remove +++ b/scripts/remove @@ -115,6 +115,7 @@ ynh_secure_remove "/etc/cron.d/$app" # Remove a directory securely ynh_secure_remove "/etc/$app/" +ynh_secure_remove "/home/yunohost.app/$app" # Remove the log files ynh_secure_remove "/var/log/$app/" From 67c8f26a1fb97a4a8f2e599f92ff1b1d2892b574 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 12 Mar 2019 18:13:36 +0100 Subject: [PATCH 04/60] Update README.md --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ecb5093..e5e6e10 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Moodle app for YunoHost [![Install Moodle with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=Moodle)

-Version: **3.5.1** +Version: **3.6.3** Moodle - the world's open source learning platform Moodle is a learning platform designed to provide @@ -14,6 +14,17 @@ all manner of organisations and individuals. # Installation ** After the installation go to your domain https://domain.tld/moodle and create the admin account. ** +### Installing guide + + 1. App can be installed by YunoHost **admin web-interface** or by **running following command**: + + $ sudo yunohost app install https://github.com/YunoHost-Apps/moodle_ynh + + +### Upgrade this package: + + $ sudo yunohost app upgrade pia -u https://github.com/YunoHost-Apps/moodle_ynh + ## To-do - [X] Install script - [X] Remove script From 0e7ad843c2acbc96a0f1f4d2a3d5cfe5a7efab19 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 12 Mar 2019 18:15:22 +0100 Subject: [PATCH 05/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5e6e10..0570c2b 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ all manner of organisations and individuals. ### Upgrade this package: - $ sudo yunohost app upgrade pia -u https://github.com/YunoHost-Apps/moodle_ynh + $ sudo yunohost app upgrade moodle -u https://github.com/YunoHost-Apps/moodle_ynh ## To-do - [X] Install script From 570b4b0c493e83f806e03f1e01a50b493cfbdb26 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 12 Mar 2019 23:22:55 +0100 Subject: [PATCH 06/60] Update remove --- scripts/remove | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/remove b/scripts/remove index 0f0f155..0dfcb17 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,7 +22,6 @@ port=$(ynh_app_setting_get $app port) db_name=$(ynh_app_setting_get $app psql_db) db_user=$db_name final_path=$(ynh_app_setting_get $app final_path) -back_path=/opt/pia-back #================================================= # STANDARD REMOVE @@ -68,7 +67,6 @@ ynh_print_info "Removing app main directory" # Remove the app directory securely ynh_secure_remove "$final_path" -ynh_secure_remove "$back_path" #================================================= # REMOVE NGINX CONFIGURATION @@ -94,16 +92,6 @@ ynh_print_info "Removing logrotate configuration" # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_print_info "Closing port $port" - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # SPECIFIC REMOVE #================================================= From 8a240b243d7b3761f13111e3ad3a53e5d40ecec5 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 12 Mar 2019 23:23:39 +0100 Subject: [PATCH 07/60] Update remove --- scripts/remove | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 0dfcb17..cff677e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -18,7 +18,6 @@ ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) -port=$(ynh_app_setting_get $app port) db_name=$(ynh_app_setting_get $app psql_db) db_user=$db_name final_path=$(ynh_app_setting_get $app final_path) From 68445c0f08922754e416fcd042868e20fa2cf274 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 20:23:18 +0100 Subject: [PATCH 08/60] Create upgrade --- scripts/upgrade | 175 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 scripts/upgrade diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100644 index 0000000..d0630cc --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,175 @@ +#!/bin/bash + +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_print_info "Loading installation settings..." + +app=$YNH_APP_INSTANCE_NAME + +domain=$(ynh_app_setting_get $app domain) +path_url=$(ynh_app_setting_get $app path) +admin=$(ynh_app_setting_get $app admin) +is_public=$(ynh_app_setting_get $app is_public) +final_path=$(ynh_app_setting_get $app final_path) +language=$(ynh_app_setting_get $app language) +db_name=$(ynh_app_setting_get $app db_name) + +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_print_info "Ensuring downward compatibility..." + +# Fix is_public as a boolean value +if [ "$is_public" = "Yes" ]; then + ynh_app_setting_set $app is_public 1 + is_public=1 +elif [ "$is_public" = "No" ]; then + ynh_app_setting_set $app is_public 0 + is_public=0 +fi + +# If db_name doesn't exist, create it +if [ -z $db_name ]; then + db_name=$(ynh_sanitize_dbid $app) + ynh_app_setting_set $app db_name $db_name +fi + +# If final_path doesn't exist, create it +if [ -z $final_path ]; then + final_path=/var/www/$app + ynh_app_setting_set $app final_path $final_path +fi + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_print_info "Backing up the app before upgrading (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# CHECK THE PATH +#================================================= + +# Normalize the URL path syntax +path_url=$(ynh_normalize_url_path $path_url) + +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_print_info "Upgrading source files..." + +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source "$final_path" + +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_print_info "Upgrading nginx web server configuration..." + +# Create a dedicated nginx config +ynh_add_nginx_config + +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_print_info "Upgrading dependencies..." + +ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_print_info "Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create $app + +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_print_info "Upgrading php-fpm configuration..." + +# Create a dedicated php-fpm config +ynh_add_fpm_config + +#================================================= +# SPECIFIC UPGRADE +#================================================= +# ... +#================================================= + +### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. +### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. +ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum "$final_path/CONFIG_FILE" + +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_print_info "Upgrading logrotate configuration..." + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_print_info "Upgrading systemd configuration..." + +# Create a dedicated systemd config +ynh_add_systemd_config + +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions on app files +chown -R root: $final_path + +#================================================= +# SETUP SSOWAT +#================================================= +ynh_print_info "Upgrading SSOwat configuration..." + +# Make app public if necessary +if [ $is_public -eq 1 ] +then + # unprotected_uris allows SSO credentials to be passed anyway + ynh_app_setting_set $app unprotected_uris "/" +fi + +#================================================= +# RELOAD NGINX +#================================================= +ynh_print_info "Reloading nginx web server..." + +systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Upgrade of $app completed" From ab9c342f5b64dd2d537cf62a085614771256f46d Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 20:26:21 +0100 Subject: [PATCH 09/60] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index d0630cc..ed94779 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -147,7 +147,7 @@ ynh_add_systemd_config #================================================= # Set permissions on app files -chown -R root: $final_path +chown root: $final_path/config.php #================================================= # SETUP SSOWAT From 4a8f8db66268abbf1435e87a33c9e998663c63ae Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 20:33:13 +0100 Subject: [PATCH 10/60] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ed94779..05da9c4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,9 +92,9 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info "Upgrading dependencies..." +#ynh_print_info "Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies +#ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER From 7cc93f006ca3c8260b0b57ba09e9a2c899206677 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 20:34:17 +0100 Subject: [PATCH 11/60] Update upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 05da9c4..5932ca9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,6 +7,7 @@ #================================================= source _common.sh +source psql.sh source /usr/share/yunohost/helpers #================================================= From ea3600164160d6683a606bc8f9a940d3c559a712 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 20:45:52 +0100 Subject: [PATCH 12/60] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 3d07b1b..1b82095 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Moodle package for YunoHost application.", "fr": "Moodle de package d’application pour YunoHost." }, - "version": "3.5.1", + "version": "3.6.3", "url": "https://moodle.org/", "license": "free", "maintainer": { From 5ed99597065d188f5f702df876b222a98597726d Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 20:47:37 +0100 Subject: [PATCH 13/60] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5932ca9..de78b2c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,7 @@ path_url=$(ynh_app_setting_get $app path) admin=$(ynh_app_setting_get $app admin) is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) -language=$(ynh_app_setting_get $app language) +#language=$(ynh_app_setting_get $app language) db_name=$(ynh_app_setting_get $app db_name) #================================================= From f918b6dc51bc811ed909727d04baf7d7c860adfe Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:01:31 +0100 Subject: [PATCH 14/60] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index de78b2c..a837210 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,9 +121,9 @@ ynh_add_fpm_config ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" +#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/CONFIG_FILE" +#ynh_store_file_checksum "$final_path/CONFIG_FILE" #================================================= # SETUP LOGROTATE From 7206e11ed215da134f9453dbe3fb1ce54a9067dc Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:04:36 +0100 Subject: [PATCH 15/60] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a837210..24015bd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -136,10 +136,10 @@ ynh_use_logrotate --non-append #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info "Upgrading systemd configuration..." +#ynh_print_info "Upgrading systemd configuration..." # Create a dedicated systemd config -ynh_add_systemd_config +#ynh_add_systemd_config #================================================= # GENERIC FINALIZATION From 411dd969fe4a1f3c9557ad05614e9628a340bb7e Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:05:07 +0100 Subject: [PATCH 16/60] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 24015bd..27a3b21 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -93,9 +93,9 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -#ynh_print_info "Upgrading dependencies..." +ynh_print_info "Upgrading dependencies..." -#ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER From 49076efcf2642b913ae27c38946b0f7a4e1fb6a8 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:08:04 +0100 Subject: [PATCH 17/60] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 27a3b21..98a293e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,9 +121,9 @@ ynh_add_fpm_config ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" +ynh_backup_if_checksum_is_different "$final_path/config.php" # Recalculate and store the checksum of the file for the next upgrade. -#ynh_store_file_checksum "$final_path/CONFIG_FILE" +ynh_store_file_checksum "$final_path/config.php" #================================================= # SETUP LOGROTATE From 02b4ad2377c865a318bcbd0454e131b2064fbca4 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:10:30 +0100 Subject: [PATCH 18/60] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 98a293e..37f984d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -93,9 +93,9 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info "Upgrading dependencies..." +#ynh_print_info "Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies +#ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER From d6850c93d577836195212ac5f0214319265bd94c Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:25:23 +0100 Subject: [PATCH 19/60] Update app.src --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index 9298cb3..d12d2fe 100644 --- a/conf/app.src +++ b/conf/app.src @@ -2,5 +2,5 @@ SOURCE_URL=https://download.moodle.org/stable36/moodle-3.6.3.tgz SOURCE_SUM=9a583064321ee0929e3df2b194c783dd5322b6d6e7642fdbf9d18cc511b82f73e8007e234998ea2553cb8147dc22fa4d178f2104c6eb2ebc322a9850afba19c5 SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR= -SOURCE_FILENAME=moodle.tgz \ No newline at end of file +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=moodle.tgz From fcee7048096762bfb71818841bb04ba17e368f34 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:39:39 +0100 Subject: [PATCH 20/60] Update remove --- scripts/remove | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index cff677e..de52ef8 100644 --- a/scripts/remove +++ b/scripts/remove @@ -78,10 +78,10 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -#ynh_print_info "Removing php-fpm configuration" +ynh_print_info "Removing php-fpm configuration" # Remove the dedicated php-fpm config -#ynh_remove_fpm_config +ynh_remove_fpm_config #================================================= # REMOVE LOGROTATE CONFIGURATION From 8651194aa61552e132c0d0eea13b14500fe8305e Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:48:47 +0100 Subject: [PATCH 21/60] Update app.src --- conf/app.src | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index d12d2fe..77b9352 100644 --- a/conf/app.src +++ b/conf/app.src @@ -2,5 +2,6 @@ SOURCE_URL=https://download.moodle.org/stable36/moodle-3.6.3.tgz SOURCE_SUM=9a583064321ee0929e3df2b194c783dd5322b6d6e7642fdbf9d18cc511b82f73e8007e234998ea2553cb8147dc22fa4d178f2104c6eb2ebc322a9850afba19c5 SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true +SOURCE_EXTRACT=true SOURCE_FILENAME=moodle.tgz From 154a3823559bdebeebfbc8f774265e30b656d3fd Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:56:01 +0100 Subject: [PATCH 22/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0570c2b..9ba2cd8 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,6 @@ all manner of organisations and individuals. ## To-do - [X] Install script - [X] Remove script -- [ ] Upgrade script +- [x] Upgrade script - [X] Backup and Restore scripts(need testing) - [ ] LDAP integration From 95fd689be7a7c49b69c0dc10e85cd7fa4307613c Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 21:59:05 +0100 Subject: [PATCH 23/60] Update upgrade --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 37f984d..0a9764f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -65,6 +65,8 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +cp -a $final_path $final_path.backup + #================================================= # CHECK THE PATH #================================================= From c11356dde9ddb020ef69cfdd0837f5801407f15e Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 22:13:39 +0100 Subject: [PATCH 24/60] Update README.md --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ba2cd8..a5c72d2 100644 --- a/README.md +++ b/README.md @@ -11,19 +11,30 @@ integrated system to create personalised learning environments. Moodle is widely used around the world by universities, schools, companies and all manner of organisations and individuals. -# Installation -** After the installation go to your domain https://domain.tld/moodle and create the admin account. ** ### Installing guide 1. App can be installed by YunoHost **admin web-interface** or by **running following command**: $ sudo yunohost app install https://github.com/YunoHost-Apps/moodle_ynh + + After install : + + 1. Login in moodle exemple : https://domain.tld/moodle + 2. Create admin account ### Upgrade this package: $ sudo yunohost app upgrade moodle -u https://github.com/YunoHost-Apps/moodle_ynh + + After upgrade : + + 1. If you have custom plugins or themes need to move your plugins + 2. Moodle is saved in /var/www/moodle.backup + 3. Moove your plugins / themes exemple "cp -a moodle.backup/mod/hvp moodle/mod/hvp" + 4. After move your plugins and themes make "rm -r moodle.backup" + 5. Login in moodle for complete upgrade ## To-do - [X] Install script From 2f398dd06bee213779eab0c0ce00fc782c516be5 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 22:15:16 +0100 Subject: [PATCH 25/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5c72d2..822e2de 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ all manner of organisations and individuals. 1. If you have custom plugins or themes need to move your plugins 2. Moodle is saved in /var/www/moodle.backup 3. Moove your plugins / themes exemple "cp -a moodle.backup/mod/hvp moodle/mod/hvp" - 4. After move your plugins and themes make "rm -r moodle.backup" + 4. After moving your plugins and themes make "rm -r moodle.backup" 5. Login in moodle for complete upgrade ## To-do From 59957b135481eb8f5bc10f04d082c9fb6caaa538 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 22:16:38 +0100 Subject: [PATCH 26/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 822e2de..1105ee3 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ all manner of organisations and individuals. ### Installing guide - 1. App can be installed by YunoHost **admin web-interface** or by **running following command**: + App can be installed by YunoHost **admin web-interface** or by **running following command**: $ sudo yunohost app install https://github.com/YunoHost-Apps/moodle_ynh From 43a2c1a39284e85bb384c38ea4e10009c8894998 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 22:17:17 +0100 Subject: [PATCH 27/60] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1105ee3..afb6d73 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,10 @@ all manner of organisations and individuals. $ sudo yunohost app install https://github.com/YunoHost-Apps/moodle_ynh - After install : + After install : - 1. Login in moodle exemple : https://domain.tld/moodle - 2. Create admin account + 1. Login in moodle exemple : https://domain.tld/moodle + 2. Create admin account ### Upgrade this package: From 64b92224cdece8f225cfaecbf35632cc6bfc0a22 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 22:19:14 +0100 Subject: [PATCH 28/60] Update upgrade --- scripts/upgrade | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0a9764f..ae1b135 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,8 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -source _common.sh -source psql.sh source /usr/share/yunohost/helpers #================================================= From be05c7bb0f8909dab62385ae9d9021385e47acef Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 22:26:28 +0100 Subject: [PATCH 29/60] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index afb6d73..95d52c3 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ all manner of organisations and individuals. 3. Moove your plugins / themes exemple "cp -a moodle.backup/mod/hvp moodle/mod/hvp" 4. After moving your plugins and themes make "rm -r moodle.backup" 5. Login in moodle for complete upgrade + + More informations : https://docs.moodle.org/26/en/Upgrading ## To-do - [X] Install script From 5ccde1408291d0d3ccf3a054597f8c29c34203bb Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 13 Mar 2019 22:27:13 +0100 Subject: [PATCH 30/60] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 95d52c3..e55cc9c 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,9 @@ all manner of organisations and individuals. 4. After moving your plugins and themes make "rm -r moodle.backup" 5. Login in moodle for complete upgrade - More informations : https://docs.moodle.org/26/en/Upgrading +More informations : https://docs.moodle.org/26/en/Upgrading + + ## To-do - [X] Install script From 52d49172aab92373106ba313384ce3acc1e2239b Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 20 Mar 2019 21:15:44 +0100 Subject: [PATCH 31/60] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 1b82095..e9536bd 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "version": "3.6.3", "url": "https://moodle.org/", - "license": "free", + "license": "GPL-3.0", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" From 0ea8f8238cb2a05399bf3b8119784c65a08667b6 Mon Sep 17 00:00:00 2001 From: liberodark Date: Sat, 28 Sep 2019 04:40:01 +0200 Subject: [PATCH 32/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e55cc9c..3057640 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Moodle app for YunoHost [![Install Moodle with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=Moodle)

-Version: **3.6.3** +Version: **3.7.2** Moodle - the world's open source learning platform Moodle is a learning platform designed to provide From f9b6b8a9b85b17c92b0300fd02bbce128c339d43 Mon Sep 17 00:00:00 2001 From: liberodark Date: Sat, 28 Sep 2019 04:40:35 +0200 Subject: [PATCH 33/60] Update app.src --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index 77b9352..cd24b61 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://download.moodle.org/stable36/moodle-3.6.3.tgz -SOURCE_SUM=9a583064321ee0929e3df2b194c783dd5322b6d6e7642fdbf9d18cc511b82f73e8007e234998ea2553cb8147dc22fa4d178f2104c6eb2ebc322a9850afba19c5 +SOURCE_URL=https://download.moodle.org/stable37/moodle-3.7.2.tgz +SOURCE_SUM=034722f7a10871965849aaac24bb487c5f0cac8132ef058729d068e538d8e2c3e2215304310b1a50d7cfdee4242c1094cf6d8323a5c2ecc5c98bd9bca295dfa0 SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From a95d944aadda1ca551fec3b9c228b8cc0d426124 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:27:17 +0100 Subject: [PATCH 34/60] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 9cdc109..7d57819 100644 --- a/scripts/install +++ b/scripts/install @@ -71,6 +71,7 @@ ynh_app_setting_set $app is_public $is_public #================================================= # INSTALL DEPENDENCIES #================================================= +ynh_install_php --phpversion=7.1 ynh_install_app_dependencies php-zip php-mysql php-xml php-intl php-mbstring php-gd php-curl php-soap php-pgsql php-xmlrpc postgresql #================================================= # Create postgresql database From abe97c10904c621c9cf510fe21e213ff17c0314b Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:30:10 +0100 Subject: [PATCH 35/60] Create ynh_install_php --- scripts/ynh_install_php | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 scripts/ynh_install_php diff --git a/scripts/ynh_install_php b/scripts/ynh_install_php new file mode 100644 index 0000000..75bb6db --- /dev/null +++ b/scripts/ynh_install_php @@ -0,0 +1,77 @@ +#!/bin/bash + +# Install another version of php. +# +# usage: ynh_install_php --phpversion=phpversion [--package=packages] +# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3 +# | arg: -p, --package - Additionnal php packages to install +ynh_install_php () { + # Declare an array to define the options of this helper. + local legacy_args=vp + declare -Ar args_array=( [v]=phpversion= [p]=package= ) + local phpversion + local package + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + package=${package:-} + + # Store php_version into the config of this app + ynh_app_setting_set $app php_version $phpversion + + if [ "$phpversion" == "7.0" ] + then + ynh_die "Do not use ynh_install_php to install php7.0" + fi + + # Store the ID of this app and the version of php requested for it + echo "$YNH_APP_INSTANCE_NAME:$phpversion" | tee --append "/etc/php/ynh_app_version" + + # Add an extra repository for those packages + ynh_install_extra_repo --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --priority=995 --name=extra_php_version + + # Install requested dependencies from this extra repository. + # Install php-fpm first, otherwise php will install apache as a dependency. + ynh_add_app_dependencies --package="php${phpversion}-fpm" + ynh_add_app_dependencies --package="php$phpversion php${phpversion}-common $package" + + # Set php7.0 back as the default version for php-cli. + update-alternatives --set php /usr/bin/php7.0 + + # Remove this extra repository after packages are installed + ynh_remove_extra_repo --name=extra_php_version + + # Advertise service in admin panel + yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" +} + +ynh_remove_php () { + # Get the version of php used by this app + local phpversion=$(ynh_app_setting_get $app php_version) + + if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ] + then + if [ "$phpversion" == "7.0" ] + then + ynh_print_err "Do not use ynh_remove_php to install php7.0" + fi + return 0 + fi + + # Remove the line for this app + sed --in-place "/$YNH_APP_INSTANCE_NAME:$phpversion/d" "/etc/php/ynh_app_version" + + # If no other app uses this version of php, remove it. + if ! grep --quiet "$phpversion" "/etc/php/ynh_app_version" + then + # Purge php dependences for this version. + ynh_package_autopurge "php$phpversion php${phpversion}-fpm php${phpversion}-common" + # Remove the service from the admin panel + yunohost service remove php${phpversion}-fpm + fi + + # If no other app uses alternate php versions, remove the extra repo for php + if [ ! -s "/etc/php/ynh_app_version" ] + then + ynh_secure_remove /etc/php/ynh_app_version + fi +} From af35767453afe92ef0031458dc3b51537b689761 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:30:30 +0100 Subject: [PATCH 36/60] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 7d57819..71acb8a 100644 --- a/scripts/install +++ b/scripts/install @@ -8,6 +8,7 @@ source _common.sh source psql.sh +source ynh_install_php source /usr/share/yunohost/helpers #================================================= From 14785fd0ef763030cd9f84ef7027f5aaf61063be Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:31:13 +0100 Subject: [PATCH 37/60] Create ynh_add_extra_apt_repos --- scripts/ynh_add_extra_apt_repos | 294 ++++++++++++++++++++++++++++++++ 1 file changed, 294 insertions(+) create mode 100644 scripts/ynh_add_extra_apt_repos diff --git a/scripts/ynh_add_extra_apt_repos b/scripts/ynh_add_extra_apt_repos new file mode 100644 index 0000000..3276f00 --- /dev/null +++ b/scripts/ynh_add_extra_apt_repos @@ -0,0 +1,294 @@ +#!/bin/bash + +# Pin a repository. +# +# usage: ynh_pin_repo --package=packages --pin=pin_filter [--priority=priority_value] [--name=name] [--append] +# | arg: -p, --package - Packages concerned by the pin. Or all, *. +# | arg: -i, --pin - Filter for the pin. +# | arg: -p, --priority - Priority for the pin +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. +# +ynh_pin_repo () { + # Declare an array to define the options of this helper. + local legacy_args=pirna + declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) + local package + local pin + local priority + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + package="${package:-*}" + priority=${priority:-50} + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/preferences.d" + echo "Package: $package +Pin: $pin +Pin-Priority: $priority" \ + | $append "/etc/apt/preferences.d/$name" +} + +# Add a repository. +# +# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] +# | arg: -u, --uri - Uri of the repository. +# | arg: -s, --suite - Suite of the repository. +# | arg: -c, --component - Component of the repository. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable +# uri suite component +# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable +# +ynh_add_repo () { + # Declare an array to define the options of this helper. + local legacy_args=uscna + declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) + local uri + local suite + local component + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/sources.list.d" + # Add the new repo in sources.list.d + echo "deb $uri $suite $component" \ + | $append "/etc/apt/sources.list.d/$name.list" +} + +# Add an extra repository correctly, pin it and get the key. +# +# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--priority=priority_value] [--name=name] [--append] +# | arg: -r, --repo - Complete url of the extra repository. +# | arg: -k, --key - url to get the public key. +# | arg: -p, --priority - Priority for the pin +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +ynh_install_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=rkpna + declare -Ar args_array=( [r]=repo= [k]=key= [p]=priority= [n]=name= [a]=append ) + local repo + local key + local priority + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + key=${key:-0} + priority=${priority:-} + + if [ $append -eq 1 ] + then + append="--append" + wget_append="tee -a" + else + append="" + wget_append="tee" + fi + + # Split the repository into uri, suite and components. + # Remove "deb " at the beginning of the repo. + repo="${repo#deb }" + + # Get the uri + local uri="$(echo "$repo" | awk '{ print $1 }')" + + # Get the suite + local suite="$(echo "$repo" | awk '{ print $2 }')" + + # Get the components + local component="${repo##$uri $suite }" + + # Add the repository into sources.list.d + ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append + + # Pin the new repo with the default priority, so it won't be used for upgrades. + # Build $pin from the uri without http and any sub path + local pin="${uri#*://}" + pin="${pin%%/*}" + # Set a priority only if asked + if [ -n "$priority" ] + then + priority="--priority=$priority" + fi + ynh_pin_repo --package="*" --pin="origin \"$pin\"" $priority --name="$name" $append + + # Get the public key for the repo + if [ -n "$key" ] + then + mkdir -p "/etc/apt/trusted.gpg.d" + wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/$name.gpg > /dev/null + fi + + # Update the list of package with the new repo + ynh_package_update +} + +# Remove an extra repository and the assiociated configuration. +# +# usage: ynh_remove_extra_repo [--name=name] +# | arg: -n, --name - Name for the files for this repo, $app as default value. +ynh_remove_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=n + declare -Ar args_array=( [n]=name= ) + local name + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + + ynh_secure_remove "/etc/apt/sources.list.d/$name.list" + ynh_secure_remove "/etc/apt/preferences.d/$name" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.asc" + + # Update the list of package to exclude the old repo + ynh_package_update +} + +# Install packages from an extra repository properly. +# +# usage: ynh_install_extra_app_dependencies --repo="repo" --package="dep1 dep2" [--key=key_url] [--name=name] +# | arg: -r, --repo - Complete url of the extra repository. +# | arg: -p, --package - The packages to install from this extra repository +# | arg: -k, --key - url to get the public key. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +ynh_install_extra_app_dependencies () { + # Declare an array to define the options of this helper. + local legacy_args=rpkn + declare -Ar args_array=( [r]=repo= [p]=package= [k]=key= [n]=name= ) + local repo + local package + local key + local name + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + key=${key:-0} + + # Set a key only if asked + if [ -n "$key" ] + then + key="--key=$key" + fi + # Add an extra repository for those packages + ynh_install_extra_repo --repo="$repo" $key --priority=995 --name=$name + + # Install requested dependencies from this extra repository. + ynh_add_app_dependencies --package="$package" + + # Remove this extra repository after packages are installed + ynh_remove_extra_repo --name=$app +} + +#================================================= + +# patched version of ynh_install_app_dependencies to be used with ynh_add_app_dependencies + +# Define and install dependencies with a equivs control file +# This helper can/should only be called once per app +# +# usage: ynh_install_app_dependencies dep [dep [...]] +# | arg: dep - the package name to install in dependence +# You can give a choice between some package with this syntax : "dep1|dep2" +# Example : ynh_install_app_dependencies dep1 dep2 "dep3|dep4|dep5" +# This mean in the dependence tree : dep1 & dep2 & (dep3 | dep4 | dep5) +# +# Requires YunoHost version 2.6.4 or higher. +ynh_install_app_dependencies () { + local dependencies=$@ + dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')" + dependencies=${dependencies//|/ | } + local manifest_path="../manifest.json" + if [ ! -e "$manifest_path" ]; then + manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place + fi + + local version=$(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file. + if [ ${#version} -eq 0 ]; then + version="1.0" + fi + local dep_app=${app//_/-} # Replace all '_' by '-' + + # Handle specific versions + if [[ "$dependencies" =~ [\<=\>] ]] + then + # Replace version specifications by relationships syntax + # https://www.debian.org/doc/debian-policy/ch-relationships.html + # Sed clarification + # [^(\<=\>] ignore if it begins by ( or < = >. To not apply twice. + # [\<=\>] matches < = or > + # \+ matches one or more occurence of the previous characters, for >= or >>. + # [^,]\+ matches all characters except ',' + # Ex: package>=1.0 will be replaced by package (>= 1.0) + dependencies="$(echo "$dependencies" | sed 's/\([^(\<=\>]\)\([\<=\>]\+\)\([^,]\+\)/\1 (\2 \3)/g')" + fi + + cat > /tmp/${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build +Section: misc +Priority: optional +Package: ${dep_app}-ynh-deps +Version: ${version} +Depends: ${dependencies} +Architecture: all +Description: Fake package for $app (YunoHost app) dependencies + This meta-package is only responsible of installing its dependencies. +EOF + ynh_package_install_from_equivs /tmp/${dep_app}-ynh-deps.control \ + || ynh_die --message="Unable to install dependencies" # Install the fake package and its dependencies + rm /tmp/${dep_app}-ynh-deps.control + ynh_app_setting_set --app=$app --key=apt_dependencies --value="$dependencies" +} + +ynh_add_app_dependencies () { + # Declare an array to define the options of this helper. + local legacy_args=pr + declare -Ar args_array=( [p]=package= [r]=replace) + local package + local replace + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + replace=${replace:-0} + + local current_dependencies="" + if [ $replace -eq 0 ] + then + local dep_app=${app//_/-} # Replace all '_' by '-' + if ynh_package_is_installed --package="${dep_app}-ynh-deps" + then + current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) " + fi + + current_dependencies=${current_dependencies// | /|} + fi + + ynh_install_app_dependencies "${current_dependencies}${package}" +} From e963673f42f2bdd9ada95a1e34181dfc31c9eb6e Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:31:31 +0100 Subject: [PATCH 38/60] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 71acb8a..1064aa0 100644 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,7 @@ source _common.sh source psql.sh source ynh_install_php +source ynh_add_extra_apt_repos source /usr/share/yunohost/helpers #================================================= From 28ac127bf7bbd13c637107c210fc14ce1813f628 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:33:28 +0100 Subject: [PATCH 39/60] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 1064aa0..ccda334 100644 --- a/scripts/install +++ b/scripts/install @@ -74,7 +74,7 @@ ynh_app_setting_set $app is_public $is_public # INSTALL DEPENDENCIES #================================================= ynh_install_php --phpversion=7.1 -ynh_install_app_dependencies php-zip php-mysql php-xml php-intl php-mbstring php-gd php-curl php-soap php-pgsql php-xmlrpc postgresql +ynh_install_app_dependencies php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql #================================================= # Create postgresql database #================================================= From 03ccba3075009a85f46023da5af6ccd6924bf58e Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:36:46 +0100 Subject: [PATCH 40/60] Update remove --- scripts/remove | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/remove b/scripts/remove index de52ef8..73d5bca 100644 --- a/scripts/remove +++ b/scripts/remove @@ -8,6 +8,7 @@ source _common.sh source psql.sh +source ynh_install_php source /usr/share/yunohost/helpers #================================================= @@ -58,6 +59,7 @@ ynh_print_info "Removing dependencies" # Remove metapackage and its dependencies ynh_remove_app_dependencies +ynh_remove_php #================================================= # REMOVE APP MAIN DIR From 27f22b9acfdb780e5554d78e01e96b0e0e73b52f Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:40:54 +0100 Subject: [PATCH 41/60] Update ynh_install_php --- scripts/ynh_install_php | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ynh_install_php b/scripts/ynh_install_php index 75bb6db..e4bb320 100644 --- a/scripts/ynh_install_php +++ b/scripts/ynh_install_php @@ -33,6 +33,7 @@ ynh_install_php () { # Install php-fpm first, otherwise php will install apache as a dependency. ynh_add_app_dependencies --package="php${phpversion}-fpm" ynh_add_app_dependencies --package="php$phpversion php${phpversion}-common $package" + ynh_add_app_dependencies php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc # Set php7.0 back as the default version for php-cli. update-alternatives --set php /usr/bin/php7.0 From 9a9bb1e1b69fcef974b2342945a6308702cd05ff Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:41:18 +0100 Subject: [PATCH 42/60] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ccda334..e87646e 100644 --- a/scripts/install +++ b/scripts/install @@ -74,7 +74,7 @@ ynh_app_setting_set $app is_public $is_public # INSTALL DEPENDENCIES #================================================= ynh_install_php --phpversion=7.1 -ynh_install_app_dependencies php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql +ynh_install_app_dependencies postgresql #================================================= # Create postgresql database #================================================= From de71b091ee31673f23d1e15585997fb04cad1484 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:44:56 +0100 Subject: [PATCH 43/60] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index e87646e..32db1d7 100644 --- a/scripts/install +++ b/scripts/install @@ -75,6 +75,7 @@ ynh_app_setting_set $app is_public $is_public #================================================= ynh_install_php --phpversion=7.1 ynh_install_app_dependencies postgresql +#ynh_install_app_dependencies php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql #================================================= # Create postgresql database #================================================= From e87be6c4bbc61e6371e081c5f82e2dd16903f951 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:46:52 +0100 Subject: [PATCH 44/60] Update ynh_install_php --- scripts/ynh_install_php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ynh_install_php b/scripts/ynh_install_php index e4bb320..1066727 100644 --- a/scripts/ynh_install_php +++ b/scripts/ynh_install_php @@ -33,8 +33,7 @@ ynh_install_php () { # Install php-fpm first, otherwise php will install apache as a dependency. ynh_add_app_dependencies --package="php${phpversion}-fpm" ynh_add_app_dependencies --package="php$phpversion php${phpversion}-common $package" - ynh_add_app_dependencies php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc - + # Set php7.0 back as the default version for php-cli. update-alternatives --set php /usr/bin/php7.0 From 1643b6c735007b0ee93ed0cc82e878a1ddb433ce Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:50:23 +0100 Subject: [PATCH 45/60] Update install --- scripts/install | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 32db1d7..89c628a 100644 --- a/scripts/install +++ b/scripts/install @@ -71,9 +71,11 @@ ynh_app_setting_set $app is_public $is_public #================================================= #================================================= -# INSTALL DEPENDENCIES +# INSTALL PHP7.3 AND DEPENDENCIES (EXP HELPER) #================================================= -ynh_install_php --phpversion=7.1 +ynh_print_info --message="Installing php7.1..." + +ynh_install_php --phpversion="7.1" --package="$extra_pkg_dependencies" ynh_install_app_dependencies postgresql #ynh_install_app_dependencies php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql #================================================= From 7c74710c9a429b431ff55084e478b42edf892f11 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:51:05 +0100 Subject: [PATCH 46/60] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 89c628a..aa45ee3 100644 --- a/scripts/install +++ b/scripts/install @@ -75,9 +75,9 @@ ynh_app_setting_set $app is_public $is_public #================================================= ynh_print_info --message="Installing php7.1..." +extra_pkg_dependencies="php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql" ynh_install_php --phpversion="7.1" --package="$extra_pkg_dependencies" -ynh_install_app_dependencies postgresql -#ynh_install_app_dependencies php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql + #================================================= # Create postgresql database #================================================= From 1d88e293c3fbaba4efe5f903bb1183bddf9c52d8 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:56:15 +0100 Subject: [PATCH 47/60] Update install --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index aa45ee3..efb5187 100644 --- a/scripts/install +++ b/scripts/install @@ -75,7 +75,6 @@ ynh_app_setting_set $app is_public $is_public #================================================= ynh_print_info --message="Installing php7.1..." -extra_pkg_dependencies="php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql" ynh_install_php --phpversion="7.1" --package="$extra_pkg_dependencies" #================================================= From 56bd42dbe99273c1496ac0dcb995886e3463028e Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:56:49 +0100 Subject: [PATCH 48/60] Update _common.sh --- scripts/_common.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index c726850..c6e7e5a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,6 +12,8 @@ ynh_delete_file_checksum () { ynh_app_setting_delete $app $checksum_setting_name } +extra_pkg_dependencies="php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql" + # Send an email to inform the administrator # # usage: ynh_send_readme_to_admin app_message [recipients] From 18d5714f8a22f9986d82485e3398f71d70026277 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 17:58:04 +0100 Subject: [PATCH 49/60] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index efb5187..259dfdc 100644 --- a/scripts/install +++ b/scripts/install @@ -128,7 +128,7 @@ ynh_system_user_create $app ### - And the section "PHP-FPM CONFIGURATION" in the upgrade script # Create a dedicated php-fpm config -ynh_add_fpm_config +ynh_add_fpm_config --phpversion="7.1" #================================================= # SPECIFIC SETUP From c23a3f5662c86091eb664e74dee1653c1d991aaa Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 18:35:21 +0100 Subject: [PATCH 50/60] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 74fc4df..169cdcb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,7 +16,7 @@ location __PATH__ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; # If you don't use a dedicated fpm config for your app, # use a general fpm pool. From 13f5fdb64823b8159a5083b87f4afbd268f59e03 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 18:37:34 +0100 Subject: [PATCH 51/60] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 259dfdc..c7c28a9 100644 --- a/scripts/install +++ b/scripts/install @@ -76,6 +76,7 @@ ynh_app_setting_set $app is_public $is_public ynh_print_info --message="Installing php7.1..." ynh_install_php --phpversion="7.1" --package="$extra_pkg_dependencies" +ynh_install_app_dependencies postgresql #================================================= # Create postgresql database From 01f35a8547daeec08aa380d4d3ac335c1a4f0f6d Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 18:37:53 +0100 Subject: [PATCH 52/60] Update _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c6e7e5a..b8c5f97 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,7 +12,7 @@ ynh_delete_file_checksum () { ynh_app_setting_delete $app $checksum_setting_name } -extra_pkg_dependencies="php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc postgresql" +extra_pkg_dependencies="php7.1-zip php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-soap php7.1-pgsql php7.1-xmlrpc" # Send an email to inform the administrator # From 157c0e2582a60d23dbd6e1039291488f0f3612f6 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 5 Nov 2019 18:41:36 +0100 Subject: [PATCH 53/60] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 169cdcb..74fc4df 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,7 +16,7 @@ location __PATH__ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; + fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; # If you don't use a dedicated fpm config for your app, # use a general fpm pool. From 7f23f7453abfc44bd1cf6014c301a98bd2292eb5 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 22 Jan 2020 15:57:38 +0100 Subject: [PATCH 54/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3057640..607a312 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Moodle app for YunoHost [![Install Moodle with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=Moodle)

-Version: **3.7.2** +Version: **3.8.1** Moodle - the world's open source learning platform Moodle is a learning platform designed to provide From eadb4e2fd85765ccae8904c943ede41209281e61 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 22 Jan 2020 15:57:53 +0100 Subject: [PATCH 55/60] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index e9536bd..b3a2e64 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Moodle package for YunoHost application.", "fr": "Moodle de package d’application pour YunoHost." }, - "version": "3.6.3", + "version": "3.8.2", "url": "https://moodle.org/", "license": "GPL-3.0", "maintainer": { From 158195436e057c7b1cecebceecdc5fb81a7b5561 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 22 Jan 2020 15:58:04 +0100 Subject: [PATCH 56/60] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index b3a2e64..5160959 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Moodle package for YunoHost application.", "fr": "Moodle de package d’application pour YunoHost." }, - "version": "3.8.2", + "version": "3.8.1", "url": "https://moodle.org/", "license": "GPL-3.0", "maintainer": { From c9c5c84625f6c1f5d6429bd43fa8c1f64c21eeaa Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 22 Jan 2020 16:01:21 +0100 Subject: [PATCH 57/60] Update app.src --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index cd24b61..743fc5a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://download.moodle.org/stable37/moodle-3.7.2.tgz -SOURCE_SUM=034722f7a10871965849aaac24bb487c5f0cac8132ef058729d068e538d8e2c3e2215304310b1a50d7cfdee4242c1094cf6d8323a5c2ecc5c98bd9bca295dfa0 +SOURCE_URL=https://download.moodle.org/stable38/moodle-3.8.1.tgz +SOURCE_SUM=bec050a92f682cee03cb70abfc350b7741522898dd21f5b5847f5c2ddfdd785ad404f6f06ed17b31bfa031aebe42bd35e3a205de686bd8627e92b9a919addb4c SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From bc5d1f7c822938198a4dd10b4f7779f1b68ad531 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 22 Jan 2020 16:02:00 +0100 Subject: [PATCH 58/60] Update backup --- scripts/backup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4e4230b..f501e0e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -27,9 +27,9 @@ ynh_abort_if_errors app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get $app final_path) -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app psql_db) +final_path=$(ynh_app_setting_get "$app" final_path) +domain=$(ynh_app_setting_get "$app" domain) +db_name=$(ynh_app_setting_get "$app" psql_db) #================================================= # STANDARD BACKUP STEPS From 36ed7091d7545fed7241ad64dd5c76486c740385 Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 22 Jan 2020 16:02:40 +0100 Subject: [PATCH 59/60] Update install --- scripts/install | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/scripts/install b/scripts/install index c7c28a9..6f6c0de 100644 --- a/scripts/install +++ b/scripts/install @@ -51,20 +51,20 @@ final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" # Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) +path_url=$(ynh_normalize_url_path "$path_url") # Check web path availability -ynh_webpath_available $domain $path_url +ynh_webpath_available "$domain" "$path_url" # Register (book) web path -ynh_webpath_register $app $domain $path_url +ynh_webpath_register "$app" "$domain" "$path_url" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path_url -ynh_app_setting_set $app is_public $is_public +ynh_app_setting_set "$app" domain "$domain" +ynh_app_setting_set "$app" path "$path_url" +ynh_app_setting_set "$app" is_public "$is_public" #================================================= # STANDARD MODIFICATIONS @@ -84,20 +84,20 @@ ynh_install_app_dependencies postgresql db_name=$app db_pwd=$(ynh_string_random 30) -ynh_app_setting_set $app psql_db $db_name -ynh_app_setting_set $app psqlpwd $db_pwd +ynh_app_setting_set "$app" psql_db "$db_name" +ynh_app_setting_set "$app" psqlpwd "$db_pwd" ynh_psql_test_if_first_run -ynh_psql_create_user $app $db_pwd +ynh_psql_create_user "$app" "$db_pwd" ynh_psql_execute_as_root \ "CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_app_setting_set $app final_path $final_path +ynh_app_setting_set "$app" final_path "$final_path" # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" -cp ../conf/config.php $final_path/. +cp ../conf/config.php "$final_path"/. #================================================= # NGINX CONFIGURATION @@ -111,7 +111,7 @@ ynh_add_nginx_config #================================================= # Create a system user -ynh_system_user_create $app +ynh_system_user_create "$app" #================================================= # PHP-FPM CONFIGURATION @@ -153,16 +153,16 @@ ynh_replace_string "YNH_VAR_ROOT" "$var_root" "$final_path/config.php" ynh_store_file_checksum "$final_path/config.php" # Create the home directory -mkdir -p $var_root -chown -R $app: $var_root -chmod -R 700 $var_root +mkdir -p "$var_root" +chown -R "$app": "$var_root" +chmod -R 700 "$var_root" #================================================= # SETUP APPLICATION WITH CURL #================================================= # Set right permissions for curl install -chown -R $app: $final_path +chown -R "$app": "$final_path" # Reload Nginx systemctl reload nginx @@ -174,26 +174,26 @@ systemctl reload nginx #================================================= # Set permissions to app files -chown root: $final_path/config.php +chown root: "$final_path"/config.php # Set up poller -sudo cp ../conf/cron /etc/cron.d/$app +sudo cp ../conf/cron /etc/cron.d/"$app" ynh_replace_string "YNH_DOMAIN" "$final_path" "/etc/cron.d/$app" #================================================= # SETUP SSOWAT #================================================= -if [ $is_public -eq 0 ] +if [ "$is_public" -eq 0 ] then # Remove the public access - ynh_app_setting_delete $app skipped_uris + ynh_app_setting_delete "$app" skipped_uris fi # Make app public if necessary -if [ $is_public -eq 1 ] +if [ "$is_public" -eq 1 ] then # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set $app unprotected_uris "/" + ynh_app_setting_set "$app" unprotected_uris "/" fi yunohost app ssowatconf From 5c9845213c80f35da35c6002f82f8ffe355470bb Mon Sep 17 00:00:00 2001 From: liberodark Date: Wed, 22 Jan 2020 16:03:33 +0100 Subject: [PATCH 60/60] Update remove --- scripts/remove | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/remove b/scripts/remove index 73d5bca..5f4e91e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -18,10 +18,10 @@ ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app psql_db) +domain=$(ynh_app_setting_get "$app" domain) +db_name=$(ynh_app_setting_get "$app" psql_db) db_user=$db_name -final_path=$(ynh_app_setting_get $app final_path) +final_path=$(ynh_app_setting_get "$app" final_path) #================================================= # STANDARD REMOVE @@ -30,10 +30,10 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status $app >/dev/null 2>&1 +if yunohost service status "$app" >/dev/null 2>&1 then ynh_print_info "Removing $app service" - yunohost service remove $app + yunohost service remove "$app" fi #================================================= @@ -50,7 +50,7 @@ ynh_remove_systemd_config ynh_print_info "Removing the PostgreSQL database" # Remove a database if it exists, along with the associated user -ynh_psql_remove_db $db_name $db_name +ynh_psql_remove_db "$db_name" "$db_name" #================================================= # REMOVE DEPENDENCIES @@ -117,7 +117,7 @@ ynh_secure_remove "/var/log/$app/" ynh_print_info "Removing the dedicated system user" # Delete a system user -ynh_system_user_delete $app +ynh_system_user_delete "$app" #================================================= # END OF SCRIPT