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

Merge branch 'testing' into auto-helpers-2.1

This commit is contained in:
eric_G 2024-08-31 13:15:35 +02:00 committed by GitHub
commit 74c4601b14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 71 additions and 136 deletions

View file

@ -18,7 +18,7 @@ It shall NOT be edited by hand.
Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH
**Shipped version:** 1.5.4~ynh2 **Shipped version:** 1.5.5~ynh1
## Screenshots ## Screenshots

View file

@ -18,7 +18,7 @@ No se debe editar a mano.
Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH
**Versión actual:** 1.5.4~ynh2 **Versión actual:** 1.5.5~ynh1
## Capturas ## Capturas

View file

@ -18,7 +18,7 @@ EZ editatu eskuz.
Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH
**Paketatutako bertsioa:** 1.5.4~ynh2 **Paketatutako bertsioa:** 1.5.5~ynh1
## Pantaila-argazkiak ## Pantaila-argazkiak

View file

@ -18,7 +18,7 @@ Il NE doit PAS être modifié à la main.
Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH
**Version incluse:** 1.5.4~ynh2 **Version incluse:** 1.5.5~ynh1
## Captures décran ## Captures décran

View file

@ -18,7 +18,7 @@ NON debe editarse manualmente.
Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH
**Versión proporcionada:** 1.5.4~ynh2 **Versión proporcionada:** 1.5.5~ynh1
## Capturas de pantalla ## Capturas de pantalla

View file

@ -18,7 +18,7 @@ Ini TIDAK boleh diedit dengan tangan.
Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH
**Versi terkirim:** 1.5.4~ynh2 **Versi terkirim:** 1.5.5~ynh1
## Tangkapan Layar ## Tangkapan Layar
@ -28,7 +28,7 @@ Guacamole is a clientless remote desktop gateway. It supports standard protocols
- Website aplikasi resmi: <https://guacamole.apache.org/> - Website aplikasi resmi: <https://guacamole.apache.org/>
- Dokumentasi admin resmi: <https://guacamole.apache.org/doc/gug/> - Dokumentasi admin resmi: <https://guacamole.apache.org/doc/gug/>
- Repositori kode aplikasi hulu: <https://github.com/apache/guacamole-server> - Depot kode aplikasi hulu: <https://github.com/apache/guacamole-server>
- Gudang YunoHost: <https://apps.yunohost.org/app/guacamole> - Gudang YunoHost: <https://apps.yunohost.org/app/guacamole>
- Laporkan bug: <https://github.com/YunoHost-Apps/guacamole_ynh/issues> - Laporkan bug: <https://github.com/YunoHost-Apps/guacamole_ynh/issues>

View file

@ -18,7 +18,7 @@
Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH
**分发版本:** 1.5.4~ynh2 **分发版本:** 1.5.5~ynh1
## 截图 ## 截图

View file

