1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/guacamole_ynh.git synced 2024-09-03 19:16:03 +02:00

Apply example_ynh

This commit is contained in:
yalh76 2022-10-06 00:37:07 +02:00
parent 44415d4268
commit bfcc073094
11 changed files with 69 additions and 59 deletions

View file

@ -2,8 +2,8 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john"
is_public=0 is_public=0
admin="john"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -12,6 +12,8 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 1.4.0~ynh1
upgrade=1 from_commit=e90a004a9ee4760dfd9f860f6dc9eafa87671094
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0
@ -19,7 +21,3 @@
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Apache Guacamole is a clientless remote desktop gateway. You can use it to access your server, or other machines, via protocols like VNC, RDP, SSH, and SFTP. It supports multiple users, and you can configure which useres are allowed to access what connections.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
Service de bureau à distance sans client. Fonctionne avec des protocoles standard comme VNC, RDP, et SSH.

View file

@ -28,7 +28,7 @@
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain" "type": "domain"
@ -39,10 +39,6 @@
"example": "/guacamole", "example": "/guacamole",
"default": "/guacamole" "default": "/guacamole"
}, },
{
"name": "admin",
"type": "user"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
@ -51,6 +47,10 @@
"en": "Not recommended", "en": "Not recommended",
"fr": "Pas reccomandé" "fr": "Pas reccomandé"
} }
},
{
"name": "admin",
"type": "user"
} }
] ]
} }

View file

@ -4,7 +4,7 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app (must be on a single line)
pkg_dependencies="acl build-essential libcairo2 libjpeg62-turbo-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libwebsockets-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev tomcat9" pkg_dependencies="acl build-essential libcairo2 libjpeg62-turbo-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libwebsockets-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev tomcat9"
#================================================= #=================================================

View file

@ -28,6 +28,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================

View file

@ -25,8 +25,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -156,6 +156,7 @@ popd || ynh_die
#================================================= #=================================================
# SETUP TOMCAT # SETUP TOMCAT
#================================================= #=================================================
ynh_script_progression --message="Setuping Tomcat..." --weight=30
mkdir -p "$final_path/etc/" mkdir -p "$final_path/etc/"
ln -s -f "$final_path/etc/tomcat9" "$final_path/var/lib/tomcat9/conf" ln -s -f "$final_path/etc/tomcat9" "$final_path/var/lib/tomcat9/conf"
@ -165,11 +166,13 @@ ln -s -f "/var/cache/$app-tomcat9" "$final_path/var/lib/tomcat9/work"
#================================================= #=================================================
# CREATE LOG DIRS # CREATE LOG DIRS
#================================================= #=================================================
mkdir -p "/var/log/$app/tomcat/" "/var/log/$app/guacd/" "/var/log/$app/tomcat/" mkdir -p "/var/log/$app/tomcat/" "/var/log/$app/guacd/" "/var/log/$app/tomcat/"
#================================================= #=================================================
# ADD CONFIGURATIONS # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="guacamole.properties" --destination="$final_path/etc/guacamole/guacamole.properties" ynh_add_config --template="guacamole.properties" --destination="$final_path/etc/guacamole/guacamole.properties"
@ -184,8 +187,6 @@ ynh_script_progression --message="Configuring systemd services..." --weight=1
ynh_add_systemd_config --service="$app-guacd" --template="guacd.service" ynh_add_systemd_config --service="$app-guacd" --template="guacd.service"
ynh_add_systemd_config --service="$app-tomcat" --template="tomcat.service" ynh_add_systemd_config --service="$app-tomcat" --template="tomcat.service"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
@ -201,6 +202,8 @@ chown -R nobody:$app-tomcat "$final_path/etc/tomcat9/" "$final_path/etc/guacamol
chown -R "$app-tomcat":"$app-tomcat" "$final_path/var/lib/tomcat9/webapps" chown -R "$app-tomcat":"$app-tomcat" "$final_path/var/lib/tomcat9/webapps"
setfacl -n -R -m user:$app-guacd:- -m default:user:$app-guacd:- "$final_path/var/lib/tomcat9/" "$final_path/etc/guacamole/" "$final_path/etc/tomcat9/" setfacl -n -R -m user:$app-guacd:- -m default:user:$app-guacd:- "$final_path/var/lib/tomcat9/" "$final_path/etc/guacamole/" "$final_path/etc/tomcat9/"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================

View file

@ -31,10 +31,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression --message="Removing $app service integration..." --weight=1
if ynh_exec_warn_less yunohost service status $app-guacd >/dev/null; then if ynh_exec_warn_less yunohost service status $app-guacd >/dev/null
then
yunohost service remove "$app-guacd" yunohost service remove "$app-guacd"
fi fi
if ynh_exec_warn_less yunohost service status $app-tomcat >/dev/null; then if ynh_exec_warn_less yunohost service status $app-tomcat >/dev/null
then
yunohost service remove "$app-tomcat" yunohost service remove "$app-tomcat"
fi fi
@ -47,6 +49,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config --service="$app-guacd" ynh_remove_systemd_config --service="$app-guacd"
ynh_remove_systemd_config --service="$app-tomcat" ynh_remove_systemd_config --service="$app-tomcat"
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
@ -55,14 +65,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
@ -80,12 +82,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1 ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove the app-specific logrotate config # Remove metapackage and its dependencies
ynh_remove_logrotate ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE FAIL2BAN CONFIGURATION # REMOVE FAIL2BAN CONFIGURATION

