From 309687a43a75c2e8d14ff5cdf2f98e5dcb42d07b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 25 May 2018 12:19:17 +0100 Subject: [PATCH] Create directory for android app integration --- src/freedombone-utils-web | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web index 81a70e2a..ca7bcce7 100755 --- a/src/freedombone-utils-web +++ b/src/freedombone-utils-web @@ -1143,13 +1143,15 @@ function install_web_local_user_interface { # similar to Plinth or the yunohost admin interface local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local - mkdir -p "/var/www/${local_hostname}/htdocs" + if [ ! -d "/var/www/${local_hostname}/htdocs" ]; then + mkdir -p "/var/www/${local_hostname}/htdocs" + fi + { echo ''; echo ' '; echo " This is a test on $local_hostname"; echo ' '; 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 {'; @@ -1160,6 +1162,15 @@ function install_web_local_user_interface { echo ' index index.html;'; echo '}'; } > "$nginx_file" nginx_ensite "$local_hostname" + + # Compatibility with FreedomBox android app + # The installed apps get published to a json file called "1" + # in this directory + if [ ! -d "/var/www/${local_hostname}/htdocs/plinth/api" ]; then + mkdir -p "/var/www/${local_hostname}/htdocs/plinth/api" + fi + + chown -R www-data:www-data "/var/www/${local_hostname}/htdocs" } # NOTE: deliberately no exit 0