@ -1,13 +1,13 @@
[Unit] [Unit]
Description=Apache Tomcat 9 Web Application Server Description=Apache Tomcat 9 Web Application Server
After=network.target After=network.target
RequiresMountsFor=/var/log/__APP__/tomcat __INSTALL_DIR__/var/lib/tomcat9 RequiresMountsFor=/var/log/__APP__/tomcat __INSTALL_DIR__/var/lib/__TOMCAT_VERSION__
[Service] [Service]
# Configuration # Configuration
Environment="CATALINA_HOME=/usr/share/tomcat9" Environment="CATALINA_HOME=/usr/share/__TOMCAT_VERSION__"
Environment="CATALINA_BASE=__INSTALL_DIR__/var/lib/tomcat9" Environment="CATALINA_BASE=__INSTALL_DIR__/var/lib/__TOMCAT_VERSION__"
Environment="CATALINA_TMPDIR=/tmp" Environment="CATALINA_TMPDIR=/tmp"
Environment="JAVA_OPTS=-Djava.awt.headless=true" Environment="JAVA_OPTS=-Djava.awt.headless=true"
Environment="GUACAMOLE_HOME=__INSTALL_DIR__/etc/guacamole" Environment="GUACAMOLE_HOME=__INSTALL_DIR__/etc/guacamole"
@ -15,13 +15,13 @@ Environment="GUACAMOLE_HOME=__INSTALL_DIR__/etc/guacamole"
# Lifecycle # Lifecycle
Type=simple Type=simple
ExecStartPre=+/usr/libexec/tomcat9/tomcat-update-policy.sh ExecStartPre=+/usr/libexec/__TOMCAT_VERSION__/tomcat-update-policy.sh
ExecStart=/bin/sh /usr/libexec/tomcat9/tomcat-start.sh > /var/log/__APP__/tomcat/tomcat.log 2>&1 ExecStart=/bin/sh /usr/libexec/__TOMCAT_VERSION__/tomcat-start.sh > /var/log/__APP__/tomcat/tomcat.log 2>&1
SuccessExitStatus=143 SuccessExitStatus=143
Restart=on-abort Restart=on-abort
# Logging # Logging
SyslogIdentifier=__APP__-tomcat9 SyslogIdentifier=__APP__-__TOMCAT_VERSION__
# Security # Security
User=__APP__-tomcat User=__APP__-tomcat
@ -29,11 +29,11 @@ Group=__APP__-tomcat
PrivateTmp=yes PrivateTmp=yes
AmbientCapabilities=CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true NoNewPrivileges=true
CacheDirectory=__APP__-tomcat9 CacheDirectory=__APP__-__TOMCAT_VERSION__
CacheDirectoryMode=750 CacheDirectoryMode=750
ProtectSystem=strict ProtectSystem=strict
ReadWritePaths=__INSTALL_DIR__/etc/tomcat9/Catalina/ ReadWritePaths=__INSTALL_DIR__/etc/__TOMCAT_VERSION__/Catalina/
ReadWritePaths=__INSTALL_DIR__/var/lib/tomcat9/webapps/ ReadWritePaths=__INSTALL_DIR__/var/lib/__TOMCAT_VERSION__/webapps/
ReadWritePaths=/var/log/__APP__/tomcat/ ReadWritePaths=/var/log/__APP__/tomcat/
[Install] [Install]

View file

