@@ -29,10 +29,87 @@ function update_script() {
2929 exit
3030 fi
3131
32+ if check_for_gh_tag " guacd" " apache/guacamole-server" ; then
33+ msg_info " Stopping guacd"
34+ systemctl stop guacd 2> /dev/null || true
35+ msg_ok " Stopped guacd"
36+
37+ ensure_dependencies \
38+ libcairo2-dev \
39+ libjpeg62-turbo-dev \
40+ libpng-dev \
41+ libtool-bin \
42+ uuid-dev \
43+ libvncserver-dev \
44+ freerdp3-dev \
45+ libssh2-1-dev \
46+ libtelnet-dev \
47+ libwebsockets-dev \
48+ libpulse-dev \
49+ libvorbis-dev \
50+ libwebp-dev \
51+ libssl-dev \
52+ libpango1.0-dev \
53+ libswscale-dev \
54+ libavcodec-dev \
55+ libavutil-dev \
56+ libavformat-dev
57+
58+ msg_info " Updating Guacamole Server (guacd)"
59+ fetch_and_deploy_gh_tag " guacd" " apache/guacamole-server" " ${CHECK_UPDATE_RELEASE} " " /opt/guacamole-server"
60+ cd /opt/guacamole-server
61+ export CPPFLAGS=" -Wno-error=deprecated-declarations"
62+ $STD autoreconf -fi
63+ $STD ./configure --with-init-dir=/etc/init.d --enable-allow-freerdp-snapshots
64+ $STD make
65+ $STD make install
66+ $STD ldconfig
67+ cd /opt
68+ rm -rf /opt/guacamole-server
69+ msg_ok " Updated Guacamole Server (guacd) to ${CHECK_UPDATE_RELEASE} "
70+
71+ if [[ ! -f /etc/guacamole/guacd.conf ]]; then
72+ mkdir -p /etc/guacamole
73+ cat << EOF >/etc/guacamole/guacd.conf
74+ [server]
75+ bind_host = 127.0.0.1
76+ bind_port = 4822
77+ EOF
78+ fi
79+
80+ if [[ ! -f /etc/systemd/system/guacd.service ]]; then
81+ cat << EOF >/etc/systemd/system/guacd.service
82+ [Unit]
83+ Description=Guacamole Proxy Daemon (guacd)
84+ After=network.target
85+
86+ [Service]
87+ Type=forking
88+ ExecStart=/etc/init.d/guacd start
89+ ExecStop=/etc/init.d/guacd stop
90+ ExecReload=/etc/init.d/guacd restart
91+ PIDFile=/var/run/guacd.pid
92+ Restart=on-failure
93+ RestartSec=5
94+
95+ [Install]
96+ WantedBy=multi-user.target
97+ EOF
98+ fi
99+
100+ if ! grep -q " guacd.service" /etc/systemd/system/termix.service 2> /dev/null; then
101+ sed -i ' /^After=network.target/s/$/ guacd.service/' /etc/systemd/system/termix.service
102+ sed -i ' /^\[Unit\]/a Wants=guacd.service' /etc/systemd/system/termix.service
103+ fi
104+
105+ systemctl daemon-reload
106+ systemctl enable -q --now guacd
107+ fi
108+
32109 if check_for_gh_release " termix" " Termix-SSH/Termix" ; then
33- msg_info " Stopping Service "
110+ msg_info " Stopping Termix "
34111 systemctl stop termix
35- msg_ok " Stopped Service "
112+ msg_ok " Stopped Termix "
36113
37114 msg_info " Backing up Data"
38115 cp -r /opt/termix/data /opt/termix_data_backup
@@ -95,16 +172,16 @@ function update_script() {
95172 sed -i ' s|/app/html|/opt/termix/html|g' /etc/nginx/nginx.conf
96173 sed -i ' s|/app/nginx|/opt/termix/nginx|g' /etc/nginx/nginx.conf
97174 sed -i ' s|listen ${PORT};|listen 80;|g' /etc/nginx/nginx.conf
98-
175+
99176 nginx -t && systemctl reload nginx
100177 msg_ok " Updated Nginx Configuration"
101178 else
102179 msg_warn " Nginx configuration not updated. If Termix doesn't work, restore from backup or update manually."
103180 fi
104181
105- msg_info " Starting Service "
182+ msg_info " Starting Termix "
106183 systemctl start termix
107- msg_ok " Started Service "
184+ msg_ok " Started Termix "
108185 msg_ok " Updated successfully!"
109186 fi
110187 exit
0 commit comments