Browse Source

Create directory for android app integration

Bob Mottram 6 years ago
parent
commit
309687a43a
1 changed files with 13 additions and 2 deletions
  1. 13
    2
      src/freedombone-utils-web

+ 13
- 2
src/freedombone-utils-web View File

@@ -1143,13 +1143,15 @@ function install_web_local_user_interface {
1143 1143
     # similar to Plinth or the yunohost admin interface
1144 1144
     local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
1145 1145
 
1146
-    mkdir -p "/var/www/${local_hostname}/htdocs"
1146
+    if [ ! -d "/var/www/${local_hostname}/htdocs" ]; then
1147
+        mkdir -p "/var/www/${local_hostname}/htdocs"
1148
+    fi
1149
+
1147 1150
     { echo '<html>';
1148 1151
       echo '  <body>';
1149 1152
       echo "  This is a test on $local_hostname";
1150 1153
       echo '  </body>';
1151 1154
       echo '</html>'; } > "/var/www/${local_hostname}/htdocs/index.html"
1152
-    chown -R www-data:www-data "/var/www/${local_hostname}/htdocs"
1153 1155
 
1154 1156
     nginx_file=/etc/nginx/sites-available/$local_hostname
1155 1157
     { echo 'server {';
@@ -1160,6 +1162,15 @@ function install_web_local_user_interface {
1160 1162
       echo '  index index.html;';
1161 1163
       echo '}'; } > "$nginx_file"
1162 1164
     nginx_ensite "$local_hostname"
1165
+
1166
+    # Compatibility with FreedomBox android app
1167
+    # The installed apps get published to a json file called "1"
1168
+    # in this directory
1169
+    if [ ! -d "/var/www/${local_hostname}/htdocs/plinth/api" ]; then
1170
+        mkdir -p "/var/www/${local_hostname}/htdocs/plinth/api"
1171
+    fi
1172
+
1173
+    chown -R www-data:www-data "/var/www/${local_hostname}/htdocs"
1163 1174
 }
1164 1175
 
1165 1176
 # NOTE: deliberately no exit 0