From a6e2b5495066416adb90dc61fda58c3ac1700664 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 7 Jan 2018 14:47:43 +0000 Subject: [PATCH] Placeholder web user interface --- src/freedombone-utils-setup | 3 +++ src/freedombone-utils-web | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup index 51a1ca74..44d0c42d 100755 --- a/src/freedombone-utils-setup +++ b/src/freedombone-utils-setup @@ -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 { diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web index b4a1d461..3095a30b 100755 --- a/src/freedombone-utils-web +++ b/src/freedombone-utils-web @@ -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 '' > /var/www/${local_hostname}/htdocs/index.html + echo ' ' >> /var/www/${local_hostname}/htdocs/index.html + echo " This is a test on $local_hostname" >> /var/www/${local_hostname}/htdocs/index.html + echo ' ' >> /var/www/${local_hostname}/htdocs/index.html + echo '' >> /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