Bob Mottram 8 gadus atpakaļ
vecāks
revīzija
a3081d5c61
1 mainītis faili ar 13 papildinājumiem un 17 dzēšanām
  1. 13
    17
      src/freedombone-app-radicale

+ 13
- 17
src/freedombone-app-radicale Parādīt failu

42
 RADICALE_ONION_PORT=8106
42
 RADICALE_ONION_PORT=8106
43
 RADICALE_PORT=5232
43
 RADICALE_PORT=5232
44
 RADICALE_DIRECTORY='/etc/radicale'
44
 RADICALE_DIRECTORY='/etc/radicale'
45
+RADICALE_USERS=/var/www/radicale/users
45
 
46
 
46
 radicale_variables=(ONION_ONLY
47
 radicale_variables=(ONION_ONLY
47
                     MY_USERNAME
48
                     MY_USERNAME
50
 
51
 
51
 function remove_user_radicale {
52
 function remove_user_radicale {
52
     remove_username="$1"
53
     remove_username="$1"
53
-    if grep "$remove_username:" ${RADICALE_DIRECTORY}/users; then
54
-        sed -i "/$remove_username:/d" ${RADICALE_DIRECTORY}/users
54
+    if grep "$remove_username:" ${RADICALE_USERS}; then
55
+        sed -i "/$remove_username:/d" ${RADICALE_USERS}
55
         systemctl reload radicale
56
         systemctl reload radicale
56
     fi
57
     fi
57
 }
58
 }
60
     new_username="$1"
61
     new_username="$1"
61
     new_user_password="$2"
62
     new_user_password="$2"
62
 
63
 
63
-    if [ ! -f ${RADICALE_DIRECTORY}/users ]; then
64
-        touch ${RADICALE_DIRECTORY}/users
64
+    if [ ! -f ${RADICALE_USERS} ]; then
65
+        touch ${RADICALE_USERS}
65
     fi
66
     fi
66
 
67
 
67
-    if ! grep "$new_username:" ${RADICALE_DIRECTORY}/users; then
68
-        htpasswd -bd ${RADICALE_DIRECTORY}/users "$new_username" "$new_user_password"
68
+    if ! grep "$new_username:" ${RADICALE_USERS}; then
69
+        htpasswd -bd ${RADICALE_USERS} "$new_username" "$new_user_password"
69
         systemctl reload radicale
70
         systemctl reload radicale
70
     fi
71
     fi
71
     echo '0'
72
     echo '0'
227
     fi
228
     fi
228
     chown -R www-data:www-data /var/log/radicale
229
     chown -R www-data:www-data /var/log/radicale
229
 
230
 
230
-    apt-get -yq install apache2-utils
231
+    apt-get -yq install python-setuptools apache2-utils
231
 
232
 
232
     if [ ! -d /var/www/radicale ]; then
233
     if [ ! -d /var/www/radicale ]; then
233
         mkdir -p /var/www/radicale
234
         mkdir -p /var/www/radicale
270
     echo 'ssl = False' >> ${RADICALE_DIRECTORY}/config
271
     echo 'ssl = False' >> ${RADICALE_DIRECTORY}/config
271
     echo 'daemon = False' >> ${RADICALE_DIRECTORY}/config
272
     echo 'daemon = False' >> ${RADICALE_DIRECTORY}/config
272
     echo '' >> ${RADICALE_DIRECTORY}/config
273
     echo '' >> ${RADICALE_DIRECTORY}/config
273
-    echo '[auth]' >>  ${RADICALE_DIRECTORY}/config
274
-    echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config
275
-    echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config
276
-    echo 'htpasswd_encryption = crypt' >> ${RADICALE_DIRECTORY}/config
277
-    echo '' >> ${RADICALE_DIRECTORY}/config
278
-    echo '[rights]' >> ${RADICALE_DIRECTORY}/config
279
-    echo 'type = owner_only' >> ${RADICALE_DIRECTORY}/config
280
-    echo '' >> ${RADICALE_DIRECTORY}/config
281
     echo '[storage]' >> ${RADICALE_DIRECTORY}/config
274
     echo '[storage]' >> ${RADICALE_DIRECTORY}/config
282
     echo 'type = filesystem' >> ${RADICALE_DIRECTORY}/config
275
     echo 'type = filesystem' >> ${RADICALE_DIRECTORY}/config
283
     echo "filesystem_folder = /var/www/radicale/collections" >> ${RADICALE_DIRECTORY}/config
276
     echo "filesystem_folder = /var/www/radicale/collections" >> ${RADICALE_DIRECTORY}/config
277
+    echo '' >> ${RADICALE_DIRECTORY}/config
278
+    echo '[logging]' >> ${RADICALE_DIRECTORY}/config
279
+    echo 'debug = False' >> ${RADICALE_DIRECTORY}/config
284
 
280
 
285
     # create an admin password
281
     # create an admin password
286
     if [ ${#RADICALE_PASSWORD} -lt 8 ]; then
282
     if [ ${#RADICALE_PASSWORD} -lt 8 ]; then
327
         echo '' >> /etc/nginx/sites-available/radicale
323
         echo '' >> /etc/nginx/sites-available/radicale
328
         echo '    location / {' >> /etc/nginx/sites-available/radicale
324
         echo '    location / {' >> /etc/nginx/sites-available/radicale
329
         echo '        auth_basic "Radicale";' >> /etc/nginx/sites-available/radicale
325
         echo '        auth_basic "Radicale";' >> /etc/nginx/sites-available/radicale
330
-        echo "        auth_basic_user_file ${RADICALE_DIRECTORY}/users;" >> /etc/nginx/sites-available/radicale
326
+        echo "        auth_basic_user_file ${RADICALE_USERS};" >> /etc/nginx/sites-available/radicale
331
         echo '        proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
327
         echo '        proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
332
         echo '    }' >> /etc/nginx/sites-available/radicale
328
         echo '    }' >> /etc/nginx/sites-available/radicale
333
         echo '}' >> /etc/nginx/sites-available/radicale
329
         echo '}' >> /etc/nginx/sites-available/radicale
345
     echo '' >> /etc/nginx/sites-available/radicale
341
     echo '' >> /etc/nginx/sites-available/radicale
346
     echo '    location / {' >> /etc/nginx/sites-available/radicale
342
     echo '    location / {' >> /etc/nginx/sites-available/radicale
347
     echo '        auth_basic "Radicale";' >> /etc/nginx/sites-available/radicale
343
     echo '        auth_basic "Radicale";' >> /etc/nginx/sites-available/radicale
348
-    echo "        auth_basic_user_file ${RADICALE_DIRECTORY}/users;" >> /etc/nginx/sites-available/radicale
344
+    echo "        auth_basic_user_file ${RADICALE_USERS};" >> /etc/nginx/sites-available/radicale
349
     echo '        proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
345
     echo '        proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
350
     echo '    }' >> /etc/nginx/sites-available/radicale
346
     echo '    }' >> /etc/nginx/sites-available/radicale
351
     echo '}' >> /etc/nginx/sites-available/radicale
347
     echo '}' >> /etc/nginx/sites-available/radicale