1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dont-code_ynh.git synced 2024-09-03 18:26:34 +02:00

New version of Java helpers and fix for sudoers backup

This commit is contained in:
Gérard Collin 2023-01-31 16:47:54 +01:00
parent a5cca55148
commit 76daa53c46
7 changed files with 34 additions and 9 deletions

View file

@ -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",

View file

@ -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

View file

@ -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.

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -8,7 +8,7 @@
source _common.sh
source ynh_mongo_db__2
source ynh_java
source ynh_install_java
source /usr/share/yunohost/helpers
#=================================================

View file

@ -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
#