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

Fix clumsy check that tomcat is active/running ... if [ $(cmd) ] or if [ $var ] is hella ambiguous ...

This commit is contained in:
Alexandre Aubin 2024-08-05 18:08:49 +02:00
parent 97e2d4cb5c
commit d2c190549b
3 changed files with 6 additions and 41 deletions

View file

@ -17,22 +17,10 @@ ynh_script_progression --message="Stopping system tomcat..." --weight=1
# Guacamole depends on Apache Tomcat.
# 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
tomcat_enabled=""
tomcat_active=""
if [ "$(systemctl cat $tomcat_version --quiet)" ]; then
if (systemctl is-enabled $tomcat_version --quiet); then
tomcat_enabled=1
fi
if (systemctl is-active $tomcat_version --quiet); then
tomcat_active=1
fi
fi
if [ $tomcat_enabled ]; then
if systemctl is-enabled $tomcat_version --quiet 2>/dev/null; then
systemctl disable $tomcat_version --quiet
fi
if [ $tomcat_active ]; then
if systemctl is-active $tomcat_version --quiet 2>/dev/null; then
systemctl stop $tomcat_version --quiet
fi

View file

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

View file

@ -62,22 +62,10 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
# Guacamole depends on Apache Tomcat.
# 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
tomcat_enabled=""
tomcat_active=""
if [ "$(systemctl cat $tomcat_version --quiet)" ]; then
if (systemctl is-enabled $tomcat_version --quiet); then
tomcat_enabled=1
fi
if (systemctl is-active $tomcat_version --quiet); then
tomcat_active=1
fi
fi
if [ ! $tomcat_enabled ]; then
if systemctl is-enabled $tomcat_version --quiet 2>/dev/null; then
systemctl disable $tomcat_version --quiet
fi
if [ ! $tomcat_active ]; then
if systemctl is-active $tomcat_version --quiet 2>/dev/null; then
systemctl stop $tomcat_version --quiet
fi