@ -7,7 +7,7 @@ name = "Guacamole"
description.en = "Clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH" description.en = "Clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH"
description.fr = "Service de bureau à distance sans client. Fonctionne avec des protocoles standard comme VNC, RDP, et SSH" description.fr = "Service de bureau à distance sans client. Fonctionne avec des protocoles standard comme VNC, RDP, et SSH"
version = "1.5.4~ynh2" version = "1.5.5~ynh1"
maintainers = ["Jules Bertholet"] maintainers = ["Jules Bertholet"]
@ -43,35 +43,33 @@ ram.runtime = "50M"
type = "user" type = "user"
[install.init_main_permission] [install.init_main_permission]
help.en = "Not recommended"
help.fr = "Pas reccomandé"
type = "group" type = "group"
default = "all_users" default = "all_users"
[resources] [resources]
[resources.sources] [resources.sources]
[resources.sources.server] [resources.sources.server]
url = "https://downloads.apache.org/guacamole/1.5.4/source/guacamole-server-1.5.4.tar.gz" url = "https://downloads.apache.org/guacamole/1.5.5/source/guacamole-server-1.5.5.tar.gz"
sha256 = "4c0add552b1fc387c23a35c430155e01f2dfcf9daa0f96fbf805d0ace756729e" sha256 = "67499611c2e22d9c933763adc5408e716a4bfd08a3eb8a5ba2fc6f8f70868f6b"
[resources.sources.client] [resources.sources.client]
url = "https://downloads.apache.org/guacamole/1.5.4/binary/guacamole-1.5.4.war" url = "https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-1.5.5.war"
sha256 = "5728b563911bd64bce0a0b81c74ea8ccb2190d1785bff34030fc6885a8273d3e" sha256 = "4267307f3600663723f24af92d596e99c8359425315135052a42d451f9529200"
format = "zip" format = "zip"
extract = false extract = false
rename = "guacamole.war" rename = "guacamole.war"
[resources.sources.auth-header] [resources.sources.auth-header]
url = "https://downloads.apache.org/guacamole/1.5.4/binary/guacamole-auth-header-1.5.4.tar.gz" url = "https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-auth-header-1.5.5.tar.gz"
sha256 = "7a0adc0daa19ec69a0244f491222c62124b02f81f40aa91e9a94d06a2635d038" sha256 = "a39ca9563be6d31b4dc1251c76a62baeb2a9d4930b3055e342bb9ce80e526a78"
[resources.sources.auth-ldap] [resources.sources.auth-ldap]
url = "https://downloads.apache.org/guacamole/1.5.4/binary/guacamole-auth-ldap-1.5.4.tar.gz" url = "https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-auth-ldap-1.5.5.tar.gz"
sha256 = "f912fe921cd0d429a752709e31a37b931e95d88a47bc4007ab49377d1c1a6336" sha256 = "01d3cd74da5de9da9cc73a788ab2938dd44f5cbe42ad90eebb4bee07f246dfa3"
[resources.sources.auth-jdbc] [resources.sources.auth-jdbc]
url = "https://downloads.apache.org/guacamole/1.5.4/binary/guacamole-auth-jdbc-1.5.4.tar.gz" url = "https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-auth-jdbc-1.5.5.tar.gz"
sha256 = "f45736b28eb6647b7eb0d2b48331e12e5a432661f61115b63d1a05a5bd20244d" sha256 = "80cca0a02076babad0dc7c76b60daa896f3d9bf10be82708f425fd42ce411393"
[resources.sources.mariadb-java-client] [resources.sources.mariadb-java-client]
url = "https://downloads.mariadb.com/Connectors/java/connector-java-2.7.4/mariadb-java-client-2.7.4.jar" url = "https://downloads.mariadb.com/Connectors/java/connector-java-2.7.4/mariadb-java-client-2.7.4.jar"
@ -80,13 +78,6 @@ ram.runtime = "50M"
extract = false extract = false
rename = "mariadb-java-client.jar" rename = "mariadb-java-client.jar"
[resources.sources.tomcat9_deb]
url = "https://ftp.debian.org/debian/pool/main/t/tomcat9/tomcat9_9.0.43-2~deb11u10_all.deb"
sha256 = "0dd30fee78ecd3980e9ee3ba018071755ddf84e2288b860900709f1013e368ed"
format = "whatever"
extract = false
rename = "tomcat9.deb"
[resources.ports] [resources.ports]
main.default = 8080 main.default = 8080
guacd.default = 4822 guacd.default = 4822
@ -122,7 +113,7 @@ ram.runtime = "50M"
"libssl-dev", "libssl-dev",
"libvorbis-dev", "libvorbis-dev",
"libwebp-dev", "libwebp-dev",
"tomcat9", "tomcat9\\|tomcat10",
] ]
[resources.database] [resources.database]

View file

