Bläddra i källkod

Create directory for android app integration

Bob Mottram 7 år sedan
förälder
incheckning
309687a43a
1 ändrade filer med 13 tillägg och 2 borttagningar
  1. 13
    2
      src/freedombone-utils-web

+ 13
- 2
src/freedombone-utils-web Visa fil

1143
     # similar to Plinth or the yunohost admin interface
1143
     # similar to Plinth or the yunohost admin interface
1144
     local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
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
     { echo '<html>';
1150
     { echo '<html>';
1148
       echo '  <body>';
1151
       echo '  <body>';
1149
       echo "  This is a test on $local_hostname";
1152
       echo "  This is a test on $local_hostname";
1150
       echo '  </body>';
1153
       echo '  </body>';
1151
       echo '</html>'; } > "/var/www/${local_hostname}/htdocs/index.html"
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
     nginx_file=/etc/nginx/sites-available/$local_hostname
1156
     nginx_file=/etc/nginx/sites-available/$local_hostname
1155
     { echo 'server {';
1157
     { echo 'server {';
1160
       echo '  index index.html;';
1162
       echo '  index index.html;';
1161
       echo '}'; } > "$nginx_file"
1163
       echo '}'; } > "$nginx_file"
1162
     nginx_ensite "$local_hostname"
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
 # NOTE: deliberately no exit 0
1176
 # NOTE: deliberately no exit 0