Skip to content
Snippets Groups Projects
Commit a6e2b549 authored by Bob Mottram's avatar Bob Mottram
Browse files

Placeholder web user interface

parent 1cea4926
No related branches found
No related tags found
No related merge requests found
......@@ -1076,6 +1076,9 @@ function setup_web {
function_check install_web_server_access_control
install_web_server_access_control
function_check install_web_local_user_interface
install_web_local_user_interface
}
function upgrade_apps {
......
......@@ -1070,4 +1070,29 @@ function email_install_tls {
fi
}
function install_web_local_user_interface {
# TODO
# This is intended as a placeholder for a potential local web user interface
# similar to Plinth or the yunohost admin interface
local_hostname=$(cat /etc/avahi/avahi-daemon.conf | grep 'host-name' | awk -F '=' '{print $2}').local
mkdir -p /var/www/${local_hostname}/htdocs
echo '<html>' > /var/www/${local_hostname}/htdocs/index.html
echo ' <body>' >> /var/www/${local_hostname}/htdocs/index.html
echo " This is a test on $local_hostname" >> /var/www/${local_hostname}/htdocs/index.html
echo ' </body>' >> /var/www/${local_hostname}/htdocs/index.html
echo '</html>' >> /var/www/${local_hostname}/htdocs/index.html
chown -R www-data:www-data /var/www/${local_hostname}/htdocs
nginx_file=/etc/nginx/sites-available/$local_hostname
echo 'server {' > $nginx_file
echo ' listen 80;' >> $nginx_file
echo ' listen [::]:80;' >> $nginx_file
echo " server_name ${local_hostname};" >> $nginx_file
echo " root /var/www/${local_hostname}/htdocs;" >> $nginx_file
echo ' index index.html;' >> $nginx_file
echo '}' >> $nginx_file
nginx_ensite $local_hostname
}
# NOTE: deliberately no exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment