diff --git a/manifest.json b/manifest.json index 216f2ed..cf812d0 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Install services and databases needed to support Dont-code platform", "fr": "Installe les services et base de données nécessaires pour utiliser la plateforme Dont-code" }, - "version": "0.2~ynh3", + "version": "0.2~ynh4", "url": "https://dont-code.net", "upstream": { "license": "AGPL-3.0-or-later", diff --git a/scripts/backup b/scripts/backup index 672fc79..3d2288b 100755 --- a/scripts/backup +++ b/scripts/backup @@ -33,6 +33,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) html_path=$(ynh_app_setting_get --app=$app --key=html_path) document_path=$(ynh_app_setting_get --app=$app --key=document_path) +public_key=$(ynh_app_setting_get --app=$app --key=public_key) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -65,7 +66,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP #================================================= -ynh_backup --src_path="/etc/sudoers.d/$app-sudoers" +if [ -n "$public_key" ] +then + ynh_backup --src_path="/etc/sudoers.d/$app-sudoers" +fi # BACKUP LOGROTATE diff --git a/scripts/install b/scripts/install index e94a4a1..b781a62 100755 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,7 @@ source _common.sh source ynh_mongo_db__2 -source ynh_java +source ynh_install_java source /usr/share/yunohost/helpers #================================================= @@ -77,7 +77,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available ports..." --weight=1 +ynh_script_progression --message="Finding available ports..." --weight=1 ### Use these lines if you have to open a port for the application ### `ynh_find_port` will find the first available port starting from the given port. diff --git a/scripts/remove b/scripts/remove index 78464db..e196716 100755 --- a/scripts/remove +++ b/scripts/remove @@ -8,7 +8,7 @@ source _common.sh source ynh_mongo_db__2 -source ynh_java +source ynh_install_java source /usr/share/yunohost/helpers #================================================= @@ -103,14 +103,20 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -ynh_secure_remove --file="/etc/sudoers.d/$app-sudoers" +if [ -n "$public_key" ] +then + ynh_secure_remove --file="/etc/sudoers.d/$app-sudoers" +fi #================================================= # REMOVE DEPENDENCIES #================================================= ynh_script_progression --message="Removing dependencies..." --weight=1 -# Remove metapackage and its dependencies, including java +# Remove java +ynh_remove_java + +# Remove apackage and its dependencies, including Java if needed ynh_remove_app_dependencies #================================================= diff --git a/scripts/restore b/scripts/restore index 340e6b6..a7fb393 100755 --- a/scripts/restore +++ b/scripts/restore @@ -9,7 +9,7 @@ # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source ../settings/scripts/ynh_mongo_db__2 -source ../settings/scripts/ynh_java +source ../settings/scripts/ynh_install_java source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fab7b44..7bb06ee 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,7 +8,7 @@ source _common.sh source ynh_mongo_db__2 -source ynh_java +source ynh_install_java source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/ynh_java b/scripts/ynh_install_java similarity index 88% rename from scripts/ynh_java rename to scripts/ynh_install_java index c8334f6..42002d4 100644 --- a/scripts/ynh_java +++ b/scripts/ynh_install_java @@ -114,6 +114,21 @@ ynh_install_java() { ynh_use_java } +# Remove the version of Java used by the app. +# +# As Java is installed using ynh_install_app_dependencies, it will be removed as well when you call ynh_remove_app_dependencies in your remove script +# +# usage: ynh_remove_java +ynh_remove_java () { + local java_version=$(ynh_app_setting_get --app=$YNH_APP_INSTANCE_NAME --key=java_version) + + # Remove the lines for this app + ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=java_version + ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=jdk_type + ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=java_engine + +} + # Extract the architecture used to run this script # sets ynh_architecture as arm64 or amd64 #