Prepare optional webgui setup (Apache, nginx, lighttpd)

This commit is contained in:
2026-08-28 20:00:10 +02:00
parent 93095c630c
commit 1bb98f2515
6 changed files with 78 additions and 5 deletions
-1
View File
@@ -12,7 +12,6 @@ Package: yms
Architecture: all
Depends:
mariadb-server,
httpd,
python3,
python3-gi,
gir1.2-gtk-3.0,
+1
View File
@@ -17,6 +17,7 @@ webgui/js/* usr/share/yms/webgui/js/
webgui/img/* usr/share/yms/webgui/img/
webgui/locale/de_DE/LC_MESSAGES/yms.mo usr/share/yms/webgui/locale/de_DE/LC_MESSAGES/
webgui/sailboat.svg usr/share/yms/webgui/
webgui/config.inc-sample usr/share/yms/
# Shared static data
shapes/* usr/share/yms/shapes/
+58 -1
View File
@@ -3,6 +3,28 @@ set -e
. /usr/share/debconf/confmodule
detect_webservers()
{
WEB_SERVERS=""
if dpkg-query -W -f='${Status}' apache2 2>/dev/null |
grep -q 'install ok installed'; then
WEB_SERVERS="$WEB_SERVERS apache2"
fi
if dpkg-query -W -f='${Status}' nginx 2>/dev/null |
grep -q 'install ok installed'; then
WEB_SERVERS="$WEB_SERVERS nginx"
fi
if dpkg-query -W -f='${Status}' lighttpd 2>/dev/null |
grep -q 'install ok installed'; then
WEB_SERVERS="$WEB_SERVERS lighttpd"
fi
WEB_SERVERS="${WEB_SERVERS# }"
}
db_get yms/db-name
DB_NAME="$RET"
@@ -30,7 +52,42 @@ fi
db_get yms/webgui
if [ "$RET" = "true" ]; then
# use web gui, depends on available web server
detect_webservers
case "$WEB_SERVERS" in
"")
echo "No supported webserver installed."
;;
apache2)
echo "Apache detected."
a2enconf yms
invoke-rc.d apache2 reload
echo "Web GUI for apache2 enabled."
;;
nginx)
echo "nginx detected."
;;
lighttpd)
echo "lighttpd detected."
;;
*)
echo "Multiple webservers detected: $WEB_SERVERS"
;;
esac
if [ ! -f /etc/yms/config.inc ]; then
# create initial configuration
sed \
-e "s|@DB_USERNAME@|$DB_USER|g" \
-e "s|@DB_PASSWORD@|$DB_PASSWORD|g" \
-e "s|@DB_SCHEMA@|$DB_NAME|g" \
/usr/share/yms/config.inc-sample \
> /etc/yms/config.inc
chmod 0640 /etc/yms/config.inc
chown root:www-data /etc/yms/config.inc
ln -s /etc/yms/config.inc /usr/share/yms/webgui/config.inc
fi
fi
exit 0