Create directory for android app integration

This commit is contained in:
Bob Mottram 2018-05-25 12:19:17 +01:00
parent 01d3c2fb74
commit 309687a43a
1 changed files with 13 additions and 2 deletions

View File

@ -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 '<html>';
echo ' <body>';
echo " This is a test on $local_hostname";
echo ' </body>';
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 {';
@ -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