diff --git a/check_process b/check_process index ccf1005..f029659 100644 --- a/check_process +++ b/check_process @@ -2,8 +2,8 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" is_public=0 + admin="john" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -12,6 +12,8 @@ setup_private=1 setup_public=1 upgrade=1 + # 1.4.0~ynh1 + upgrade=1 from_commit=e90a004a9ee4760dfd9f860f6dc9eafa87671094 backup_restore=1 multi_instance=1 port_already_use=0 @@ -19,7 +21,3 @@ ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1& diff --git a/conf/nginx.conf b/conf/nginx.conf index 54bd0de..be08498 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -12,4 +12,4 @@ location __PATH__ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; -} \ No newline at end of file +} diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..f19388d --- /dev/null +++ b/doc/DESCRIPTION.md @@ -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. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..0f76e51 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Service de bureau à distance sans client. Fonctionne avec des protocoles standard comme VNC, RDP, et SSH. diff --git a/manifest.json b/manifest.json index f30118c..2e3030e 100644 --- a/manifest.json +++ b/manifest.json @@ -28,7 +28,7 @@ "mysql" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -39,10 +39,6 @@ "example": "/guacamole", "default": "/guacamole" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", @@ -51,6 +47,10 @@ "en": "Not recommended", "fr": "Pas reccomandé" } + }, + { + "name": "admin", + "type": "user" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index e98b2bf..fb21b46 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # 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" #================================================= diff --git a/scripts/change_url b/scripts/change_url index 7a634cc..4bf9d2c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,6 +28,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" 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) #================================================= diff --git a/scripts/install b/scripts/install index ae0322f..8e19c83 100755 --- a/scripts/install +++ b/scripts/install @@ -25,8 +25,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME @@ -156,6 +156,7 @@ popd || ynh_die #================================================= # SETUP TOMCAT #================================================= +ynh_script_progression --message="Setuping Tomcat..." --weight=30 mkdir -p "$final_path/etc/" 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 #================================================= + 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" @@ -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-tomcat" --template="tomcat.service" -#================================================= -# GENERIC FINALIZATION #================================================= # 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" 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 #================================================= diff --git a/scripts/remove b/scripts/remove index c36b3d3..fe3dfa6 100755 --- a/scripts/remove +++ b/scripts/remove @@ -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`) 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" 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" 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-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 #================================================= @@ -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 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 #================================================= @@ -80,12 +82,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- 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 -ynh_remove_logrotate +# Remove metapackage and its dependencies +ynh_remove_app_dependencies #================================================= # REMOVE FAIL2BAN CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 2cb58bf..e1aacf0 100755 --- a/scripts/restore +++ b/scripts/restore @@ -43,13 +43,6 @@ test ! -d $final_path \ #================================================= # 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 #================================================= @@ -71,8 +64,8 @@ ynh_restore_file --origin_path="$final_path" #================================================= ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1 -ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" +ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" +ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" 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" 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 #================================================= @@ -128,7 +128,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= # 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" 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-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 #================================================= @@ -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-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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index de25050..c98dab4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,7 +29,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." +ynh_script_progression --message="Checking version..." --weight=1 upgrade_type=$(ynh_check_app_version_changed) @@ -78,14 +78,6 @@ then setup_sources 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 #================================================= @@ -115,6 +107,14 @@ if [ ! $tomcat_active ]; then systemctl stop tomcat9 --quiet 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 #================================================= @@ -131,6 +131,7 @@ popd || ynh_die #================================================= # SETUP TOMCAT #================================================= +ynh_script_progression --message="Setuping Tomcat..." --weight=30 mkdir -p "$final_path/etc/" 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 #================================================= + 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" @@ -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-tomcat" --template="tomcat.service" -#================================================= -# GENERIC FINALIZATION #================================================= # 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" 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 #=================================================