View file

@ -43,13 +43,6 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -71,8 +64,8 @@ ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1 ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban ynh_systemd_action --action=restart --service_name=fail2ban
#================================================= #=================================================
@ -116,6 +109,13 @@ chown -R nobody:$app-tomcat "$final_path/etc/tomcat9/" "$final_path/etc/guacamol
chown -R "$app-tomcat":"$app-tomcat" "$final_path/var/lib/tomcat9/webapps" chown -R "$app-tomcat":"$app-tomcat" "$final_path/var/lib/tomcat9/webapps"
setfacl -n -R -m user:$app-guacd:- -m default:user:$app-guacd:- "$final_path/var/lib/tomcat9/" "$final_path/etc/guacamole/" "$final_path/etc/tomcat9/" setfacl -n -R -m user:$app-guacd:- -m default:user:$app-guacd:- "$final_path/var/lib/tomcat9/" "$final_path/etc/guacamole/" "$final_path/etc/tomcat9/"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
@ -128,7 +128,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#================================================= #=================================================
# RESTORE VARIOUS FILES # RESTORE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Restoring various files..." ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file --origin_path="/var/log/$app" ynh_restore_file --origin_path="/var/log/$app"
chown -R $app-guacd:$app-guacd "/var/log/$app/guacd/" chown -R $app-guacd:$app-guacd "/var/log/$app/guacd/"
@ -144,6 +144,13 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app-tomcat.service"
systemctl enable "$app-guacd.service" --quiet systemctl enable "$app-guacd.service" --quiet
systemctl enable "$app-tomcat.service" --quiet systemctl enable "$app-tomcat.service" --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# INTEGRATE SERVICES IN YUNOHOST # INTEGRATE SERVICES IN YUNOHOST
#================================================= #=================================================
@ -160,13 +167,6 @@ ynh_script_progression --message="Starting systemd services..." --weight=1
ynh_systemd_action --service_name="$app-guacd" --action="start" --log_path="/var/log/$app/guacd.log" ynh_systemd_action --service_name="$app-guacd" --action="start" --log_path="/var/log/$app/guacd.log"
ynh_systemd_action --service_name="$app-tomcat" --action="start" --log_path="/var/log/$app/tomcat.log" ynh_systemd_action --service_name="$app-tomcat" --action="start" --log_path="/var/log/$app/tomcat.log"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -29,7 +29,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..." ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
@ -78,14 +78,6 @@ then
setup_sources setup_sources
fi fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
@ -115,6 +107,14 @@ if [ ! $tomcat_active ]; then
systemctl stop tomcat9 --quiet systemctl stop tomcat9 --quiet
fi fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -131,6 +131,7 @@ popd || ynh_die
#================================================= #=================================================
# SETUP TOMCAT # SETUP TOMCAT
#================================================= #=================================================
ynh_script_progression --message="Setuping Tomcat..." --weight=30
mkdir -p "$final_path/etc/" mkdir -p "$final_path/etc/"
ln -s -f "$final_path/etc/tomcat9" "$final_path/var/lib/tomcat9/conf" ln -s -f "$final_path/etc/tomcat9" "$final_path/var/lib/tomcat9/conf"
@ -140,11 +141,13 @@ ln -s -f "/var/cache/$app-tomcat9" "$final_path/var/lib/tomcat9/work"
#================================================= #=================================================
# CREATE LOG DIRS # CREATE LOG DIRS
#================================================= #=================================================
mkdir -p "/var/log/$app/tomcat/" "/var/log/$app/guacd/" "/var/log/$app/tomcat/" mkdir -p "/var/log/$app/tomcat/" "/var/log/$app/guacd/" "/var/log/$app/tomcat/"
#================================================= #=================================================
# UPDATE CONFIG FILES # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="guacamole.properties" --destination="$final_path/etc/guacamole/guacamole.properties" ynh_add_config --template="guacamole.properties" --destination="$final_path/etc/guacamole/guacamole.properties"
@ -159,8 +162,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
ynh_add_systemd_config --service="$app-guacd" --template="guacd.service" ynh_add_systemd_config --service="$app-guacd" --template="guacd.service"
ynh_add_systemd_config --service="$app-tomcat" --template="tomcat.service" ynh_add_systemd_config --service="$app-tomcat" --template="tomcat.service"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
@ -176,6 +177,8 @@ chown -R nobody:$app-tomcat "$final_path/etc/tomcat9/" "$final_path/etc/guacamol
chown -R "$app-tomcat":"$app-tomcat" "$final_path/var/lib/tomcat9/webapps" chown -R "$app-tomcat":"$app-tomcat" "$final_path/var/lib/tomcat9/webapps"
setfacl -n -R -m user:$app-guacd:- -m default:user:$app-guacd:- "$final_path/var/lib/tomcat9/" "$final_path/etc/guacamole/" "$final_path/etc/tomcat9/" setfacl -n -R -m user:$app-guacd:- -m default:user:$app-guacd:- "$final_path/var/lib/tomcat9/" "$final_path/etc/guacamole/" "$final_path/etc/tomcat9/"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================