@ -4,31 +4,39 @@
# COMMON VARIABLES AND CUSTOM HELPERS # COMMON VARIABLES AND CUSTOM HELPERS
#================================================= #=================================================
guacamole_version="1.5.4" if [ "$YNH_DEBIAN_VERSION" == "bullseye" ] ; then
tomcat_version="tomcat9"
elif [ "$YNH_DEBIAN_VERSION" == "bookworm" ] ; then
tomcat_version="tomcat10"
fi
function setup_sources { function setup_sources {
ynh_setup_source --source_id="server" --dest_dir="$install_dir/.guacd-src" ynh_setup_source --source_id="server" --dest_dir="$install_dir/.guacd-src"
tomcat_guac_dir="$path" tomcat_guac_dir="$path"
if [ "$path" == "/" -o -z "$path" ]; then if [ "$path" == "/" ]; then
tomcat_guac_dir="ROOT" tomcat_guac_dir="ROOT"
fi fi
ynh_setup_source --source_id="tomcat9_deb" --dest_dir="$install_dir/downloads/tomcat9" mkdir -p $install_dir/downloads/$tomcat_version
pushd "$install_dir/downloads/tomcat9" || ynh_die pushd "$install_dir/downloads/$tomcat_version"
ar x "tomcat9.deb" "data.tar.xz" apt-get download $tomcat_version
# Gotta use eval such that the wildcard works zbgmpf
eval "mv tomcat*.deb tomcat.deb"
ar x "tomcat.deb" "data.tar.xz"
tar xJf data.tar.xz tar xJf data.tar.xz
popd || ynh_die popd
mkdir -p "$install_dir/etc" mkdir -p "$install_dir/etc"
cp -r "$install_dir/downloads/tomcat9/usr/share/tomcat9/etc" -T "$install_dir/etc/tomcat9/" cp -r "$install_dir/downloads/$tomcat_version/usr/share/$tomcat_version/etc" -T "$install_dir/etc/$tomcat_version/"
cp -r "$install_dir/downloads/tomcat9/etc/tomcat9/" -T "$install_dir/etc/tomcat9/" cp -r "$install_dir/downloads/$tomcat_version/etc/$tomcat_version/" -T "$install_dir/etc/$tomcat_version/"
ynh_setup_source --source_id="client" --dest_dir="$install_dir/downloads" ynh_setup_source --source_id="client" --dest_dir="$install_dir/downloads"
mkdir -p "$install_dir/var/lib/tomcat9/webapps" mkdir -p "$install_dir/var/lib/$tomcat_version/webapps"
mv "$install_dir/downloads/guacamole.war" "$install_dir/var/lib/tomcat9/webapps/$tomcat_guac_dir.war" mv "$install_dir/downloads/guacamole.war" "$install_dir/var/lib/$tomcat_version/webapps/$tomcat_guac_dir.war"
mkdir -p "$install_dir/etc/guacamole/extensions" mkdir -p "$install_dir/etc/guacamole/extensions"
guacamole_version="$(ynh_app_upstream_version)"
ynh_setup_source --source_id="auth-ldap" --dest_dir="$install_dir/downloads/auth-ldap" ynh_setup_source --source_id="auth-ldap" --dest_dir="$install_dir/downloads/auth-ldap"
mv "$install_dir/downloads/auth-ldap/guacamole-auth-ldap-$guacamole_version.jar" "$install_dir/etc/guacamole/extensions/guacamole-auth-ldap.jar" mv "$install_dir/downloads/auth-ldap/guacamole-auth-ldap-$guacamole_version.jar" "$install_dir/etc/guacamole/extensions/guacamole-auth-ldap.jar"
@ -51,10 +59,10 @@ function _set_permissions() {
setfacl -n -R -m "user:$app-guacd:rx" -m "default:user:$app-guacd:rx" "$install_dir" setfacl -n -R -m "user:$app-guacd:rx" -m "default:user:$app-guacd:rx" "$install_dir"
setfacl -n -R -m "user:$app-tomcat:rx" -m "default:user:$app-tomcat:rx" "$install_dir" setfacl -n -R -m "user:$app-tomcat:rx" -m "default:user:$app-tomcat:rx" "$install_dir"
# chown -R nobody:$app-tomcat "$install_dir/etc/tomcat9/" "$install_dir/etc/guacamole/" # chown -R nobody:$app-tomcat "$install_dir/etc/$tomcat_version/" "$install_dir/etc/guacamole/"
chown -R "$app-tomcat":"$app-tomcat" "$install_dir/var/lib/tomcat9/webapps" chown -R "$app-tomcat":"$app-tomcat" "$install_dir/var/lib/$tomcat_version/webapps"
setfacl -n -R -m "user:$app-guacd:-" -m "default:user:$app-guacd:-" \ setfacl -n -R -m "user:$app-guacd:-" -m "default:user:$app-guacd:-" \
"$install_dir/var/lib/tomcat9/" "$install_dir/etc/guacamole/" "$install_dir/etc/tomcat9/" "$install_dir/var/lib/$tomcat_version/" "$install_dir/etc/guacamole/" "$install_dir/etc/$tomcat_version/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app-guacd:$app-guacd" "/var/log/$app/guacd/" #REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app-guacd:$app-guacd" "/var/log/$app/guacd/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app-tomcat:$app-tomcat" "/var/log/$app/tomcat/" #REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app-tomcat:$app-tomcat" "/var/log/$app/tomcat/"

View file

@ -36,7 +36,7 @@ if [ $change_path -eq 1 ]; then
new_path_tomcat="ROOT" new_path_tomcat="ROOT"
fi fi
mv "$install_dir/var/lib/tomcat9/webapps/$old_path_tomcat" "$install_dir/var/lib/tomcat9/webapps/$new_path_tomcat" mv "$install_dir/var/lib/$tomcat_version/webapps/$old_path_tomcat" "$install_dir/var/lib/$tomcat_version/webapps/$new_path_tomcat"
fi fi
#================================================= #=================================================

View file

@ -11,23 +11,11 @@ ynh_script_progression "Stopping system tomcat..."
# Guacamole depends on Apache Tomcat. # Guacamole depends on Apache Tomcat.
# But installing Tomcat from the Debian repos automatically enables and starts it. # But installing Tomcat from the Debian repos automatically enables and starts it.
# So we stop and disable it, unless Tomcat was already enabled or started by the user beforehand # So we stop and disable it, unless Tomcat was already enabled or started by the user beforehand
if systemctl is-enabled $tomcat_version --quiet 2>/dev/null; then
tomcat_enabled="" systemctl disable $tomcat_version --quiet
tomcat_active=""
if [ "$(systemctl cat tomcat9 --quiet)" ]; then
if (systemctl is-enabled tomcat9 --quiet); then
tomcat_enabled=1
fi
if (systemctl is-active tomcat9 --quiet); then
tomcat_active=1
fi
fi fi
if systemctl is-active $tomcat_version --quiet 2>/dev/null; then
if [ $tomcat_enabled ]; then systemctl stop $tomcat_version --quiet
systemctl disable tomcat9 --quiet
fi
if [ $tomcat_active ]; then
systemctl stop tomcat9 --quiet
fi fi
#================================================= #=================================================
@ -35,7 +23,6 @@ fi
#================================================= #=================================================
ynh_script_progression "Configuring system users..." ynh_script_progression "Configuring system users..."
# Create system users
ynh_system_user_create --username="$app-guacd" --groups="$app" ynh_system_user_create --username="$app-guacd" --groups="$app"
ynh_system_user_create --username="$app-tomcat" --groups="$app" ynh_system_user_create --username="$app-tomcat" --groups="$app"
@ -44,14 +31,13 @@ ynh_system_user_create --username="$app-tomcat" --groups="$app"
#================================================= #=================================================
ynh_script_progression "Setting up source files..." ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
setup_sources setup_sources
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/"
mkdir -p "$install_dir/etc/" mkdir -p "$install_dir/etc/"
ln -s -f "$install_dir/etc/tomcat9" "$install_dir/var/lib/tomcat9/conf" ln -s -f "$install_dir/etc/$tomcat_version" "$install_dir/var/lib/$tomcat_version/conf"
ln -s -f "/var/log/$app/tomcat/" "$install_dir/var/lib/tomcat9/logs" ln -s -f "/var/log/$app/tomcat/" "$install_dir/var/lib/$tomcat_version/logs"
ln -s -f "/var/cache/$app-tomcat9" "$install_dir/var/lib/tomcat9/work" ln -s -f "/var/cache/$app-$tomcat_version" "$install_dir/var/lib/$tomcat_version/work"
#================================================= #=================================================
# ADD CONFIGURATIONS # ADD CONFIGURATIONS
@ -92,20 +78,16 @@ ynh_safe_rm "$install_dir/etc/guacamole/extensions/mysql-schema"
#================================================= #=================================================
ynh_script_progression "Adding system configurations related to $app..." ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
# Create dedicated systemd configs
ynh_config_add_systemd --service="$app-guacd" --template="guacd.service" ynh_config_add_systemd --service="$app-guacd" --template="guacd.service"
yunohost service add "$app-guacd" --description="Guacamole server" --log="/var/log/$app/guacd.log" yunohost service add "$app-guacd" --description="Guacamole server" --log="/var/log/$app/guacd.log"
ynh_config_add_systemd --service="$app-tomcat" --template="tomcat.service" ynh_config_add_systemd --service="$app-tomcat" --template="tomcat.service"
yunohost service add "$app-tomcat" --description="Guacamole client" --log="/var/log/$app/tomcat.log" yunohost service add "$app-tomcat" --description="Guacamole client" --log="/var/log/$app/tomcat.log"
# Use logrotate to manage application logfile(s)
ynh_config_add_logrotate "/var/log/$app/tomcat/catalina.out" ynh_config_add_logrotate "/var/log/$app/tomcat/catalina.out"
# Create a dedicated Fail2Ban config
ynh_config_add_fail2ban --logpath="/var/log/syslog" --failregex='o.a.g.r.auth.AuthenticationService - Authentication attempt from <HOST> for user "[^"]*" failed\.$' ynh_config_add_fail2ban --logpath="/var/log/syslog" --failregex='o.a.g.r.auth.AuthenticationService - Authentication attempt from <HOST> for user "[^"]*" failed\.$'
#================================================= #=================================================
@ -113,7 +95,6 @@ ynh_config_add_fail2ban --logpath="/var/log/syslog" --failregex='o.a.g.r.auth.Au
#================================================= #=================================================
ynh_script_progression "Starting $app's systemd services..." ynh_script_progression "Starting $app's systemd services..."
# Start systemd services
ynh_systemctl --service="$app-guacd" --action="start" --log_path="/var/log/$app/guacd.log" ynh_systemctl --service="$app-guacd" --action="start" --log_path="/var/log/$app/guacd.log"
ynh_systemctl --service="$app-tomcat" --action="start" --log_path="/var/log/$app/tomcat.log" ynh_systemctl --service="$app-tomcat" --action="start" --log_path="/var/log/$app/tomcat.log"

View file

@ -15,32 +15,20 @@ if ynh_hide_warnings yunohost service status $app-tomcat >/dev/null; then
yunohost service remove "$app-tomcat" yunohost service remove "$app-tomcat"
fi fi
# Remove the dedicated systemd config
ynh_config_remove_systemd"$app-guacd" ynh_config_remove_systemd"$app-guacd"
ynh_config_remove_systemd"$app-tomcat" ynh_config_remove_systemd"$app-tomcat"
# Remove the dedicated NGINX config
ynh_config_remove_nginx ynh_config_remove_nginx
# Remove the app-specific logrotate config
ynh_config_remove_logrotate ynh_config_remove_logrotate
# Remove the dedicated Fail2Ban config
ynh_config_remove_fail2ban ynh_config_remove_fail2ban
#=================================================
# REMOVE VARIOUS FILES
#=================================================
# Remove the log files
#REMOVEME? (Apps should not remove their log dir during remove ... this should only happen if --purge is used, and be handled by the core...) ynh_safe_rm "/var/log/$app"
#================================================= #=================================================
# REMOVE DEDICATED USERS # REMOVE DEDICATED USERS
#================================================= #=================================================
ynh_script_progression "Removing the dedicated system users..." ynh_script_progression "Removing the dedicated system users..."
# Delete a system user
ynh_system_user_delete --username="$app-guacd" ynh_system_user_delete --username="$app-guacd"
ynh_system_user_delete --username="$app-tomcat" ynh_system_user_delete --username="$app-tomcat"

View file

@ -9,22 +9,11 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression "Stopping system tomcat..." ynh_script_progression "Stopping system tomcat..."
tomcat_enabled="" if systemctl is-enabled $tomcat_version --quiet 2>/dev/null; then
tomcat_active="" systemctl disable $tomcat_version --quiet
if [ "$(systemctl cat tomcat9 --quiet)" ]; then
if (systemctl is-enabled tomcat9 --quiet); then
tomcat_enabled=1
fi
if (systemctl is-active tomcat9 --quiet); then
tomcat_active=1
fi
fi fi
if systemctl is-active $tomcat_version --quiet 2>/dev/null; then
if [ ! $tomcat_enabled ]; then systemctl stop $tomcat_version --quiet
systemctl disable tomcat9 --quiet
fi
if [ ! $tomcat_active ]; then
systemctl stop tomcat9 --quiet
fi fi
#================================================= #=================================================

View file

@ -14,31 +14,22 @@ ynh_systemctl --service="$app-tomcat" --action="stop" --log_path="/var/log/$app/
#================================================= #=================================================
# CREATE DEDICATED USERS # CREATE DEDICATED USERS
#================================================= #=================================================
#REMOVEME? ynh_script_progression "Making sure dedicated system user exists..."
# Create dedicated users (if not existing)
ynh_system_user_create --username="$app-guacd" ynh_system_user_create --username="$app-guacd"
ynh_system_user_create --username="$app-tomcat" ynh_system_user_create --username="$app-tomcat"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression "Upgrading source files..."
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed setup_sources
if ynh_app_upstream_version_changed
then
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
setup_sources
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression "Upgrading NGINX web server configuration..." ynh_script_progression "Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
#================================================= #=================================================
@ -49,23 +40,11 @@ ynh_script_progression "Upgrading dependencies..."
# Guacamole depends on Apache Tomcat. # Guacamole depends on Apache Tomcat.
# But installing Tomcat from the Debian repos automatically enables and starts it. # But installing Tomcat from the Debian repos automatically enables and starts it.
# So we stop and disable it, unless Tomcat was already enabled or started by the user beforehand # So we stop and disable it, unless Tomcat was already enabled or started by the user beforehand
if systemctl is-enabled $tomcat_version --quiet 2>/dev/null; then
tomcat_enabled="" systemctl disable $tomcat_version --quiet
tomcat_active=""
if [ "$(systemctl cat tomcat9 --quiet)" ]; then
if (systemctl is-enabled tomcat9 --quiet); then
tomcat_enabled=1
fi
if (systemctl is-active tomcat9 --quiet); then
tomcat_active=1
fi
fi fi
if systemctl is-active $tomcat_version --quiet 2>/dev/null; then
if [ ! $tomcat_enabled ]; then systemctl stop $tomcat_version --quiet
systemctl disable tomcat9 --quiet
fi
if [ ! $tomcat_active ]; then
systemctl stop tomcat9 --quiet
fi fi
#================================================= #=================================================
@ -84,9 +63,9 @@ popd
#================================================= #=================================================
mkdir -p "$install_dir/etc/" mkdir -p "$install_dir/etc/"
ln -s -f "$install_dir/etc/tomcat9" "$install_dir/var/lib/tomcat9/conf" ln -s -f "$install_dir/etc/$tomcat_version" "$install_dir/var/lib/$tomcat_version/conf"
ln -s -f "/var/log/$app/tomcat/" "$install_dir/var/lib/tomcat9/logs" ln -s -f "/var/log/$app/tomcat/" "$install_dir/var/lib/$tomcat_version/logs"
ln -s -f "/var/cache/$app-tomcat9" "$install_dir/var/lib/tomcat9/work" ln -s -f "/var/cache/$app-$tomcat_version" "$install_dir/var/lib/$tomcat_version/work"
#================================================= #=================================================
# CREATE LOG DIRS # CREATE LOG DIRS
@ -107,7 +86,6 @@ ynh_replace --match="8080" --replace="$port" --file="$install_dir/etc/tomcat9/se
#================================================= #=================================================
ynh_script_progression "Upgrading systemd configuration..." ynh_script_progression "Upgrading systemd configuration..."
# Create dedicated systemd configs
ynh_config_add_systemd --service="$app-guacd" --template="guacd.service" ynh_config_add_systemd --service="$app-guacd" --template="guacd.service"
ynh_config_add_systemd --service="$app-tomcat" --template="tomcat.service" ynh_config_add_systemd --service="$app-tomcat" --template="tomcat.service"