Bob Mottram vor 8 Jahren
Ursprung
Commit
607d4bdc95
61 geänderte Dateien mit 829 neuen und 864 gelöschten Zeilen
  1. 5
    1
      src/freedombone-addcert
  2. 2
    2
      src/freedombone-app-batman
  3. 6
    6
      src/freedombone-app-dlna
  4. 5
    7
      src/freedombone-app-dokuwiki
  5. 16
    43
      src/freedombone-app-gnusocial
  6. 2
    2
      src/freedombone-app-gogs
  7. 266
    274
      src/freedombone-app-htmly
  8. 5
    13
      src/freedombone-app-hubzilla
  9. 8
    12
      src/freedombone-app-ipfs
  10. 4
    12
      src/freedombone-app-librevault
  11. 2
    10
      src/freedombone-app-mediagoblin
  12. 2
    2
      src/freedombone-app-mumble
  13. 4
    10
      src/freedombone-app-rss
  14. 4
    10
      src/freedombone-app-searx
  15. 4
    4
      src/freedombone-app-sip
  16. 2
    2
      src/freedombone-app-syncthing
  17. 2
    2
      src/freedombone-app-tahoelafs
  18. 4
    6
      src/freedombone-app-tox
  19. 1
    5
      src/freedombone-app-webmail
  20. 3
    7
      src/freedombone-app-xmpp
  21. 5
    17
      src/freedombone-app-zeronet
  22. 1
    1
      src/freedombone-backup-remote
  23. 35
    47
      src/freedombone-base-email
  24. 2
    2
      src/freedombone-base-tripwire
  25. 1
    1
      src/freedombone-controlpanel
  26. 7
    1
      src/freedombone-encrypt-mail
  27. 2
    2
      src/freedombone-restore-local
  28. 6
    2
      src/freedombone-restore-remote
  29. 1
    1
      src/freedombone-rmuser
  30. 7
    7
      src/freedombone-syncthing
  31. 2
    2
      src/freedombone-utils-avahi
  32. 3
    3
      src/freedombone-utils-backup
  33. 2
    2
      src/freedombone-utils-cmake
  34. 85
    0
      src/freedombone-utils-config
  35. 32
    32
      src/freedombone-utils-cron
  36. 2
    2
      src/freedombone-utils-cryptopp
  37. 4
    4
      src/freedombone-utils-database
  38. 6
    6
      src/freedombone-utils-dns
  39. 3
    7
      src/freedombone-utils-filesystem
  40. 2
    2
      src/freedombone-utils-final
  41. 17
    17
      src/freedombone-utils-firewall
  42. 3
    6
      src/freedombone-utils-git
  43. 1
    1
      src/freedombone-utils-go
  44. 2
    2
      src/freedombone-utils-international
  45. 2
    2
      src/freedombone-utils-login
  46. 29
    29
      src/freedombone-utils-monkeysphere
  47. 42
    42
      src/freedombone-utils-network
  48. 2
    2
      src/freedombone-utils-nodejs
  49. 12
    22
      src/freedombone-utils-onion
  50. 2
    2
      src/freedombone-utils-passwords
  51. 6
    6
      src/freedombone-utils-repos
  52. 111
    111
      src/freedombone-utils-rng
  53. 3
    1
      src/freedombone-utils-selector
  54. 4
    6
      src/freedombone-utils-setup
  55. 6
    6
      src/freedombone-utils-ssh
  56. 2
    2
      src/freedombone-utils-tracker
  57. 4
    4
      src/freedombone-utils-upgrade
  58. 2
    2
      src/freedombone-utils-watchdog
  59. 9
    16
      src/freedombone-utils-web
  60. 6
    5
      src/freedombone-utils-wifi
  61. 9
    9
      src/freedombone-utils-zram

+ 5
- 1
src/freedombone-addcert Datei anzeigen

186
     if [ ! $MY_EMAIL_ADDRESS ]; then
186
     if [ ! $MY_EMAIL_ADDRESS ]; then
187
         if [ -f $COMPLETION_FILE ]; then
187
         if [ -f $COMPLETION_FILE ]; then
188
             if grep -q "Admin user:" $COMPLETION_FILE; then
188
             if grep -q "Admin user:" $COMPLETION_FILE; then
189
-                ADMIN_USER=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
189
+                function_check get_completion_param
190
+                ADMIN_USER=$(get_completion_param "Admin user")
191
+                if [ ${#ADMIN_USER} -eq 0 ]; then
192
+                    exit 463732
193
+                fi
190
                 MY_EMAIL_ADDRESS=$ADMIN_USER@$HOSTNAME
194
                 MY_EMAIL_ADDRESS=$ADMIN_USER@$HOSTNAME
191
             fi
195
             fi
192
         fi
196
         fi

+ 2
- 2
src/freedombone-app-batman Datei anzeigen

46
 }
46
 }
47
 
47
 
48
 function configure_firewall_for_batman {
48
 function configure_firewall_for_batman {
49
-    if grep -Fxq "configure_firewall_for_batman" $COMPLETION_FILE; then
49
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
50
         return
50
         return
51
     fi
51
     fi
52
     if [[ $ENABLE_BATMAN != "yes" ]]; then
52
     if [[ $ENABLE_BATMAN != "yes" ]]; then
55
 
55
 
56
     function_check save_firewall_settings
56
     function_check save_firewall_settings
57
     save_firewall_settings
57
     save_firewall_settings
58
-    echo 'configure_firewall_for_batman' >> $COMPLETION_FILE
58
+    mark_completed $FUNCNAME
59
 }
59
 }
60
 
60
 
61
 function reconfigure_batman {
61
 function reconfigure_batman {

+ 6
- 6
src/freedombone-app-dlna Datei anzeigen

78
 }
78
 }
79
 
79
 
80
 function configure_firewall_for_dlna {
80
 function configure_firewall_for_dlna {
81
-    if grep -Fxq "configure_firewall_for_dlna" $COMPLETION_FILE; then
81
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
82
         return
82
         return
83
     fi
83
     fi
84
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
84
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
92
 
92
 
93
     OPEN_PORTS+=('DLNA     1900')
93
     OPEN_PORTS+=('DLNA     1900')
94
     OPEN_PORTS+=('DLNA     8200')
94
     OPEN_PORTS+=('DLNA     8200')
95
-    echo 'configure_firewall_for_dlna' >> $COMPLETION_FILE
95
+    mark_completed $FUNCNAME
96
 }
96
 }
97
 
97
 
98
 function backup_local_dlna {
98
 function backup_local_dlna {
168
 }
168
 }
169
 
169
 
170
 function install_dlna_main {
170
 function install_dlna_main {
171
-    if grep -Fxq "install_dlna_main" $COMPLETION_FILE; then
171
+    if [[ $(app_is_installed dlna_main) == "1" ]]; then
172
         return
172
         return
173
     fi
173
     fi
174
 
174
 
217
 
217
 
218
     function_check configure_firewall_for_dlna
218
     function_check configure_firewall_for_dlna
219
     configure_firewall_for_dlna
219
     configure_firewall_for_dlna
220
-    echo 'install_dlna_main' >> $COMPLETION_FILE
220
+    install_completed dlna_main
221
 }
221
 }
222
 
222
 
223
 function script_for_attaching_usb_drive {
223
 function script_for_attaching_usb_drive {
224
-    if grep -Fxq "script_for_attaching_usb_drive" $COMPLETION_FILE; then
224
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
225
         return
225
         return
226
     fi
226
     fi
227
     echo '#!/bin/bash' > /usr/bin/attach-music
227
     echo '#!/bin/bash' > /usr/bin/attach-music
256
     ln -s /usr/bin/remove-music /usr/bin/detach-pictures
256
     ln -s /usr/bin/remove-music /usr/bin/detach-pictures
257
     ln -s /usr/bin/remove-music /usr/bin/remove-pictures
257
     ln -s /usr/bin/remove-music /usr/bin/remove-pictures
258
 
258
 
259
-    echo 'script_for_attaching_usb_drive' >> $COMPLETION_FILE
259
+    mark_completed $FUNCNAME
260
 }
260
 }
261
 
261
 
262
 function install_dlna {
262
 function install_dlna {

+ 5
- 7
src/freedombone-app-dokuwiki Datei anzeigen

85
 function restore_local_dokuwiki {
85
 function restore_local_dokuwiki {
86
     if [ -d /var/lib/dokuwiki ]; then
86
     if [ -d /var/lib/dokuwiki ]; then
87
         echo $"Restoring Dokuwiki installation"
87
         echo $"Restoring Dokuwiki installation"
88
-        DOKUWIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "dokuwiki domain" | awk -F ':' '{print $2}')
88
+        function_check get_completion_param
89
+        DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
89
         temp_restore_dir=/root/tempdokuwiki
90
         temp_restore_dir=/root/tempdokuwiki
90
         function_check restore_directory_from_usb
91
         function_check restore_directory_from_usb
91
         restore_directory_from_usb $temp_restore_dir dokuwiki
92
         restore_directory_from_usb $temp_restore_dir dokuwiki
131
 
132
 
132
 function restore_remote_dokuwiki {
133
 function restore_remote_dokuwiki {
133
     if [ -d $SERVER_DIRECTORY/backup/dokuwiki ]; then
134
     if [ -d $SERVER_DIRECTORY/backup/dokuwiki ]; then
134
-        DOKUWIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "dokuwiki domain" | awk -F ':' '{print $2}')
135
+        function_check get_completion_param
136
+        DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
135
         echo $"Restoring Dokuwiki installation $DOKUWIKI_DOMAIN_NAME"
137
         echo $"Restoring Dokuwiki installation $DOKUWIKI_DOMAIN_NAME"
136
         function_check restore_directory_from_friend
138
         function_check restore_directory_from_friend
137
         restore_directory_from_friend /root/tempdokuwiki dokuwiki
139
         restore_directory_from_friend /root/tempdokuwiki dokuwiki
561
         chmod 600 /home/$MY_USERNAME/README
563
         chmod 600 /home/$MY_USERNAME/README
562
     fi
564
     fi
563
 
565
 
564
-    if ! grep -q "dokuwiki domain" $COMPLETION_FILE; then
565
-        echo "dokuwiki domain:$DOKUWIKI_DOMAIN_NAME" >> $COMPLETION_FILE
566
-    else
567
-        sed -i "s|dokuwiki domain.*|dokuwiki domain:$DOKUWIKI_DOMAIN_NAME|g" $COMPLETION_FILE
568
-    fi
566
+    set_completion_param "dokuwiki domain" "$DOKUWIKI_DOMAIN_NAME"
569
     APP_INSTALLED=1
567
     APP_INSTALLED=1
570
 }
568
 }
571
 
569
 

+ 16
- 43
src/freedombone-app-gnusocial Datei anzeigen

74
 function remove_user_gnusocial {
74
 function remove_user_gnusocial {
75
     remove_username="$1"
75
     remove_username="$1"
76
 
76
 
77
-    GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
77
+    function_check get_completion_param
78
+    GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
78
     if [ -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
79
     if [ -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
79
         cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
80
         cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
80
         php scripts/deleteprofile.php -n $remove_username -y
81
         php scripts/deleteprofile.php -n $remove_username -y
85
     new_username="$1"
86
     new_username="$1"
86
     new_user_password="$2"
87
     new_user_password="$2"
87
 
88
 
88
-    GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
89
+    GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
89
     if [ -d /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs ]; then
90
     if [ -d /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs ]; then
90
         cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
91
         cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
91
         php scripts/registeruser.php -n $new_username -w "$new_user_password" -e "$new_username@$HOSTNAME"
92
         php scripts/registeruser.php -n $new_username -w "$new_user_password" -e "$new_username@$HOSTNAME"
231
 
232
 
232
 function upgrade_gnusocial {
233
 function upgrade_gnusocial {
233
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
234
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
234
-        GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
235
+        GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
235
     fi
236
     fi
236
 
237
 
237
     # update to the next commit
238
     # update to the next commit
246
 function backup_local_gnusocial {
247
 function backup_local_gnusocial {
247
     GNUSOCIAL_DOMAIN_NAME='gnusocial'
248
     GNUSOCIAL_DOMAIN_NAME='gnusocial'
248
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
249
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
249
-        GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
250
+        GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
250
     fi
251
     fi
251
 
252
 
252
     source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
253
     source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
274
     if ! grep -q "gnusocial domain" $COMPLETION_FILE; then
275
     if ! grep -q "gnusocial domain" $COMPLETION_FILE; then
275
         return
276
         return
276
     fi
277
     fi
277
-    GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
278
+    GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
278
     if [ $GNUSOCIAL_DOMAIN_NAME ]; then
279
     if [ $GNUSOCIAL_DOMAIN_NAME ]; then
279
         echo $"Restoring gnusocial"
280
         echo $"Restoring gnusocial"
280
         temp_restore_dir=/root/tempgnusocial
281
         temp_restore_dir=/root/tempgnusocial
300
 
301
 
301
 function backup_remote_gnusocial {
302
 function backup_remote_gnusocial {
302
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
303
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
303
-        GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
304
+        GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
304
         temp_backup_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
305
         temp_backup_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
305
         if [ -d $temp_backup_dir ]; then
306
         if [ -d $temp_backup_dir ]; then
306
             function_check suspend_site
307
             function_check suspend_site
325
 function restore_remote_gnusocial {
326
 function restore_remote_gnusocial {
326
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
327
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
327
         echo $"Restoring gnusocial"
328
         echo $"Restoring gnusocial"
328
-        GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
329
+        GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
329
 
330
 
330
         # stop the daemons
331
         # stop the daemons
331
         cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
332
         cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
412
 
413
 
413
     cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
414
     cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
414
     git checkout $GNUSOCIAL_COMMIT -b $GNUSOCIAL_COMMIT
415
     git checkout $GNUSOCIAL_COMMIT -b $GNUSOCIAL_COMMIT
415
-    if ! grep -q "gnusocial commit" $COMPLETION_FILE; then
416
-        echo "gnusocial commit:$GNUSOCIAL_COMMIT" >> $COMPLETION_FILE
417
-    else
418
-        sed -i "s/gnusocial commit.*/gnusocial commit:$GNUSOCIAL_COMMIT/g" $COMPLETION_FILE
419
-    fi
416
+    set_completion_param "gnusocial commit" "$GNUSOCIAL_COMMIT"
420
 
417
 
421
     chmod a+w /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
418
     chmod a+w /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
422
     chown www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
419
     chown www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
642
         fi
639
         fi
643
     fi
640
     fi
644
 
641
 
645
-    if ! grep -q "gnusocial domain" $COMPLETION_FILE; then
646
-        echo "gnusocial domain:$GNUSOCIAL_DOMAIN_NAME" >> $COMPLETION_FILE
647
-    else
648
-        sed -i "s|gnusocial domain.*|gnusocial domain:$GNUSOCIAL_DOMAIN_NAME|g" $COMPLETION_FILE
649
-    fi
642
+    set_completion_param "gnusocial domain" "$GNUSOCIAL_DOMAIN_NAME"
650
 
643
 
651
     install_completed gnusocial_main
644
     install_completed gnusocial_main
652
 }
645
 }
715
 
708
 
716
     chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
709
     chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
717
 
710
 
718
-    if ! grep -q "gnusocial sharings plugin commit" $COMPLETION_FILE; then
719
-        echo "gnusocial sharings plugin commit:$SHARINGS_COMMIT" >> $COMPLETION_FILE
720
-    else
721
-        sed -i "s|gnusocial sharings plugin commit.*|gnusocial sharings plugin commit:$SHARINGS_COMMIT|g" $COMPLETION_FILE
722
-    fi
711
+    set_completion_param gnusocial "sharings plugin commit" "$SHARINGS_COMMIT"
723
     install_completed gnusocial_plugin_sharings
712
     install_completed gnusocial_plugin_sharings
724
 }
713
 }
725
 
714
 
761
 
750
 
762
     chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
751
     chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
763
 
752
 
764
-    if ! grep -q "gnusocial sharings plugin theme commit" $COMPLETION_FILE; then
765
-        echo "gnusocial sharings plugin theme commit:$SHARINGS_THEME_COMMIT" >> $COMPLETION_FILE
766
-    else
767
-        sed -i "s|gnusocial sharings plugin theme commit.*|gnusocial sharings plugin theme commit:$SHARINGS_THEME_COMMIT|g" $COMPLETION_FILE
768
-    fi
753
+    set_completions_param "gnusocial sharings plugin theme commit" "$SHARINGS_THEME_COMMIT"
769
     install_completed gnusocial_plugin_sharings_theme
754
     install_completed gnusocial_plugin_sharings_theme
770
 }
755
 }
771
 
756
 
914
         fi
899
         fi
915
     fi
900
     fi
916
 
901
 
917
-    if ! grep -q "gnusocial theme commit" $COMPLETION_FILE; then
918
-        echo "gnusocial theme commit:$GNUSOCIAL_THEME_COMMIT" >> $COMPLETION_FILE
919
-    else
920
-        sed -i "s|gnusocial theme commit.*|gnusocial theme commit:$GNUSOCIAL_THEME_COMMIT|g" $COMPLETION_FILE
921
-    fi
902
+    set_completions_param "gnusocial theme commit" "$GNUSOCIAL_THEME_COMMIT"
922
 
903
 
923
     chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
904
     chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
924
 
905
 
957
         echo "addPlugin('Markdown');" >> $gnusocial_config_file
938
         echo "addPlugin('Markdown');" >> $gnusocial_config_file
958
     fi
939
     fi
959
 
940
 
960
-    if ! grep -q "gnusocial Markdown commit" $COMPLETION_FILE; then
961
-        echo "gnusocial Markdown commit:$GNUSOCIAL_MARKDOWN_COMMIT" >> $COMPLETION_FILE
962
-    else
963
-        sed -i "s|gnusocial Markdown commit.*|gnusocial Markdown commit:$GNUSOCIAL_MARKDOWN_COMMIT|g" $COMPLETION_FILE
964
-    fi
941
+    set_completions_param "gnusocial markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT"
965
 
942
 
966
     chown -R www-data:www-data $GNUSOCIAL_PATH
943
     chown -R www-data:www-data $GNUSOCIAL_PATH
967
 
944
 
978
     function_check set_repo_commit
955
     function_check set_repo_commit
979
     set_repo_commit /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins "gnusocial NSFW plugin commit" "$GNUSOCIAL_NSFW_COMMIT" $GNUSOCIAL_NSFW_REPO
956
     set_repo_commit /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins "gnusocial NSFW plugin commit" "$GNUSOCIAL_NSFW_COMMIT" $GNUSOCIAL_NSFW_REPO
980
 
957
 
981
-    if grep -Fxq "install_gnusocial_plugin_nsfw" $COMPLETION_FILE; then
958
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
982
         return
959
         return
983
     fi
960
     fi
984
 
961
 
1006
 
983
 
1007
     chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
984
     chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
1008
 
985
 
1009
-    if ! grep -q "gnusocial NSFW plugin commit" $COMPLETION_FILE; then
1010
-        echo "gnusocial NSFW plugin commit:$GNUSOCIAL_NSFW_COMMIT" >> $COMPLETION_FILE
1011
-    else
1012
-        sed -i "s|gnusocial NSFW plugin commit.*|gnusocial NSFW plugin commit:$GNUSOCIAL_NSFW_COMMIT|g" $COMPLETION_FILE
1013
-    fi
986
+    set_completions_param "gnusocial NSFW plugin commit" "$GNUSOCIAL_NSFW_COMMIT"
1014
     install_completed gnusocial_plugin_nsfw
987
     install_completed gnusocial_plugin_nsfw
1015
 }
988
 }
1016
 
989
 

+ 2
- 2
src/freedombone-app-gogs Datei anzeigen

128
         return
128
         return
129
     fi
129
     fi
130
 
130
 
131
-    CURR_GOGS_VERSION=$(cat $COMPLETION_FILE | grep "gogs version" | head -n 1 | awk -F ':' '{print $2}')
131
+    CURR_GOGS_VERSION=$(get_completion_param "gogs version")
132
     if [[ "${CURR_GOGS_VERSION}" == "${GOGS_VERSION}" ]]; then
132
     if [[ "${CURR_GOGS_VERSION}" == "${GOGS_VERSION}" ]]; then
133
         return
133
         return
134
     fi
134
     fi
288
 
288
 
289
 function restore_remote_gogs {
289
 function restore_remote_gogs {
290
     if grep -q "gogs domain" $COMPLETION_FILE; then
290
     if grep -q "gogs domain" $COMPLETION_FILE; then
291
-        GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gogs domain" | awk -F ':' '{print $2}')
291
+        GIT_DOMAIN_NAME=$(get_completion_param "gogs domain")
292
 
292
 
293
         function_check gogs_create_database
293
         function_check gogs_create_database
294
         gogs_create_database
294
         gogs_create_database

+ 266
- 274
src/freedombone-app-htmly Datei anzeigen

30
 
30
 
31
 VARIANTS="full full-vim writer"
31
 VARIANTS="full full-vim writer"
32
 
32
 
33
-HYMLY_DOMAIN_NAME=
34
-HYMLY_CODE=
35
-HYMLY_ONION_PORT=8086
36
-HYMLY_REPO="https://github.com/danpros/htmly"
37
-HYMLY_COMMIT='bf5fe9486160be4da86d8987d3e5c977e1dc6d32'
33
+HTMLY_DOMAIN_NAME=
34
+HTMLY_CODE=
35
+HTMLY_ONION_PORT=8086
36
+HTMLY_REPO="https://github.com/danpros/htmly"
37
+HTMLY_COMMIT='bf5fe9486160be4da86d8987d3e5c977e1dc6d32'
38
 HTMLY_TITLE="My Htmly"
38
 HTMLY_TITLE="My Htmly"
39
 HTMLY_SUBTITLE="Another ${PROJECT_NAME} Htmly"
39
 HTMLY_SUBTITLE="Another ${PROJECT_NAME} Htmly"
40
 
40
 
41
-htmly_variables=(HYMLY_REPO
42
-                HYMLY_COMMIT
43
-                HYMLY_DOMAIN_NAME
44
-                HYMLY_CODE
41
+htmly_variables=(HTMLY_REPO
42
+                HTMLY_COMMIT
43
+                HTMLY_DOMAIN_NAME
44
+                HTMLY_CODE
45
                 HTMLY_TITLE
45
                 HTMLY_TITLE
46
                 HTMLY_SUBTITLE
46
                 HTMLY_SUBTITLE
47
                 ONION_ONLY
47
                 ONION_ONLY
91
 function remove_user_htmly {
91
 function remove_user_htmly {
92
     remove_username="$1"
92
     remove_username="$1"
93
 
93
 
94
-    if [ -f /var/www/${HYMLY_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini ]; then
95
-        rm /var/www/${HYMLY_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini
94
+    if [ -f /var/www/${HTMLY_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini ]; then
95
+        rm /var/www/${HTMLY_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini
96
     fi
96
     fi
97
 }
97
 }
98
 
98
 
105
     new_username="$1"
105
     new_username="$1"
106
     new_user_password="$2"
106
     new_user_password="$2"
107
 
107
 
108
-    if [ ! -d /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users ]; then
108
+    if [ ! -d /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users ]; then
109
         echo '2'
109
         echo '2'
110
         return
110
         return
111
     fi
111
     fi
114
         echo '3'
114
         echo '3'
115
         return
115
         return
116
     fi
116
     fi
117
-    echo ';Password' > /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
118
-    echo "password = $NEW_USER_PASSWORD_HASH" >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
119
-    echo 'encryption = password_hash' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
120
-    echo ';Role' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
121
-    echo 'role = admin' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
117
+    echo ';Password' > /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
118
+    echo "password = $NEW_USER_PASSWORD_HASH" >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
119
+    echo 'encryption = password_hash' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
120
+    echo ';Role' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
121
+    echo 'role = admin' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
122
     echo '0'
122
     echo '0'
123
 }
123
 }
124
 
124
 
152
 
152
 
153
     if [[ $ONION_ONLY != "no" ]]; then
153
     if [[ $ONION_ONLY != "no" ]]; then
154
         HTMLY_TITLE='My Htmly'
154
         HTMLY_TITLE='My Htmly'
155
-        HYMLY_DOMAIN_NAME='htmly.local'
155
+        HTMLY_DOMAIN_NAME='htmly.local'
156
         write_config_param "HTMLY_TITLE" "$HTMLY_TITLE"
156
         write_config_param "HTMLY_TITLE" "$HTMLY_TITLE"
157
-        write_config_param "HYMLY_DOMAIN_NAME" "$HYMLY_DOMAIN_NAME"
157
+        write_config_param "HTMLY_DOMAIN_NAME" "$HTMLY_DOMAIN_NAME"
158
     else
158
     else
159
         function_check interactive_site_details_with_title
159
         function_check interactive_site_details_with_title
160
-        interactive_site_details_with_title "htmly" "HTMLY_TITLE" "HYMLY_DOMAIN_NAME" "HYMLY_CODE"
160
+        interactive_site_details_with_title "htmly" "HTMLY_TITLE" "HTMLY_DOMAIN_NAME" "HTMLY_CODE"
161
     fi
161
     fi
162
     APP_INSTALLED=1
162
     APP_INSTALLED=1
163
 }
163
 }
164
 
164
 
165
 function change_password_htmly {
165
 function change_password_htmly {
166
-    if ! grep -q "htmly domain:" $COMPLETION_FILE; then
167
-        echo "htmly domain:$HYMLY_DOMAIN_NAME" >> $COMPLETION_FILE
168
-    fi
169
-    HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | head -n 1 | awk -F ':' '{print $2}')
166
+    set_completion_param "htmly domain" "$HTMLY_DOMAIN_NAME"
167
+    HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
170
 
168
 
171
     HTMLY_USERNAME="$1"
169
     HTMLY_USERNAME="$1"
172
     HTMLY_PASSWORD="$2"
170
     HTMLY_PASSWORD="$2"
179
         echo $'Htmly admin password could not be hashed'
177
         echo $'Htmly admin password could not be hashed'
180
         exit 625728
178
         exit 625728
181
     fi
179
     fi
182
-    sed -i "s|password =.*|password = $HTMLY_PASSWORD_HASH|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$HTMLY_USERNAME.ini
180
+    sed -i "s|password =.*|password = $HTMLY_PASSWORD_HASH|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$HTMLY_USERNAME.ini
183
 }
181
 }
184
 
182
 
185
 function reconfigure_htmly {
183
 function reconfigure_htmly {
187
 }
185
 }
188
 
186
 
189
 function upgrade_htmly {
187
 function upgrade_htmly {
190
-    read_config_param "HYMLY_DOMAIN_NAME"
188
+    read_config_param "HTMLY_DOMAIN_NAME"
191
 
189
 
192
     function_check set_repo_commit
190
     function_check set_repo_commit
193
-    set_repo_commit /var/www/$HYMLY_DOMAIN_NAME/htdocs "htmly commit" "$HYMLY_COMMIT" $HYMLY_REPO
191
+    set_repo_commit /var/www/$HTMLY_DOMAIN_NAME/htdocs "htmly commit" "$HTMLY_COMMIT" $HTMLY_REPO
194
 }
192
 }
195
 
193
 
196
 function backup_local_htmly {
194
 function backup_local_htmly {
197
-    HYMLY_DOMAIN_NAME='htmly'
195
+    HTMLY_DOMAIN_NAME='htmly'
198
     if grep -q "htmly domain" $COMPLETION_FILE; then
196
     if grep -q "htmly domain" $COMPLETION_FILE; then
199
-        HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | awk -F ':' '{print $2}')
197
+        HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
200
     fi
198
     fi
201
 
199
 
202
-    source_directory=/var/www/${HYMLY_DOMAIN_NAME}/htdocs
200
+    source_directory=/var/www/${HTMLY_DOMAIN_NAME}/htdocs
203
     if [ -d $source_directory ]; then
201
     if [ -d $source_directory ]; then
204
         dest_directory=htmly
202
         dest_directory=htmly
205
         echo $"Backing up $source_directory to $dest_directory"
203
         echo $"Backing up $source_directory to $dest_directory"
206
 
204
 
207
         function_check suspend_site
205
         function_check suspend_site
208
-        suspend_site ${HYMLY_DOMAIN_NAME}
206
+        suspend_site ${HTMLY_DOMAIN_NAME}
209
 
207
 
210
         function_check backup_directory_to_usb
208
         function_check backup_directory_to_usb
211
         backup_directory_to_usb $source_directory $dest_directory
209
         backup_directory_to_usb $source_directory $dest_directory
218
 }
216
 }
219
 
217
 
220
 function restore_local_htmly {
218
 function restore_local_htmly {
221
-    HYMLY_DOMAIN_NAME='htmly'
219
+    HTMLY_DOMAIN_NAME='htmly'
222
     if grep -q "htmly domain" $COMPLETION_FILE; then
220
     if grep -q "htmly domain" $COMPLETION_FILE; then
223
-        HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | awk -F ':' '{print $2}')
221
+        HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
224
     fi
222
     fi
225
-    if [ $HYMLY_DOMAIN_NAME ]; then
223
+    if [ $HTMLY_DOMAIN_NAME ]; then
226
         echo $"Restoring htmly installation"
224
         echo $"Restoring htmly installation"
227
         temp_restore_dir=/root/temphtmly
225
         temp_restore_dir=/root/temphtmly
228
         restore_directory_from_usb $temp_restore_dir htmly
226
         restore_directory_from_usb $temp_restore_dir htmly
229
-        rm -rf /var/www/${HYMLY_DOMAIN_NAME}/htdocs
230
-        cp -r $temp_restore_dir/var/www/${HYMLY_DOMAIN_NAME}/htdocs /var/www/${HYMLY_DOMAIN_NAME}/
227
+        rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
228
+        cp -r $temp_restore_dir/var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/
231
         if [ ! "$?" = "0" ]; then
229
         if [ ! "$?" = "0" ]; then
232
             set_user_permissions
230
             set_user_permissions
233
             backup_unmount_drive
231
             backup_unmount_drive
234
             exit 593
232
             exit 593
235
         fi
233
         fi
236
         rm -rf $temp_restore_dir
234
         rm -rf $temp_restore_dir
237
-        if [ ! -d /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content ]; then
235
+        if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
238
             echo $"No content directory found after restoring htmly"
236
             echo $"No content directory found after restoring htmly"
239
             set_user_permissions
237
             set_user_permissions
240
             backup_unmount_drive
238
             backup_unmount_drive
241
             exit 287
239
             exit 287
242
         fi
240
         fi
243
-        chown -R www-data:www-data /var/www/${HYMLY_DOMAIN_NAME}/htdocs
241
+        chown -R www-data:www-data /var/www/${HTMLY_DOMAIN_NAME}/htdocs
244
         # Ensure that the bundled SSL cert is being used
242
         # Ensure that the bundled SSL cert is being used
245
-        if [ -f /etc/ssl/certs/${HYMLY_DOMAIN_NAME}.bundle.crt ]; then
246
-            sed -i "s|${HYMLY_DOMAIN_NAME}.crt|${HYMLY_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${HYMLY_DOMAIN_NAME}
243
+        if [ -f /etc/ssl/certs/${HTMLY_DOMAIN_NAME}.bundle.crt ]; then
244
+            sed -i "s|${HTMLY_DOMAIN_NAME}.crt|${HTMLY_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${HTMLY_DOMAIN_NAME}
247
         fi
245
         fi
248
         for d in /home/*/ ; do
246
         for d in /home/*/ ; do
249
             USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
247
             USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
250
             if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
248
             if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
251
-                if [ -d /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post ]; then
252
-                    mv /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/*.md /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post
249
+                if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post ]; then
250
+                    mv /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/*.md /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post
253
                 fi
251
                 fi
254
             fi
252
             fi
255
         done
253
         done
256
-        if [ -d /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME} ]; then
257
-            ln -s /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${HYMLY_DOMAIN_NAME}.key
258
-            ln -s /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${HYMLY_DOMAIN_NAME}.pem
254
+        if [ -d /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME} ]; then
255
+            ln -s /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${HTMLY_DOMAIN_NAME}.key
256
+            ln -s /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${HTMLY_DOMAIN_NAME}.pem
259
         fi
257
         fi
260
     fi
258
     fi
261
 }
259
 }
262
 
260
 
263
 function backup_remote_htmly {
261
 function backup_remote_htmly {
264
     if grep -q "htmly domain" $COMPLETION_FILE; then
262
     if grep -q "htmly domain" $COMPLETION_FILE; then
265
-        HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | awk -F ':' '{print $2}')
266
-        temp_backup_dir=/var/www/${HYMLY_DOMAIN_NAME}/htdocs
263
+        HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
264
+        temp_backup_dir=/var/www/${HTMLY_DOMAIN_NAME}/htdocs
267
         if [ -d $temp_backup_dir ]; then
265
         if [ -d $temp_backup_dir ]; then
268
             echo $"Backing up htmly"
266
             echo $"Backing up htmly"
269
             backup_directory_to_friend $temp_backup_dir htmly
267
             backup_directory_to_friend $temp_backup_dir htmly
277
 
275
 
278
 function restore_remote_htmly {
276
 function restore_remote_htmly {
279
     if [ -d $SERVER_DIRECTORY/backup/htmly ]; then
277
     if [ -d $SERVER_DIRECTORY/backup/htmly ]; then
280
-        HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | awk -F ':' '{print $2}')
281
-        echo $"Restoring htmly installation $HYMLY_DOMAIN_NAME"
278
+        HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
279
+        echo $"Restoring htmly installation $HTMLY_DOMAIN_NAME"
282
         temp_restore_dir=/root/temphtmly
280
         temp_restore_dir=/root/temphtmly
283
         mkdir $temp_restore_dir
281
         mkdir $temp_restore_dir
284
         function_check restore_directory_from_friend
282
         function_check restore_directory_from_friend
285
         restore_directory_from_friend $temp_restore_dir htmly
283
         restore_directory_from_friend $temp_restore_dir htmly
286
-        rm -rf /var/www/${HYMLY_DOMAIN_NAME}/htdocs
287
-        cp -r $temp_restore_dir/var/www/${HYMLY_DOMAIN_NAME}/htdocs /var/www/${HYMLY_DOMAIN_NAME}/
284
+        rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
285
+        cp -r $temp_restore_dir/var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/
288
         if [ ! "$?" = "0" ]; then
286
         if [ ! "$?" = "0" ]; then
289
             exit 593
287
             exit 593
290
         fi
288
         fi
291
         rm -rf $temp_restore_dir
289
         rm -rf $temp_restore_dir
292
-        if [ ! -d /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content ]; then
290
+        if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
293
             echo $"No content directory found after restoring htmly"
291
             echo $"No content directory found after restoring htmly"
294
             exit 287
292
             exit 287
295
         fi
293
         fi
296
         # Ensure that the bundled SSL cert is being used
294
         # Ensure that the bundled SSL cert is being used
297
-        if [ -f /etc/ssl/certs/${HYMLY_DOMAIN_NAME}.bundle.crt ]; then
298
-            sed -i "s|${HYMLY_DOMAIN_NAME}.crt|${HYMLY_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${HYMLY_DOMAIN_NAME}
295
+        if [ -f /etc/ssl/certs/${HTMLY_DOMAIN_NAME}.bundle.crt ]; then
296
+            sed -i "s|${HTMLY_DOMAIN_NAME}.crt|${HTMLY_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${HTMLY_DOMAIN_NAME}
299
         fi
297
         fi
300
         for d in /home/*/ ; do
298
         for d in /home/*/ ; do
301
             USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
299
             USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
302
             if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
300
             if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
303
-                if [ -d /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post ]; then
304
-                    mv /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/*.md /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post
301
+                if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post ]; then
302
+                    mv /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/*.md /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post
305
                 fi
303
                 fi
306
             fi
304
             fi
307
         done
305
         done
308
-        if [ -d /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME} ]; then
309
-            ln -s /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${HYMLY_DOMAIN_NAME}.key
310
-            ln -s /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${HYMLY_DOMAIN_NAME}.pem
306
+        if [ -d /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME} ]; then
307
+            ln -s /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${HTMLY_DOMAIN_NAME}.key
308
+            ln -s /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${HTMLY_DOMAIN_NAME}.pem
311
         fi
309
         fi
312
         echo $"Restore of htmly complete"
310
         echo $"Restore of htmly complete"
313
     fi
311
     fi
314
 }
312
 }
315
 
313
 
316
 function remove_htmly {
314
 function remove_htmly {
317
-    if [ ${#HYMLY_DOMAIN_NAME} -eq 0 ]; then
315
+    if [ ${#HTMLY_DOMAIN_NAME} -eq 0 ]; then
318
         return
316
         return
319
     fi
317
     fi
320
 
318
 
321
-    read_config_param "HYMLY_DOMAIN_NAME"
322
-    nginx_dissite $HYMLY_DOMAIN_NAME
323
-    if [ -f /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME ]; then
324
-        rm -f /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
319
+    read_config_param "HTMLY_DOMAIN_NAME"
320
+    nginx_dissite $HTMLY_DOMAIN_NAME
321
+    if [ -f /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME ]; then
322
+        rm -f /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
325
     fi
323
     fi
326
-    if [ -d /var/www/$HYMLY_DOMAIN_NAME ]; then
327
-        rm -rf /var/www/$HYMLY_DOMAIN_NAME
324
+    if [ -d /var/www/$HTMLY_DOMAIN_NAME ]; then
325
+        rm -rf /var/www/$HTMLY_DOMAIN_NAME
328
     fi
326
     fi
329
-    if [ $HYMLY_CODE ]; then
327
+    if [ $HTMLY_CODE ]; then
330
         if [ -f /usr/bin/dynamicdns ]; then
328
         if [ -f /usr/bin/dynamicdns ]; then
331
-            sed -i "/$HYMLY_DOMAIN_NAME/d" /usr/bin/dynamicdns
332
-            sed -i "/$HYMLY_CODE/d" /usr/bin/dynamicdns
329
+            sed -i "/$HTMLY_DOMAIN_NAME/d" /usr/bin/dynamicdns
330
+            sed -i "/$HTMLY_CODE/d" /usr/bin/dynamicdns
333
         fi
331
         fi
334
     fi
332
     fi
335
     function_check remove_onion_service
333
     function_check remove_onion_service
336
-    remove_onion_service htmly ${HYMLY_ONION_PORT}
334
+    remove_onion_service htmly ${HTMLY_ONION_PORT}
337
     sed -i '/install_htmly/d' $COMPLETION_FILE
335
     sed -i '/install_htmly/d' $COMPLETION_FILE
338
     sed -i '/Htmly .*/d' $COMPLETION_FILE
336
     sed -i '/Htmly .*/d' $COMPLETION_FILE
339
 }
337
 }
341
 function get_htmly_admin_password {
339
 function get_htmly_admin_password {
342
     if [ -f /home/$MY_USERNAME/README ]; then
340
     if [ -f /home/$MY_USERNAME/README ]; then
343
         if grep -q "Your htmly password is" /home/$MY_USERNAME/README; then
341
         if grep -q "Your htmly password is" /home/$MY_USERNAME/README; then
344
-            HYMLY_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Your htmly password is" | awk -F ':' '{print $2}' | sed 's/^ *//')
342
+            HTMLY_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Your htmly password is" | awk -F ':' '{print $2}' | sed 's/^ *//')
345
         fi
343
         fi
346
     fi
344
     fi
347
 }
345
 }
348
 
346
 
349
 function install_htmly_social_networks {
347
 function install_htmly_social_networks {
350
     # set social networks
348
     # set social networks
351
-    if grep -q "social.hubzilla" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini; then
352
-        sed -i "s|;social.hubzilla|social.hubzilla|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
353
-        sed -i "s|social.hubzilla.*|social.hubzilla = \"$HUBZILLA_DOMAIN_NAME\"|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
349
+    if grep -q "social.hubzilla" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini; then
350
+        sed -i "s|;social.hubzilla|social.hubzilla|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
351
+        sed -i "s|social.hubzilla.*|social.hubzilla = \"$HUBZILLA_DOMAIN_NAME\"|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
354
     fi
352
     fi
355
-    if grep -q "social.gnusocial" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini; then
356
-        sed -i "s|;social.gnusocial|social.gnusocial|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
357
-        sed -i "s|social.gnusocial.*|social.gnusocial = \"$MICROHTMLY_DOMAIN_NAME\"|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
353
+    if grep -q "social.gnusocial" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini; then
354
+        sed -i "s|;social.gnusocial|social.gnusocial|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
355
+        sed -i "s|social.gnusocial.*|social.gnusocial = \"$MICROHTMLY_DOMAIN_NAME\"|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
358
     fi
356
     fi
359
 
357
 
360
     # clear proprietary social network strings
358
     # clear proprietary social network strings
361
-    sed -i 's|social.facebook.*|social.facebook = ""|g' /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
362
-    sed -i 's|social.twitter.*|social.twitter = ""|g' /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
363
-    sed -i 's|social.google.*|social.google = ""|g' /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
359
+    sed -i 's|social.facebook.*|social.facebook = ""|g' /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
360
+    sed -i 's|social.twitter.*|social.twitter = ""|g' /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
361
+    sed -i 's|social.google.*|social.google = ""|g' /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
364
 }
362
 }
365
 
363
 
366
 function install_htmly_user {
364
 function install_htmly_user {
367
     # create a user password
365
     # create a user password
368
     function_check get_htmly_admin_password
366
     function_check get_htmly_admin_password
369
     get_htmly_admin_password
367
     get_htmly_admin_password
370
-    if [ ! $HYMLY_ADMIN_PASSWORD ]; then
368
+    if [ ! $HTMLY_ADMIN_PASSWORD ]; then
371
         if [ -f $IMAGE_PASSWORD_FILE ]; then
369
         if [ -f $IMAGE_PASSWORD_FILE ]; then
372
-            HYMLY_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
370
+            HTMLY_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
373
         else
371
         else
374
-            HYMLY_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
372
+            HTMLY_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
375
         fi
373
         fi
376
         echo '' >> /home/$MY_USERNAME/README
374
         echo '' >> /home/$MY_USERNAME/README
377
         echo '' >> /home/$MY_USERNAME/README
375
         echo '' >> /home/$MY_USERNAME/README
378
         echo $'HTMLy Htmly' >> /home/$MY_USERNAME/README
376
         echo $'HTMLy Htmly' >> /home/$MY_USERNAME/README
379
         echo '==========' >> /home/$MY_USERNAME/README
377
         echo '==========' >> /home/$MY_USERNAME/README
380
         echo $"Your htmly username: $MY_USERNAME" >> /home/$MY_USERNAME/README
378
         echo $"Your htmly username: $MY_USERNAME" >> /home/$MY_USERNAME/README
381
-        echo $"Your htmly password is: $HYMLY_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
379
+        echo $"Your htmly password is: $HTMLY_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
382
         if [[ $ONION_ONLY == 'no' ]]; then
380
         if [[ $ONION_ONLY == 'no' ]]; then
383
-            echo $"Log into your htmly at https://$HYMLY_DOMAIN_NAME/login" >> /home/$MY_USERNAME/README
381
+            echo $"Log into your htmly at https://$HTMLY_DOMAIN_NAME/login" >> /home/$MY_USERNAME/README
384
         fi
382
         fi
385
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
383
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
386
         chmod 600 /home/$MY_USERNAME/README
384
         chmod 600 /home/$MY_USERNAME/README
387
     fi
385
     fi
388
 
386
 
389
     # create a user
387
     # create a user
390
-    HYMLY_ADMIN_PASSWORD_HASH=$(${PROJECT_NAME}-sec --htmlyhash "$HYMLY_ADMIN_PASSWORD")
391
-    if [ ${#HYMLY_ADMIN_PASSWORD_HASH} -lt 8 ]; then
388
+    HTMLY_ADMIN_PASSWORD_HASH=$(${PROJECT_NAME}-sec --htmlyhash "$HTMLY_ADMIN_PASSWORD")
389
+    if [ ${#HTMLY_ADMIN_PASSWORD_HASH} -lt 8 ]; then
392
         echo $'Htmly admin password could not be hashed'
390
         echo $'Htmly admin password could not be hashed'
393
         exit 625728
391
         exit 625728
394
     fi
392
     fi
395
-    echo ';Password' > /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
396
-    echo "password = $HYMLY_ADMIN_PASSWORD_HASH" >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
397
-    echo 'encryption = password_hash' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
398
-    echo ';Role' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
399
-    echo 'role = admin' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
393
+    echo ';Password' > /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
394
+    echo "password = $HTMLY_ADMIN_PASSWORD_HASH" >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
395
+    echo 'encryption = password_hash' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
396
+    echo ';Role' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
397
+    echo 'role = admin' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
400
 }
398
 }
401
 
399
 
402
 function install_htmly_settings {
400
 function install_htmly_settings {
403
-    cp /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini.example /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
404
-    sed -i "s|site.url.*|site.url = '/'|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
405
-    sed -i "s|htmly.title.*|htmly.title = '$HTMLY_TITLE'|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
406
-    sed -i "s|htmly.tagline.*|htmly.tagline = '$HTMLY_SUBTITLE'|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
407
-    sed -i 's|timezone.*|timezone = "Europe/London"|g' /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
408
-    sed -i "s|Your name|$MY_NAME|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
401
+    cp /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini.example /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
402
+    sed -i "s|site.url.*|site.url = '/'|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
403
+    sed -i "s|htmly.title.*|htmly.title = '$HTMLY_TITLE'|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
404
+    sed -i "s|htmly.tagline.*|htmly.tagline = '$HTMLY_SUBTITLE'|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
405
+    sed -i 's|timezone.*|timezone = "Europe/London"|g' /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
406
+    sed -i "s|Your name|$MY_NAME|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
409
 }
407
 }
410
 
408
 
411
 function install_htmly_website {
409
 function install_htmly_website {
412
     function_check nginx_http_redirect
410
     function_check nginx_http_redirect
413
-    nginx_http_redirect $HYMLY_DOMAIN_NAME
414
-    echo 'server {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
415
-    echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
416
-    echo "    root /var/www/$HYMLY_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
417
-    echo "    server_name $HYMLY_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
418
-    echo '    access_log off;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
419
-    echo "    error_log /var/log/nginx/${HYMLY_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
420
-    echo '    index index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
421
-    echo '    charset utf-8;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
422
-    echo '    proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
411
+    nginx_http_redirect $HTMLY_DOMAIN_NAME
412
+    echo 'server {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
413
+    echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
414
+    echo "    root /var/www/$HTMLY_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
415
+    echo "    server_name $HTMLY_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
416
+    echo '    access_log off;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
417
+    echo "    error_log /var/log/nginx/${HTMLY_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
418
+    echo '    index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
419
+    echo '    charset utf-8;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
420
+    echo '    proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
423
     function_check nginx_ssl
421
     function_check nginx_ssl
424
-    nginx_ssl $HYMLY_DOMAIN_NAME
422
+    nginx_ssl $HTMLY_DOMAIN_NAME
425
     function_check nginx_disable_sniffing
423
     function_check nginx_disable_sniffing
426
-    nginx_disable_sniffing $HYMLY_DOMAIN_NAME
427
-    echo '    add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
428
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
429
-    echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
430
-    echo '    location / {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
424
+    nginx_disable_sniffing $HTMLY_DOMAIN_NAME
425
+    echo '    add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
426
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
427
+    echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
428
+    echo '    location / {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
431
     function_check nginx_limits
429
     function_check nginx_limits
432
-    nginx_limits $HYMLY_DOMAIN_NAME
433
-    echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
434
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
435
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
436
-    echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
437
-    echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
438
-    echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
439
-    echo '        allow all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
440
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
441
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
442
-    echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
443
-    echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
444
-    echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
445
-    echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
446
-    echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
447
-    echo '        expires 30d;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
448
-    echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
449
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
450
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
451
-    echo '    # block these file types' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
452
-    echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
453
-    echo '        deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
454
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
455
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
456
-    echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
457
-    echo '    # or a unix socket' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
458
-    echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
459
-    echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
460
-    echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
461
-    echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
462
-    echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
463
-    echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
464
-    echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
465
-    echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
466
-    echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
467
-    echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
468
-    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
469
-    echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
470
-    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
471
-    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
472
-    echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
473
-    echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
474
-    echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
475
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
476
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
477
-    echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
478
-    echo '    location ~ /\. {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
479
-    echo '        deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
480
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
481
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
482
-    echo '    #deny access to store' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
483
-    echo '    location ~ /store {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
484
-    echo '        deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
485
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
486
-    echo '    location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
487
-    echo '      deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
488
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
489
-    echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
490
-    echo '      deny  all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
491
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
492
-    echo '}' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
493
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
430
+    nginx_limits $HTMLY_DOMAIN_NAME
431
+    echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
432
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
433
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
434
+    echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
435
+    echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
436
+    echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
437
+    echo '        allow all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
438
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
439
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
440
+    echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
441
+    echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
442
+    echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
443
+    echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
444
+    echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
445
+    echo '        expires 30d;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
446
+    echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
447
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
448
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
449
+    echo '    # block these file types' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
450
+    echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
451
+    echo '        deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
452
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
453
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
454
+    echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
455
+    echo '    # or a unix socket' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
456
+    echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
457
+    echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
458
+    echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
459
+    echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
460
+    echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
461
+    echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
462
+    echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
463
+    echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
464
+    echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
465
+    echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
466
+    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
467
+    echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
468
+    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
469
+    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
470
+    echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
471
+    echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
472
+    echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
473
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
474
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
475
+    echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
476
+    echo '    location ~ /\. {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
477
+    echo '        deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
478
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
479
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
480
+    echo '    #deny access to store' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
481
+    echo '    location ~ /store {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
482
+    echo '        deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
483
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
484
+    echo '    location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
485
+    echo '      deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
486
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
487
+    echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
488
+    echo '      deny  all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
489
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
490
+    echo '}' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
491
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
494
 }
492
 }
495
 
493
 
496
 function install_htmly_website_onion {
494
 function install_htmly_website_onion {
497
-    echo 'server {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
498
-    echo "    listen 127.0.0.1:${HYMLY_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
499
-    echo "    root /var/www/$HYMLY_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
500
-    echo "    server_name $HYMLY_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
501
-    echo '    access_log off;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
502
-    echo "    error_log /var/log/nginx/${HYMLY_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
503
-    echo '    index index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
504
-    echo '    charset utf-8;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
505
-    echo '    proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
495
+    echo 'server {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
496
+    echo "    listen 127.0.0.1:${HTMLY_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
497
+    echo "    root /var/www/$HTMLY_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
498
+    echo "    server_name $HTMLY_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
499
+    echo '    access_log off;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
500
+    echo "    error_log /var/log/nginx/${HTMLY_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
501
+    echo '    index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
502
+    echo '    charset utf-8;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
503
+    echo '    proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
506
     function_check nginx_disable_sniffing
504
     function_check nginx_disable_sniffing
507
-    nginx_disable_sniffing $HYMLY_DOMAIN_NAME
508
-    echo '    add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
509
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
510
-    echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
511
-    echo '    location / {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
505
+    nginx_disable_sniffing $HTMLY_DOMAIN_NAME
506
+    echo '    add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
507
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
508
+    echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
509
+    echo '    location / {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
512
     function_check nginx_limits
510
     function_check nginx_limits
513
-    nginx_limits $HYMLY_DOMAIN_NAME
514
-    echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
515
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
516
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
517
-    echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
518
-    echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
519
-    echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
520
-    echo '        allow all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
521
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
522
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
523
-    echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
524
-    echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
525
-    echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
526
-    echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
527
-    echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
528
-    echo '        expires 30d;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
529
-    echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
530
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
531
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
532
-    echo '    # block these file types' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
533
-    echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
534
-    echo '        deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
535
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
536
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
537
-    echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
538
-    echo '    # or a unix socket' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
539
-    echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
511
+    nginx_limits $HTMLY_DOMAIN_NAME
512
+    echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
513
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
514
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
515
+    echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
516
+    echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
517
+    echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
518
+    echo '        allow all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
519
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
520
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
521
+    echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
522
+    echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
523
+    echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
524
+    echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
525
+    echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
526
+    echo '        expires 30d;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
527
+    echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
528
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
529
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
530
+    echo '    # block these file types' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
531
+    echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
532
+    echo '        deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
533
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
534
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
535
+    echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
536
+    echo '    # or a unix socket' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
537
+    echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
540
     function_check nginx_limits
538
     function_check nginx_limits
541
-    nginx_limits $HYMLY_DOMAIN_NAME
542
-    echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
543
-    echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
544
-    echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
545
-    echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
546
-    echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
547
-    echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
548
-    echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
549
-    echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
550
-    echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
551
-    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
552
-    echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
553
-    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
554
-    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
555
-    echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
556
-    echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
557
-    echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
558
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
559
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
560
-    echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
561
-    echo '    location ~ /\. {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
562
-    echo '        deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
563
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
564
-    echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
565
-    echo '    #deny access to store' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
566
-    echo '    location ~ /store {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
567
-    echo '        deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
568
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
569
-    echo '    location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
570
-    echo '      deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
571
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
572
-    echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
573
-    echo '      deny  all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
574
-    echo '    }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
575
-    echo '}' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
539
+    nginx_limits $HTMLY_DOMAIN_NAME
540
+    echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
541
+    echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
542
+    echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
543
+    echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
544
+    echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
545
+    echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
546
+    echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
547
+    echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
548
+    echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
549
+    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
550
+    echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
551
+    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
552
+    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
553
+    echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
554
+    echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
555
+    echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
556
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
557
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
558
+    echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
559
+    echo '    location ~ /\. {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
560
+    echo '        deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
561
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
562
+    echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
563
+    echo '    #deny access to store' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
564
+    echo '    location ~ /store {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
565
+    echo '        deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
566
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
567
+    echo '    location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
568
+    echo '      deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
569
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
570
+    echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
571
+    echo '      deny  all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
572
+    echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
573
+    echo '}' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
576
 }
574
 }
577
 
575
 
578
 function install_htmly_from_repo {
576
 function install_htmly_from_repo {
579
-    if [ ! -d /var/www/$HYMLY_DOMAIN_NAME ]; then
580
-        mkdir /var/www/$HYMLY_DOMAIN_NAME
577
+    if [ ! -d /var/www/$HTMLY_DOMAIN_NAME ]; then
578
+        mkdir /var/www/$HTMLY_DOMAIN_NAME
581
     fi
579
     fi
582
 
580
 
583
-    cd /var/www/$HYMLY_DOMAIN_NAME
584
-    git_clone $HYMLY_REPO htdocs
581
+    cd /var/www/$HTMLY_DOMAIN_NAME
582
+    git_clone $HTMLY_REPO htdocs
585
     cd htdocs
583
     cd htdocs
586
-    git checkout $HYMLY_COMMIT -b $HYMLY_COMMIT
587
-    if ! grep -q "htmly commit" $COMPLETION_FILE; then
588
-        echo "htmly commit:$HYMLY_COMMIT" >> $COMPLETION_FILE
589
-    else
590
-        sed -i "s/htmly commit.*/htmly commit:$HYMLY_COMMIT/g" $COMPLETION_FILE
591
-    fi
584
+    git checkout $HTMLY_COMMIT -b $HTMLY_COMMIT
585
+    set_completion_param "htmly commit" "$HTMLY_COMMIT"
592
 }
586
 }
593
 
587
 
594
 function install_htmly {
588
 function install_htmly {
596
         ONION_ONLY='no'
590
         ONION_ONLY='no'
597
     fi
591
     fi
598
 
592
 
599
-    if [ ! $HYMLY_DOMAIN_NAME ]; then
593
+    if [ ! $HTMLY_DOMAIN_NAME ]; then
600
         echo $'The htmly domain name was not specified'
594
         echo $'The htmly domain name was not specified'
601
         exit 5062
595
         exit 5062
602
     fi
596
     fi
611
         function_check install_htmly_website
605
         function_check install_htmly_website
612
         install_htmly_website
606
         install_htmly_website
613
     else
607
     else
614
-        echo -n '' > /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
608
+        echo -n '' > /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
615
     fi
609
     fi
616
     function_check install_htmly_website_onion
610
     function_check install_htmly_website_onion
617
     install_htmly_website_onion
611
     install_htmly_website_onion
618
 
612
 
619
     function_check create_site_certificate
613
     function_check create_site_certificate
620
-    create_site_certificate $HYMLY_DOMAIN_NAME 'yes'
614
+    create_site_certificate $HTMLY_DOMAIN_NAME 'yes'
621
 
615
 
622
     function_check configure_php
616
     function_check configure_php
623
     configure_php
617
     configure_php
631
     function_check install_htmly_user
625
     function_check install_htmly_user
632
     install_htmly_user
626
     install_htmly_user
633
 
627
 
634
-    chown -R www-data:www-data /var/www/$HYMLY_DOMAIN_NAME/htdocs
628
+    chown -R www-data:www-data /var/www/$HTMLY_DOMAIN_NAME/htdocs
635
 
629
 
636
-    HYMLY_ONION_HOSTNAME=$(add_onion_service htmly 80 ${HYMLY_ONION_PORT})
630
+    HTMLY_ONION_HOSTNAME=$(add_onion_service htmly 80 ${HTMLY_ONION_PORT})
637
 
631
 
638
     function_check nginx_ensite
632
     function_check nginx_ensite
639
-    nginx_ensite $HYMLY_DOMAIN_NAME
633
+    nginx_ensite $HTMLY_DOMAIN_NAME
640
 
634
 
641
     systemctl restart php5-fpm
635
     systemctl restart php5-fpm
642
     systemctl restart nginx
636
     systemctl restart nginx
643
 
637
 
644
     if ! grep -q "Htmly onion domain" /home/$MY_USERNAME/README; then
638
     if ! grep -q "Htmly onion domain" /home/$MY_USERNAME/README; then
645
-        echo $"Htmly onion domain: ${HYMLY_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
646
-        echo $"Log into your htmly at https://${HYMLY_ONION_HOSTNAME}/login" >> /home/$MY_USERNAME/README
639
+        echo $"Htmly onion domain: ${HTMLY_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
640
+        echo $"Log into your htmly at https://${HTMLY_ONION_HOSTNAME}/login" >> /home/$MY_USERNAME/README
647
         echo '' >> /home/$MY_USERNAME/README
641
         echo '' >> /home/$MY_USERNAME/README
648
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
642
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
649
         chmod 600 /home/$MY_USERNAME/README
643
         chmod 600 /home/$MY_USERNAME/README
650
     fi
644
     fi
651
 
645
 
652
     function_check add_ddns_domain
646
     function_check add_ddns_domain
653
-    add_ddns_domain $HYMLY_DOMAIN_NAME
647
+    add_ddns_domain $HTMLY_DOMAIN_NAME
654
 
648
 
655
-    if ! grep -q "htmly domain:" $COMPLETION_FILE; then
656
-        echo "htmly domain:$HYMLY_DOMAIN_NAME" >> $COMPLETION_FILE
657
-    fi
649
+    set_completion_param "htmly domain" "$HTMLY_DOMAIN_NAME"
658
     APP_INSTALLED=1
650
     APP_INSTALLED=1
659
 }
651
 }
660
 
652
 

+ 5
- 13
src/freedombone-app-hubzilla Datei anzeigen

59
         1) return;;
59
         1) return;;
60
         255) return;;
60
         255) return;;
61
     esac
61
     esac
62
-    HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
62
+    HUBZILLA_DOMAIN_NAME=$(get_completion_param "hubzilla domain")
63
     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs ]; then
63
     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs ]; then
64
         dialog --title $"Renew SSL certificate" \
64
         dialog --title $"Renew SSL certificate" \
65
                --msgbox $"Hubzilla install directory not found" 6 40
65
                --msgbox $"Hubzilla install directory not found" 6 40
80
                --msgbox $"Hubzilla is not installed on this system" 6 40
80
                --msgbox $"Hubzilla is not installed on this system" 6 40
81
         return
81
         return
82
     fi
82
     fi
83
-    HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
83
+    HUBZILLA_DOMAIN_NAME=$(get_completion_param "hubzilla domain")
84
     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs ]; then
84
     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs ]; then
85
         dialog --title $"Hubzilla channel directory server" \
85
         dialog --title $"Hubzilla channel directory server" \
86
                --msgbox $"Hubzilla install directory not found" 6 40
86
                --msgbox $"Hubzilla install directory not found" 6 40
327
         function_check git_clone
327
         function_check git_clone
328
         git_clone $HUBZILLA_REPO hubzilla
328
         git_clone $HUBZILLA_REPO hubzilla
329
         git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
329
         git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
330
-        if ! grep -q "hubzilla commit" $COMPLETION_FILE; then
331
-            echo "hubzilla commit:$HUBZILLA_COMMIT" >> $COMPLETION_FILE
332
-        else
333
-            sed -i "s/hubzilla commit.*/hubzilla commit:$HUBZILLA_COMMIT/g" $COMPLETION_FILE
334
-        fi
330
+        set_completion_param "hubzilla commit" "$HUBZILLA_COMMIT"
335
 
331
 
336
         rm -rf $HUBZILLA_PATH
332
         rm -rf $HUBZILLA_PATH
337
         mv hubzilla $HUBZILLA_PATH
333
         mv hubzilla $HUBZILLA_PATH
339
         git_clone $HUBZILLA_ADDONS_REPO $HUBZILLA_PATH/addon
335
         git_clone $HUBZILLA_ADDONS_REPO $HUBZILLA_PATH/addon
340
         cd $HUBZILLA_PATH/addon
336
         cd $HUBZILLA_PATH/addon
341
         git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
337
         git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
342
-        if ! grep -q "hubzilla addons commit" $COMPLETION_FILE; then
343
-            echo "hubzilla addons commit:$HUBZILLA_ADDONS_COMMIT" >> $COMPLETION_FILE
344
-        else
345
-            sed -i "s/hubzilla addons commit.*/hubzilla addons commit:$HUBZILLA_ADDONS_COMMIT/g" $COMPLETION_FILE
346
-        fi
338
+        set_completion_param "hubzilla addons commit" "$HUBZILLA_ADDONS_COMMIT"
347
 
339
 
348
         # some extra themes
340
         # some extra themes
349
         git_clone $HUBZILLA_THEMES_REPO $HUBZILLA_PATH/redmatrix-themes1
341
         git_clone $HUBZILLA_THEMES_REPO $HUBZILLA_PATH/redmatrix-themes1
599
 
591
 
600
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$HUBZILLA_DOMAIN_NAME" -g hubzilla --public no
592
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$HUBZILLA_DOMAIN_NAME" -g hubzilla --public no
601
 
593
 
602
-    echo "hubzilla domain:${HUBZILLA_DOMAIN_NAME}" >> $COMPLETION_FILE
594
+    set_completion_param "hubzilla domain" "${HUBZILLA_DOMAIN_NAME}"
603
     APP_INSTALLED=1
595
     APP_INSTALLED=1
604
 }
596
 }
605
 
597
 

+ 8
- 12
src/freedombone-app-ipfs Datei anzeigen

89
     if ! grep -q "Admin user" $COMPLETION_FILE; then
89
     if ! grep -q "Admin user" $COMPLETION_FILE; then
90
         return
90
         return
91
     fi
91
     fi
92
-    ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
92
+    ADMIN_USERNAME=$(get_completion_param "Admin user")
93
     source_directory=/home/$ADMIN_USERNAME/.ipfs
93
     source_directory=/home/$ADMIN_USERNAME/.ipfs
94
     if [ -d $source_directory ]; then
94
     if [ -d $source_directory ]; then
95
         dest_directory=ipfs
95
         dest_directory=ipfs
111
         temp_restore_dir=/root/tempipfs
111
         temp_restore_dir=/root/tempipfs
112
         function_check restore_directory_from_usb
112
         function_check restore_directory_from_usb
113
         restore_directory_from_usb $temp_restore_dir ipfs
113
         restore_directory_from_usb $temp_restore_dir ipfs
114
-        ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
114
+        ADMIN_USERNAME=$(get_completion_param "Admin user")
115
         cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
115
         cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
116
         if [ ! "$?" = "0" ]; then
116
         if [ ! "$?" = "0" ]; then
117
             rm -rf $temp_restore_dir
117
             rm -rf $temp_restore_dir
130
     if ! grep -q "Admin user" $COMPLETION_FILE; then
130
     if ! grep -q "Admin user" $COMPLETION_FILE; then
131
         return
131
         return
132
     fi
132
     fi
133
-    ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
133
+    ADMIN_USERNAME=$(get_completion_param "Admin user")
134
     if [ -d /home/$ADMIN_USERNAME/.ipfs ]; then
134
     if [ -d /home/$ADMIN_USERNAME/.ipfs ]; then
135
         echo $"Backing up IPFS"
135
         echo $"Backing up IPFS"
136
         backup_directory_to_friend /home/$ADMIN_USERNAME/.ipfs ipfs
136
         backup_directory_to_friend /home/$ADMIN_USERNAME/.ipfs ipfs
193
 }
193
 }
194
 
194
 
195
 function configure_firewall_for_ipfs {
195
 function configure_firewall_for_ipfs {
196
-    if grep -Fxq "configure_firewall_for_ipfs" $COMPLETION_FILE; then
196
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
197
         return
197
         return
198
     fi
198
     fi
199
     if [[ $ONION_ONLY != "no" ]]; then
199
     if [[ $ONION_ONLY != "no" ]]; then
204
     save_firewall_settings
204
     save_firewall_settings
205
 
205
 
206
     OPEN_PORTS+=("IPFS     $IPFS_PORT")
206
     OPEN_PORTS+=("IPFS     $IPFS_PORT")
207
-    echo 'configure_firewall_for_ipfs' >> $COMPLETION_FILE
207
+    mark_completed $FUNCNAME
208
 }
208
 }
209
 
209
 
210
 function mesh_install_ipfs_js {
210
 function mesh_install_ipfs_js {
211
-    if grep -Fxq "mesh_install_ipfs_js" $COMPLETION_FILE; then
211
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
212
         return
212
         return
213
     fi
213
     fi
214
 
214
 
280
 
280
 
281
     chroot ${rootdir} systemctl enable ${IPFS_DAEMON_NAME}
281
     chroot ${rootdir} systemctl enable ${IPFS_DAEMON_NAME}
282
 
282
 
283
-    echo 'mesh install_ipfs_js' >> $COMPLETION_FILE
283
+    mark_completed $FUNCNAME
284
 }
284
 }
285
 
285
 
286
 function install_ipfs_js {
286
 function install_ipfs_js {
515
         exit 735639
515
         exit 735639
516
     fi
516
     fi
517
 
517
 
518
-    if ! grep -q "ipfs commit" $COMPLETION_FILE; then
519
-        echo "ipfs commit:$IPFS_COMMIT" >> $COMPLETION_FILE
520
-    else
521
-        sed -i "s/ipfs commit.*/ipfs commit:$IPFS_COMMIT/g" $COMPLETION_FILE
522
-    fi
518
+    set_completion_param "ipfs commit" "$IPFS_COMMIT"
523
 
519
 
524
     make install
520
     make install
525
     if [ ! "$?" = "0" ]; then
521
     if [ ! "$?" = "0" ]; then

+ 4
- 12
src/freedombone-app-librevault Datei anzeigen

120
 }
120
 }
121
 
121
 
122
 function configure_firewall_for_librevault {
122
 function configure_firewall_for_librevault {
123
-    if grep -Fxq "configure_firewall_for_librevault" $COMPLETION_FILE; then
123
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
124
         return
124
         return
125
     fi
125
     fi
126
     iptables -A INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
126
     iptables -A INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
128
     function_check save_firewall_settings
128
     function_check save_firewall_settings
129
     save_firewall_settings
129
     save_firewall_settings
130
     OPEN_PORTS+=("Librevault $LIBREVAULT_PORT")
130
     OPEN_PORTS+=("Librevault $LIBREVAULT_PORT")
131
-    echo 'configure_firewall_for_librevault' >> $COMPLETION_FILE
131
+    mark_completed $FUNCNAME
132
 }
132
 }
133
 
133
 
134
 function mesh_install_librevault {
134
 function mesh_install_librevault {
263
     make install
263
     make install
264
     ldconfig
264
     ldconfig
265
 
265
 
266
-    if ! grep -q "Protobuf commit" $COMPLETION_FILE; then
267
-        echo "Protobuf commit:$PROTOBUF_COMMIT" >> $COMPLETION_FILE
268
-    else
269
-        sed -i "s/Protobuf commit.*/Protobuf commit:$PROTOBUF_COMMIT/g" $COMPLETION_FILE
270
-    fi
266
+    set_completion_param "Protobuf commit" "$PROTOBUF_COMMIT"
271
 
267
 
272
     git_clone $LIBREVAULT_REPO $INSTALL_DIR/librevault
268
     git_clone $LIBREVAULT_REPO $INSTALL_DIR/librevault
273
     cd $INSTALL_DIR/librevault
269
     cd $INSTALL_DIR/librevault
286
     cmake --build .
282
     cmake --build .
287
     make install
283
     make install
288
 
284
 
289
-    if ! grep -q "Librevault commit" $COMPLETION_FILE; then
290
-        echo "Librevault commit:$LIBREVAULT_COMMIT" >> $COMPLETION_FILE
291
-    else
292
-        sed -i "s/Librevault commit.*/Librevault commit:$LIBREVAULT_COMMIT/g" $COMPLETION_FILE
293
-    fi
285
+    set_completion_param "Librevault commit" "$LIBREVAULT_COMMIT"
294
 
286
 
295
     LIBREVAULT_DAEMON=/etc/systemd/system/librevault-daemon.service
287
     LIBREVAULT_DAEMON=/etc/systemd/system/librevault-daemon.service
296
     echo '[Unit]' > $LIBREVAULT_DAEMON
288
     echo '[Unit]' > $LIBREVAULT_DAEMON

+ 2
- 10
src/freedombone-app-mediagoblin Datei anzeigen

211
     git submodule init
211
     git submodule init
212
     git submodule update
212
     git submodule update
213
 
213
 
214
-    if ! grep -q "Mediagoblin commit" $COMPLETION_FILE; then
215
-        echo "Mediagoblin commit:$MEDIAGOBLIN_COMMIT" >> $COMPLETION_FILE
216
-    else
217
-        sed -i "s/Mediagoblin commit.*/Mediagoblin commit:$MEDIAGOBLIN_COMMIT/g" $COMPLETION_FILE
218
-    fi
214
+    set_completion_param "mediagoblin commit" "$MEDIAGOBLIN_COMMIT"
219
 
215
 
220
     chown -hR mediagoblin:www-data $MEDIAGOBLIN_WORKING_DIRECTORY
216
     chown -hR mediagoblin:www-data $MEDIAGOBLIN_WORKING_DIRECTORY
221
     su -c "cd $MEDIAGOBLIN_WORKING_DIRECTORY && ./bootstrap.sh" - mediagoblin
217
     su -c "cd $MEDIAGOBLIN_WORKING_DIRECTORY && ./bootstrap.sh" - mediagoblin
497
 
493
 
498
     add_ddns_domain $MEDIAGOBLIN_DOMAIN_NAME
494
     add_ddns_domain $MEDIAGOBLIN_DOMAIN_NAME
499
 
495
 
500
-    if ! grep -q "Mediagoblin domain" $COMPLETION_FILE; then
501
-        echo "Mediagoblin domain:$MEDIAGOBLIN_DOMAIN_NAME" >> $COMPLETION_FILE
502
-    else
503
-        sed -i "s/Mediagoblin domain.*/Mediagoblin domain:$MEDIAGOBLIN_DOMAIN_NAME/g" $COMPLETION_FILE
504
-    fi
496
+    set_completion_param "mediagoblin domain" "$MEDIAGOBLIN_DOMAIN_NAME"
505
     APP_INSTALLED=1
497
     APP_INSTALLED=1
506
 }
498
 }
507
 
499
 

+ 2
- 2
src/freedombone-app-mumble Datei anzeigen

178
 }
178
 }
179
 
179
 
180
 function configure_firewall_for_mumble {
180
 function configure_firewall_for_mumble {
181
-    if grep -Fxq "configure_firewall_for_mumble" $COMPLETION_FILE; then
181
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
182
         return
182
         return
183
     fi
183
     fi
184
     if [[ $ONION_ONLY != "no" ]]; then
184
     if [[ $ONION_ONLY != "no" ]]; then
190
     save_firewall_settings
190
     save_firewall_settings
191
 
191
 
192
     OPEN_PORTS+=("Mumble   $MUMBLE_PORT")
192
     OPEN_PORTS+=("Mumble   $MUMBLE_PORT")
193
-    echo 'configure_firewall_for_mumble' >> $COMPLETION_FILE
193
+    mark_completed $FUNCNAME
194
 }
194
 }
195
 
195
 
196
 function install_mumble {
196
 function install_mumble {

+ 4
- 10
src/freedombone-app-rss Datei anzeigen

129
 
129
 
130
 function backup_local_rss {
130
 function backup_local_rss {
131
     if [ -d /etc/share/tt-rss ]; then
131
     if [ -d /etc/share/tt-rss ]; then
132
-        RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "rss reader domain" | awk -F ':' '{print $2}')
132
+        RSS_READER_DOMAIN_NAME=$(get_completion_param "rss reader domain")
133
 
133
 
134
         echo $"Backing up ttrss"
134
         echo $"Backing up ttrss"
135
 
135
 
298
     fi
298
     fi
299
     cd $RSS_READER_PATH
299
     cd $RSS_READER_PATH
300
     git checkout $RSS_READER_COMMIT -b $RSS_READER_COMMIT
300
     git checkout $RSS_READER_COMMIT -b $RSS_READER_COMMIT
301
-    if ! grep -q "rss reader commit" $COMPLETION_FILE; then
302
-        echo "rss reader commit:$RSS_READER_COMMIT" >> $COMPLETION_FILE
303
-    fi
301
+    set_completion_param "rss reader commit" "$RSS_READER_COMMIT"
304
 
302
 
305
     function_check install_mariadb
303
     function_check install_mariadb
306
     install_mariadb
304
     install_mariadb
543
     cp -r $INSTALL_DIR/ttrss-gnusocial $RSS_READER_GNUSOCIAL_PATH
541
     cp -r $INSTALL_DIR/ttrss-gnusocial $RSS_READER_GNUSOCIAL_PATH
544
     cd $RSS_READER_GNUSOCIAL_PATH
542
     cd $RSS_READER_GNUSOCIAL_PATH
545
     git checkout $RSS_READER_GNUSOCIAL_COMMIT -b $RSS_READER_GNUSOCIAL_COMMIT
543
     git checkout $RSS_READER_GNUSOCIAL_COMMIT -b $RSS_READER_GNUSOCIAL_COMMIT
546
-    if ! grep -q "rss reader gnusocial commit" $COMPLETION_FILE; then
547
-        echo "rss reader gnusocial commit:$RSS_READER_GNUSOCIAL_COMMIT" >> $COMPLETION_FILE
548
-    fi
544
+    set_completion_param "rss reader gnusocial commit" "$RSS_READER_GNUSOCIAL_COMMIT"
549
     chown -R www-data:www-data $RSS_READER_GNUSOCIAL_PATH
545
     chown -R www-data:www-data $RSS_READER_GNUSOCIAL_PATH
550
     install_completed rss_gnusocial
546
     install_completed rss_gnusocial
551
 }
547
 }
584
     fi
580
     fi
585
     cd $RSS_MOBILE_READER_PATH
581
     cd $RSS_MOBILE_READER_PATH
586
     git checkout $RSS_MOBILE_READER_COMMIT -b $RSS_MOBILE_READER_COMMIT
582
     git checkout $RSS_MOBILE_READER_COMMIT -b $RSS_MOBILE_READER_COMMIT
587
-    if ! grep -q "rss mobile reader commit" $COMPLETION_FILE; then
588
-        echo "rss mobile reader commit:$RSS_MOBILE_READER_COMMIT" >> $COMPLETION_FILE
589
-    fi
583
+    set_completion_param "rss mobile reader commit" "$RSS_MOBILE_READER_COMMIT"
590
 
584
 
591
     echo 'define({' > $RSS_MOBILE_READER_PATH/scripts/conf.js
585
     echo 'define({' > $RSS_MOBILE_READER_PATH/scripts/conf.js
592
     echo '  apiPath: "/tt-rss/"' >> $RSS_MOBILE_READER_PATH/scripts/conf.js
586
     echo '  apiPath: "/tt-rss/"' >> $RSS_MOBILE_READER_PATH/scripts/conf.js

+ 4
- 10
src/freedombone-app-searx Datei anzeigen

69
                 echo '        http : socks5://127.0.0.1:9050' >> ${SEARX_PATH}/searx/searx/settings.yml
69
                 echo '        http : socks5://127.0.0.1:9050' >> ${SEARX_PATH}/searx/searx/settings.yml
70
                 echo '        https: socks5://127.0.0.1:9050' >> ${SEARX_PATH}/searx/searx/settings.yml
70
                 echo '        https: socks5://127.0.0.1:9050' >> ${SEARX_PATH}/searx/searx/settings.yml
71
             fi
71
             fi
72
-            SEARX_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
72
+            SEARX_SECRET_KEY=$(get_completion_param "searx key")
73
             sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings.yml
73
             sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings.yml
74
             if [ -f /var/lib/tor/hidden_service_searx/hostname ]; then
74
             if [ -f /var/lib/tor/hidden_service_searx/hostname ]; then
75
                 SEARX_ONION_HOSTNAME=$(echo /var/lib/tor/hidden_service_searx/hostname)
75
                 SEARX_ONION_HOSTNAME=$(echo /var/lib/tor/hidden_service_searx/hostname)
164
     function_check git_clone
164
     function_check git_clone
165
     git_clone $SEARX_REPO searx
165
     git_clone $SEARX_REPO searx
166
     git checkout $SEARX_COMMIT -b $SEARX_COMMIT
166
     git checkout $SEARX_COMMIT -b $SEARX_COMMIT
167
-    if ! grep -q "Search engine commit" $COMPLETION_FILE; then
168
-        echo "Search engine commit:$SEARX_COMMIT" >> $COMPLETION_FILE
169
-    else
170
-        sed -i "s/Search engine commit.*/Search engine commit:$SEARX_COMMIT/g" $COMPLETION_FILE
171
-    fi
167
+    set_completion_param "searx commit" "$SEARX_COMMIT"
172
 
168
 
173
     # create an onion service
169
     # create an onion service
174
     SEARX_ONION_HOSTNAME=$(add_onion_service searx 80 ${SEARX_ONION_PORT})
170
     SEARX_ONION_HOSTNAME=$(add_onion_service searx 80 ${SEARX_ONION_PORT})
235
     echo '}' >> /etc/nginx/sites-available/searx
231
     echo '}' >> /etc/nginx/sites-available/searx
236
 
232
 
237
     # replace the secret key
233
     # replace the secret key
238
-    if ! grep "Search engine key" $COMPLETION_FILE; then
234
+    if ! grep "searx key" $COMPLETION_FILE; then
239
         SEARX_SECRET_KEY="$(create_password 30)"
235
         SEARX_SECRET_KEY="$(create_password 30)"
240
-        echo "Search engine key:${SEARX_SECRET_KEY}" >> $COMPLETION_FILE
241
-    else
242
-        SEARX_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
243
     fi
236
     fi
237
+    set_completion_param "searx key" "${SEARX_SECRET_KEY}"
244
     sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings.yml
238
     sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings.yml
245
     sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings_robot.yml
239
     sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings_robot.yml
246
     sed -i '0,/RE/s/base_url.*/base_url : \"http://${SEARX_ONION_HOSTNAME}\/' ${SEARX_PATH}/searx/searx/settings.yml
240
     sed -i '0,/RE/s/base_url.*/base_url : \"http://${SEARX_ONION_HOSTNAME}\/' ${SEARX_PATH}/searx/searx/settings.yml

+ 4
- 4
src/freedombone-app-sip Datei anzeigen

183
 }
183
 }
184
 
184
 
185
 function configure_firewall_for_turn {
185
 function configure_firewall_for_turn {
186
-    if grep -Fxq "configure_firewall_for_turn" $COMPLETION_FILE; then
186
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
187
         return
187
         return
188
     fi
188
     fi
189
     if [[ $ONION_ONLY != "no" ]]; then
189
     if [[ $ONION_ONLY != "no" ]]; then
197
 
197
 
198
     OPEN_PORTS+=("TURN     $TURN_PORT")
198
     OPEN_PORTS+=("TURN     $TURN_PORT")
199
     OPEN_PORTS+=("TURN TLS $TURN_TLS_PORT")
199
     OPEN_PORTS+=("TURN TLS $TURN_TLS_PORT")
200
-    echo 'configure_firewall_for_turn' >> $COMPLETION_FILE
200
+    mark_completed $FUNCNAME
201
 }
201
 }
202
 
202
 
203
 
203
 
204
 function configure_firewall_for_sip4 {
204
 function configure_firewall_for_sip4 {
205
-    if grep -Fxq "configure_firewall_for_sip4" $COMPLETION_FILE; then
205
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
206
         return
206
         return
207
     fi
207
     fi
208
     if [[ $ONION_ONLY != "no" ]]; then
208
     if [[ $ONION_ONLY != "no" ]]; then
217
 
217
 
218
     OPEN_PORTS+=("SIP      $SIP_PORT")
218
     OPEN_PORTS+=("SIP      $SIP_PORT")
219
     OPEN_PORTS+=("SIP TLS  $SIP_TLS_PORT")
219
     OPEN_PORTS+=("SIP TLS  $SIP_TLS_PORT")
220
-    echo 'configure_firewall_for_sip4' >> $COMPLETION_FILE
220
+    mark_completed $FUNCNAME
221
 }
221
 }
222
 
222
 
223
 function get_sip_server_password {
223
 function get_sip_server_password {

+ 2
- 2
src/freedombone-app-syncthing Datei anzeigen

476
 }
476
 }
477
 
477
 
478
 function configure_firewall_for_syncthing {
478
 function configure_firewall_for_syncthing {
479
-    if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then
479
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
480
         return
480
         return
481
     fi
481
     fi
482
 
482
 
486
     save_firewall_settings
486
     save_firewall_settings
487
 
487
 
488
     OPEN_PORTS+=("Syncthing $SYNCTHING_PORT")
488
     OPEN_PORTS+=("Syncthing $SYNCTHING_PORT")
489
-    echo 'configure_firewall_for_syncthing' >> $COMPLETION_FILE
489
+    mark_completed $FUNCNAME
490
 }
490
 }
491
 
491
 
492
 function install_syncthing {
492
 function install_syncthing {

+ 2
- 2
src/freedombone-app-tahoelafs Datei anzeigen

203
 }
203
 }
204
 
204
 
205
 function configure_firewall_for_tahoelafs {
205
 function configure_firewall_for_tahoelafs {
206
-    if grep -Fxq "configure_firewall_for_tahoelafs" $COMPLETION_FILE; then
206
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
207
         return
207
         return
208
     fi
208
     fi
209
     iptables -A INPUT -p udp --dport $TAHOELAFS_PORT -j ACCEPT
209
     iptables -A INPUT -p udp --dport $TAHOELAFS_PORT -j ACCEPT
211
     function_check save_firewall_settings
211
     function_check save_firewall_settings
212
     save_firewall_settings
212
     save_firewall_settings
213
     OPEN_PORTS+=("Tahoe-LAFS $TAHOELAFS_PORT")
213
     OPEN_PORTS+=("Tahoe-LAFS $TAHOELAFS_PORT")
214
-    echo 'configure_firewall_for_tahoelafs' >> $COMPLETION_FILE
214
+    mark_completed $FUNCNAME
215
 }
215
 }
216
 
216
 
217
 function tahoelafs_update_script {
217
 function tahoelafs_update_script {

+ 4
- 6
src/freedombone-app-tox Datei anzeigen

283
 function configure_firewall_for_tox {
283
 function configure_firewall_for_tox {
284
     if [ ! $INSTALLING_MESH ]; then
284
     if [ ! $INSTALLING_MESH ]; then
285
         if [ -f $COMPLETION_FILE ]; then
285
         if [ -f $COMPLETION_FILE ]; then
286
-            if grep -Fxq "configure_firewall_for_tox" $COMPLETION_FILE; then
286
+            if [[ $(is_completed $FUNCNAME) == "1" ]]; then
287
                 return
287
                 return
288
             fi
288
             fi
289
         fi
289
         fi
312
     save_firewall_settings
312
     save_firewall_settings
313
 
313
 
314
     OPEN_PORTS+=("Tox      $TOX_PORT")
314
     OPEN_PORTS+=("Tox      $TOX_PORT")
315
-    if [ -f $COMPLETION_FILE ]; then
316
-        echo 'configure_firewall_for_tox' >> $COMPLETION_FILE
317
-    fi
315
+    mark_completed $FUNCNAME
318
 }
316
 }
319
 
317
 
320
 function tox_avahi {
318
 function tox_avahi {
321
-    if grep -Fxq "tox_avahi" $COMPLETION_FILE; then
319
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
322
         return
320
         return
323
     fi
321
     fi
324
 
322
 
351
 
349
 
352
     systemctl restart avahi-daemon
350
     systemctl restart avahi-daemon
353
 
351
 
354
-    echo 'tox_avahi' >> $COMPLETION_FILE
352
+    mark_completed $FUNCNAME
355
 }
353
 }
356
 
354
 
357
 function install_tox_node {
355
 function install_tox_node {

+ 1
- 5
src/freedombone-app-webmail Datei anzeigen

163
         git_clone $WEBMAIL_REPO webmail
163
         git_clone $WEBMAIL_REPO webmail
164
         cd $WEBMAIL_PATH
164
         cd $WEBMAIL_PATH
165
         git checkout $WEBMAIL_COMMIT -b $WEBMAIL_COMMIT
165
         git checkout $WEBMAIL_COMMIT -b $WEBMAIL_COMMIT
166
-        if ! grep -q "webmail commit" $COMPLETION_FILE; then
167
-            echo "webmail commit:$WEBMAIL_COMMIT" >> $COMPLETION_FILE
168
-        else
169
-            sed -i "s/webmail commit.*/webmail commit:$WEBMAIL_COMMIT/g" $COMPLETION_FILE
170
-        fi
166
+        set_completion_param "webmail commit" "$WEBMAIL_COMMIT"
171
     fi
167
     fi
172
     if [ ! -f $WEBMAIL_PATH/index.php ]; then
168
     if [ ! -f $WEBMAIL_PATH/index.php ]; then
173
         echo $'Did not clone webmail repo'
169
         echo $'Did not clone webmail repo'

+ 3
- 7
src/freedombone-app-xmpp Datei anzeigen

238
     if [ ! -d /etc/prosody ]; then
238
     if [ ! -d /etc/prosody ]; then
239
         return
239
         return
240
     fi
240
     fi
241
-    if grep -Fxq "configure_firewall_for_xmpp" $COMPLETION_FILE; then
241
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
242
         return
242
         return
243
     fi
243
     fi
244
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
244
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
257
     OPEN_PORTS+=('XMPP     5222-5223')
257
     OPEN_PORTS+=('XMPP     5222-5223')
258
     OPEN_PORTS+=('XMPP     5269')
258
     OPEN_PORTS+=('XMPP     5269')
259
     OPEN_PORTS+=('XMPP     5280-5281')
259
     OPEN_PORTS+=('XMPP     5280-5281')
260
-    echo 'configure_firewall_for_xmpp' >> $COMPLETION_FILE
260
+    mark_completed $FUNCNAME
261
 }
261
 }
262
 
262
 
263
 function remove_xmpp_client {
263
 function remove_xmpp_client {
444
         echo "VirtualHost \"${XMPP_ONION_HOSTNAME}\"" >> /etc/prosody/conf.avail/xmpp.cfg.lua
444
         echo "VirtualHost \"${XMPP_ONION_HOSTNAME}\"" >> /etc/prosody/conf.avail/xmpp.cfg.lua
445
         echo '    modules_enabled = { "onions" };' >> /etc/prosody/conf.avail/xmpp.cfg.lua
445
         echo '    modules_enabled = { "onions" };' >> /etc/prosody/conf.avail/xmpp.cfg.lua
446
     fi
446
     fi
447
-    if ! grep -q "xmpp onion domain" $COMPLETION_FILE; then
448
-        echo "xmpp onion domain:${XMPP_ONION_HOSTNAME}" >> $COMPLETION_FILE
449
-    else
450
-        sed -i "s|xmpp onion domain.*|xmpp onion domain:${XMPP_ONION_HOSTNAME}|g" $COMPLETION_FILE
451
-    fi
447
+    set_completion_param "xmpp onion domain" "${XMPP_ONION_HOSTNAME}"
452
 
448
 
453
     if ! grep -q "Your xmpp password is" /home/$MY_USERNAME/README; then
449
     if ! grep -q "Your xmpp password is" /home/$MY_USERNAME/README; then
454
         if [ ${#XMPP_PASSWORD} -lt 8 ]; then
450
         if [ ${#XMPP_PASSWORD} -lt 8 ]; then

+ 5
- 17
src/freedombone-app-zeronet Datei anzeigen

138
 }
138
 }
139
 
139
 
140
 function configure_firewall_for_zeronet {
140
 function configure_firewall_for_zeronet {
141
-    if grep -Fxq "configure_firewall_for_zeronet" $COMPLETION_FILE; then
141
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
142
         return
142
         return
143
     fi
143
     fi
144
     iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport $ZERONET_PORT -j ACCEPT
144
     iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport $ZERONET_PORT -j ACCEPT
151
 
151
 
152
     OPEN_PORTS+=("ZeroNet  $ZERONET_PORT")
152
     OPEN_PORTS+=("ZeroNet  $ZERONET_PORT")
153
     OPEN_PORTS+=("Tracker  $TRACKER_PORT")
153
     OPEN_PORTS+=("Tracker  $TRACKER_PORT")
154
-    echo 'configure_firewall_for_zeronet' >> $COMPLETION_FILE
154
+    mark_completed $FUNCNAME
155
 }
155
 }
156
 
156
 
157
 function install_zeronet_blog {
157
 function install_zeronet_blog {
212
     fi
212
     fi
213
     cd $MESH_INSTALL_DIR/zeronet/ZeroBlog
213
     cd $MESH_INSTALL_DIR/zeronet/ZeroBlog
214
     git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
214
     git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
215
-    if ! grep -q "ZeroNet Blog commit" $COMPLETION_FILE; then
216
-        echo "ZeroNet Blog commit:$ZERONET_BLOG_COMMIT" >> $COMPLETION_FILE
217
-    else
218
-        sed -i "s/ZeroNet Blog commit.*/ZeroNet Blog commit:$ZERONET_BLOG_COMMIT/g" $COMPLETION_FILE
219
-    fi
215
+    set_completion_param "zeroNet blog commit" "$ZERONET_BLOG_COMMIT"
220
 
216
 
221
     echo $"ZeroNet Blog address:     $ZERONET_BLOG_ADDRESS"
217
     echo $"ZeroNet Blog address:     $ZERONET_BLOG_ADDRESS"
222
     echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY"
218
     echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY"
313
     fi
309
     fi
314
     cd $MESH_INSTALL_DIR/zeronet/ZeroMail
310
     cd $MESH_INSTALL_DIR/zeronet/ZeroMail
315
     git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
311
     git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
316
-    if ! grep -q "ZeroNet Mail commit" $COMPLETION_FILE; then
317
-        echo "ZeroNet Mail commit:$ZERONET_MAIL_COMMIT" >> $COMPLETION_FILE
318
-    else
319
-        sed -i "s/ZeroNet Mail commit.*/ZeroNet Mail commit:$ZERONET_MAIL_COMMIT/g" $COMPLETION_FILE
320
-    fi
312
+    set_completion_param "zeroNet mail commit" "$ZERONET_MAIL_COMMIT"
321
 
313
 
322
     echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS"
314
     echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS"
323
     echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
315
     echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
413
         exit 6739
405
         exit 6739
414
     fi
406
     fi
415
     git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
407
     git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
416
-    if ! grep -q "ZeroNet Forum commit" $COMPLETION_FILE; then
417
-        echo "ZeroNet Forum commit:$ZERONET_FORUM_COMMIT" >> $COMPLETION_FILE
418
-    else
419
-        sed -i "s/ZeroNet Forum commit.*/ZeroNet Forum commit:$ZERONET_FORUM_COMMIT/g" $COMPLETION_FILE
420
-    fi
408
+    set_completion_param "zeroNet forum commit" "$ZERONET_FORUM_COMMIT"
421
 
409
 
422
     echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
410
     echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
423
     echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
411
     echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"

+ 1
- 1
src/freedombone-backup-remote Datei anzeigen

57
 # get the version of Go being used
57
 # get the version of Go being used
58
 GO_VERSION=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}')
58
 GO_VERSION=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}')
59
 
59
 
60
-ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
60
+ADMIN_USERNAME=$(get_completion_param "Admin user")
61
 ADMIN_NAME=$(getent passwd $ADMIN_USERNAME | cut -d: -f5 | cut -d, -f1)
61
 ADMIN_NAME=$(getent passwd $ADMIN_USERNAME | cut -d: -f5 | cut -d, -f1)
62
 ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME}
62
 ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME}
63
 if [ ! -f /etc/ssl/private/backup.key ]; then
63
 if [ ! -f /etc/ssl/private/backup.key ]; then

+ 35
- 47
src/freedombone-base-email Datei anzeigen

83
 }
83
 }
84
 
84
 
85
 function configure_firewall_for_email {
85
 function configure_firewall_for_email {
86
-    if grep -Fxq "configure_firewall_for_email" $COMPLETION_FILE; then
86
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
87
         return
87
         return
88
     fi
88
     fi
89
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
89
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
104
     OPEN_PORTS+=('Email    587')
104
     OPEN_PORTS+=('Email    587')
105
     OPEN_PORTS+=('Email    465')
105
     OPEN_PORTS+=('Email    465')
106
     OPEN_PORTS+=('Email    993')
106
     OPEN_PORTS+=('Email    993')
107
-    echo 'configure_firewall_for_email' >> $COMPLETION_FILE
107
+    mark_completed $FUNCNAME
108
 }
108
 }
109
 
109
 
110
 function encrypt_incoming_email {
110
 function encrypt_incoming_email {
119
     function_check set_repo_commit
119
     function_check set_repo_commit
120
     set_repo_commit $INSTALL_DIR/gpgit "gpgit commit" "$GPGIT_COMMIT" $GPGIT_REPO
120
     set_repo_commit $INSTALL_DIR/gpgit "gpgit commit" "$GPGIT_COMMIT" $GPGIT_REPO
121
 
121
 
122
-    if grep -Fxq "encrypt_incoming_email" $COMPLETION_FILE; then
122
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
123
         return
123
         return
124
     fi
124
     fi
125
 
125
 
134
         git_clone $GPGIT_REPO $INSTALL_DIR/gpgit
134
         git_clone $GPGIT_REPO $INSTALL_DIR/gpgit
135
         cd $INSTALL_DIR/gpgit
135
         cd $INSTALL_DIR/gpgit
136
         git checkout $GPGIT_COMMIT -b $GPGIT_COMMIT
136
         git checkout $GPGIT_COMMIT -b $GPGIT_COMMIT
137
-        if ! grep -q "gpgit commit" $COMPLETION_FILE; then
138
-            echo "gpgit commit:$GPGIT_COMMIT" >> $COMPLETION_FILE
139
-        else
140
-            sed -i "s/gpgit commit.*/gpgit commit:$GPGIT_COMMIT/g" $COMPLETION_FILE
141
-        fi
137
+        set_completion_param "gpgit commit" "$GPGIT_COMMIT"
142
         cp gpgit.pl /usr/bin
138
         cp gpgit.pl /usr/bin
143
     fi
139
     fi
144
 
140
 
153
         echo -n '| /usr/bin/gpgit.pl --encrypt-mode prefer-inline --inline-flatten $USER@' >> /etc/skel/.procmailrc
149
         echo -n '| /usr/bin/gpgit.pl --encrypt-mode prefer-inline --inline-flatten $USER@' >> /etc/skel/.procmailrc
154
         echo "$DEFAULT_DOMAIN_NAME" >> /etc/skel/.procmailrc
150
         echo "$DEFAULT_DOMAIN_NAME" >> /etc/skel/.procmailrc
155
     fi
151
     fi
156
-    echo 'encrypt_incoming_email' >> $COMPLETION_FILE
152
+    mark_completed $FUNCNAME
157
 }
153
 }
158
 
154
 
159
 function encrypt_outgoing_email {
155
 function encrypt_outgoing_email {
163
     if [ ! -d /etc/exim4 ]; then
159
     if [ ! -d /etc/exim4 ]; then
164
         return
160
         return
165
     fi
161
     fi
166
-    if grep -Fxq "encrypt_outgoing_email" $COMPLETION_FILE; then
162
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
167
         return
163
         return
168
     fi
164
     fi
169
     if [[ $GPG_ENCRYPT_STORED_EMAIL != "yes" ]]; then
165
     if [[ $GPG_ENCRYPT_STORED_EMAIL != "yes" ]]; then
203
         sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
199
         sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
204
     fi
200
     fi
205
 
201
 
206
-    echo 'encrypt_outgoing_email' >> $COMPLETION_FILE
202
+    mark_completed $FUNCNAME
207
 }
203
 }
208
 
204
 
209
 function encrypt_all_email {
205
 function encrypt_all_email {
221
     fi
217
     fi
222
     chmod +x /usr/bin/encmaildir
218
     chmod +x /usr/bin/encmaildir
223
 
219
 
224
-    if grep -Fxq "encrypt_all_email" $COMPLETION_FILE; then
220
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
225
         return
221
         return
226
     fi
222
     fi
227
 
223
 
245
         chmod 600 /home/$MY_USERNAME/README
241
         chmod 600 /home/$MY_USERNAME/README
246
     fi
242
     fi
247
 
243
 
248
-    echo 'encrypt_all_email' >> $COMPLETION_FILE
244
+    mark_completed $FUNCNAME
249
 }
245
 }
250
 
246
 
251
 function email_client {
247
 function email_client {
370
         chown ${GENERIC_IMAGE_USERNAME}:${GENERIC_IMAGE_USERNAME} /home/${GENERIC_IMAGE_USERNAME}/.mutt-alias
366
         chown ${GENERIC_IMAGE_USERNAME}:${GENERIC_IMAGE_USERNAME} /home/${GENERIC_IMAGE_USERNAME}/.mutt-alias
371
     fi
367
     fi
372
 
368
 
373
-    echo 'email_client' >> $COMPLETION_FILE
369
+    mark_completed $FUNCNAME
374
 }
370
 }
375
 
371
 
376
 function email_archiving {
372
 function email_archiving {
395
     function_check set_repo_commit
391
     function_check set_repo_commit
396
     set_repo_commit $INSTALL_DIR/cleanup-maildir "cleanup-maildir commit" "$CLEANUP_MAILDIR_COMMIT" $CLEANUP_MAILDIR_REPO
392
     set_repo_commit $INSTALL_DIR/cleanup-maildir "cleanup-maildir commit" "$CLEANUP_MAILDIR_COMMIT" $CLEANUP_MAILDIR_REPO
397
 
393
 
398
-    if grep -Fxq "email_archiving" $COMPLETION_FILE; then
394
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
399
         return
395
         return
400
     fi
396
     fi
401
 
397
 
407
     git_clone $CLEANUP_MAILDIR_REPO $INSTALL_DIR/cleanup-maildir
403
     git_clone $CLEANUP_MAILDIR_REPO $INSTALL_DIR/cleanup-maildir
408
     cd $INSTALL_DIR/cleanup-maildir
404
     cd $INSTALL_DIR/cleanup-maildir
409
     git checkout $CLEANUP_MAILDIR_COMMIT -b $CLEANUP_MAILDIR_COMMIT
405
     git checkout $CLEANUP_MAILDIR_COMMIT -b $CLEANUP_MAILDIR_COMMIT
410
-    if ! grep -q "cleanup-maildir commit" $COMPLETION_FILE; then
411
-        echo "cleanup-maildir commit:$CLEANUP_MAILDIR_COMMIT" >> $COMPLETION_FILE
412
-    else
413
-        sed -i "s/cleanup-maildir commit.*/cleanup-maildir commit:$CLEANUP_MAILDIR_COMMIT/g" $COMPLETION_FILE
414
-    fi
406
+    set_completion_param "cleanup-maildir commit" "$CLEANUP_MAILDIR_COMMIT"
415
 
407
 
416
     cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
408
     cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
417
 
409
 
418
-    echo 'email_archiving' >> $COMPLETION_FILE
410
+    mark_completed $FUNCNAME
419
 }
411
 }
420
 
412
 
421
 # Ensure that the from field is correct when sending email from Mutt
413
 # Ensure that the from field is correct when sending email from Mutt
422
 function email_from_address {
414
 function email_from_address {
423
-    if grep -Fxq "email_from_address" $COMPLETION_FILE; then
415
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
424
         return
416
         return
425
     fi
417
     fi
426
 
418
 
433
         echo "set from='$MY_NAME <$MY_EMAIL_ADDRESS>'" >> /home/$MY_USERNAME/.muttrc
425
         echo "set from='$MY_NAME <$MY_EMAIL_ADDRESS>'" >> /home/$MY_USERNAME/.muttrc
434
     fi
426
     fi
435
 
427
 
436
-    echo 'email_from_address' >> $COMPLETION_FILE
428
+    mark_completed $FUNCNAME
437
 }
429
 }
438
 
430
 
439
 function create_public_mailing_list {
431
 function create_public_mailing_list {
440
     if [ ! -d /etc/exim4 ]; then
432
     if [ ! -d /etc/exim4 ]; then
441
         return
433
         return
442
     fi
434
     fi
443
-    if grep -Fxq "create_public_mailing_list" $COMPLETION_FILE; then
435
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
444
         return
436
         return
445
     fi
437
     fi
446
     if [ ! $PUBLIC_MAILING_LIST ]; then
438
     if [ ! $PUBLIC_MAILING_LIST ]; then
530
 
522
 
531
     ${PROJECT_NAME}-addlist -u $MY_USERNAME -l "$PUBLIC_MAILING_LIST" -s "$PUBLIC_MAILING_LIST"
523
     ${PROJECT_NAME}-addlist -u $MY_USERNAME -l "$PUBLIC_MAILING_LIST" -s "$PUBLIC_MAILING_LIST"
532
 
524
 
533
-    echo 'create_public_mailing_list' >> $COMPLETION_FILE
525
+    mark_completed $FUNCNAME
534
 }
526
 }
535
 
527
 
536
 function create_private_mailing_list {
528
 function create_private_mailing_list {
539
     fi
531
     fi
540
     # This installation doesn't work, results in ruby errors
532
     # This installation doesn't work, results in ruby errors
541
     # There is currently no schleuder package for Debian jessie
533
     # There is currently no schleuder package for Debian jessie
542
-    if grep -Fxq "create_private_mailing_list" $COMPLETION_FILE; then
534
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
543
         return
535
         return
544
     fi
536
     fi
545
     if [ ! $PRIVATE_MAILING_LIST ]; then
537
     if [ ! $PRIVATE_MAILING_LIST ]; then
590
     adduser Debian-exim schleuder
582
     adduser Debian-exim schleuder
591
     usermod -a -G mail schleuder
583
     usermod -a -G mail schleuder
592
     #exim -d -bt $PRIVATE_MAILING_LIST@$DEFAULT_DOMAIN_NAME
584
     #exim -d -bt $PRIVATE_MAILING_LIST@$DEFAULT_DOMAIN_NAME
593
-    echo 'create_private_mailing_list' >> $COMPLETION_FILE
585
+    mark_completed $FUNCNAME
594
 }
586
 }
595
 
587
 
596
 function split_gpg_key_into_fragments {
588
 function split_gpg_key_into_fragments {
648
             exit 9
640
             exit 9
649
         fi
641
         fi
650
     fi
642
     fi
651
-    echo 'import_email' >> $COMPLETION_FILE
643
+    mark_completed $FUNCNAME
652
     if [[ $SYSTEM_TYPE == "mail"* ]]; then
644
     if [[ $SYSTEM_TYPE == "mail"* ]]; then
653
         function_check backup_to_friends_servers
645
         function_check backup_to_friends_servers
654
         backup_to_friends_servers
646
         backup_to_friends_servers
721
         set_hostname ${EMAIL_ONION_HOSTNAME}
713
         set_hostname ${EMAIL_ONION_HOSTNAME}
722
         MY_EMAIL_ADDRESS=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}
714
         MY_EMAIL_ADDRESS=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}
723
     fi
715
     fi
724
-    if ! grep -q "email onion domain" $COMPLETION_FILE; then
725
-        echo "email onion domain:${EMAIL_ONION_HOSTNAME}" >> $COMPLETION_FILE
726
-    else
727
-        sed -i "s|email onion domain.*|email onion domain:${EMAIL_ONION_HOSTNAME}|g" $COMPLETION_FILE
728
-    fi
716
+    set_completion_param "email onion domain" "${EMAIL_ONION_HOSTNAME}"
729
 
717
 
730
     # see https://github.com/petterreinholdtsen/exim4-smtorp
718
     # see https://github.com/petterreinholdtsen/exim4-smtorp
731
     echo '# tor stuff first' > /etc/exim4/conf.d/router/100_exim4-smtorp
719
     echo '# tor stuff first' > /etc/exim4/conf.d/router/100_exim4-smtorp
904
 
892
 
905
     function_check configure_firewall_for_email
893
     function_check configure_firewall_for_email
906
     configure_firewall_for_email
894
     configure_firewall_for_email
907
-    echo 'install_email' >> $COMPLETION_FILE
895
+    mark_completed $FUNCNAME
908
 }
896
 }
909
 
897
 
910
 function create_procmail {
898
 function create_procmail {
911
     if [ ! -d /etc/exim4 ]; then
899
     if [ ! -d /etc/exim4 ]; then
912
         return
900
         return
913
     fi
901
     fi
914
-    if grep -Fxq "create_procmail" $COMPLETION_FILE; then
902
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
915
         return
903
         return
916
     fi
904
     fi
917
     if [ ! -f /home/$MY_USERNAME/.procmailrc ]; then
905
     if [ ! -f /home/$MY_USERNAME/.procmailrc ]; then
938
         chown root:root /etc/skel/.procmailrc
926
         chown root:root /etc/skel/.procmailrc
939
     fi
927
     fi
940
 
928
 
941
-    echo 'create_procmail' >> $COMPLETION_FILE
929
+    mark_completed $FUNCNAME
942
 }
930
 }
943
 
931
 
944
 function handle_admin_emails {
932
 function handle_admin_emails {
954
     if [ ! -d /etc/exim4 ]; then
942
     if [ ! -d /etc/exim4 ]; then
955
         return
943
         return
956
     fi
944
     fi
957
-    if grep -Fxq "spam_filtering" $COMPLETION_FILE; then
945
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
958
         return
946
         return
959
     fi
947
     fi
960
     apt-get -y install exim4-daemon-heavy
948
     apt-get -y install exim4-daemon-heavy
1108
     systemctl restart exim4
1096
     systemctl restart exim4
1109
     systemctl restart cron
1097
     systemctl restart cron
1110
 
1098
 
1111
-    echo 'spam_filtering' >> $COMPLETION_FILE
1099
+    mark_completed $FUNCNAME
1112
 }
1100
 }
1113
 
1101
 
1114
 function configure_imap {
1102
 function configure_imap {
1115
     if [ ! -d /etc/exim4 ]; then
1103
     if [ ! -d /etc/exim4 ]; then
1116
         return
1104
         return
1117
     fi
1105
     fi
1118
-    if grep -Fxq "configure_imap" $COMPLETION_FILE; then
1106
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
1119
         return
1107
         return
1120
     fi
1108
     fi
1121
 
1109
 
1194
     fi
1182
     fi
1195
 
1183
 
1196
     systemctl restart dovecot
1184
     systemctl restart dovecot
1197
-    echo 'configure_imap' >> $COMPLETION_FILE
1185
+    mark_completed $FUNCNAME
1198
 }
1186
 }
1199
 
1187
 
1200
 function configure_imap_client_certs {
1188
 function configure_imap_client_certs {
1201
     if [ ! -d /etc/exim4 ]; then
1189
     if [ ! -d /etc/exim4 ]; then
1202
         return
1190
         return
1203
     fi
1191
     fi
1204
-    if grep -Fxq "configure_imap_client_certs" $COMPLETION_FILE; then
1192
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
1205
         return
1193
         return
1206
     fi
1194
     fi
1207
     # http://strange.systems/certificate-based-auth-with-dovecot-sendmail/
1195
     # http://strange.systems/certificate-based-auth-with-dovecot-sendmail/
1276
     echo 0001 > /etc/ssl/sslserial
1264
     echo 0001 > /etc/ssl/sslserial
1277
     #${PROJECT_NAME}-clientcert -u $MY_USERNAME
1265
     #${PROJECT_NAME}-clientcert -u $MY_USERNAME
1278
     systemctl restart dovecot
1266
     systemctl restart dovecot
1279
-    echo 'configure_imap_client_certs' >> $COMPLETION_FILE
1267
+    mark_completed $FUNCNAME
1280
 }
1268
 }
1281
 
1269
 
1282
 function create_gpg_subkey {
1270
 function create_gpg_subkey {
1283
     if [ ! -d /etc/exim4 ]; then
1271
     if [ ! -d /etc/exim4 ]; then
1284
         return
1272
         return
1285
     fi
1273
     fi
1286
-    if grep -Fxq "create_gpg_subkey" $COMPLETION_FILE; then
1274
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
1287
         return
1275
         return
1288
     fi
1276
     fi
1289
     apt-get -y install gnupg
1277
     apt-get -y install gnupg
1313
     shred -zu /home/$MY_USERNAME/gpg-genkey.conf
1301
     shred -zu /home/$MY_USERNAME/gpg-genkey.conf
1314
     MY_GPG_SUBKEY_ID=$(su -c "gpg --list-keys $MY_EMAIL_ADDRESS | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
1302
     MY_GPG_SUBKEY_ID=$(su -c "gpg --list-keys $MY_EMAIL_ADDRESS | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
1315
 
1303
 
1316
-    echo 'create_gpg_subkey' >> $COMPLETION_FILE
1304
+    mark_completed $FUNCNAME
1317
 }
1305
 }
1318
 
1306
 
1319
 function gpg_key_exists {
1307
 function gpg_key_exists {
1351
     if [ ! -d /etc/exim4 ]; then
1339
     if [ ! -d /etc/exim4 ]; then
1352
         return
1340
         return
1353
     fi
1341
     fi
1354
-    if grep -Fxq "configure_gpg" $COMPLETION_FILE; then
1342
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
1355
         return
1343
         return
1356
     fi
1344
     fi
1357
     apt-get -y install gnupg
1345
     apt-get -y install gnupg
1369
         chown -R $MY_USERNAME:$MY_USERNAME $gpg_dir
1357
         chown -R $MY_USERNAME:$MY_USERNAME $gpg_dir
1370
         chmod 700 $gpg_dir
1358
         chmod 700 $gpg_dir
1371
         chmod 600 $gpg_dir/*
1359
         chmod 600 $gpg_dir/*
1372
-        echo 'configure_gpg' >> $COMPLETION_FILE
1360
+        mark_completed $FUNCNAME
1373
         return
1361
         return
1374
     fi
1362
     fi
1375
 
1363
 
1477
         fi
1465
         fi
1478
     fi
1466
     fi
1479
 
1467
 
1480
-    echo 'configure_gpg' >> $COMPLETION_FILE
1468
+    mark_completed $FUNCNAME
1481
 }
1469
 }
1482
 
1470
 
1483
 function refresh_gpg_keys {
1471
 function refresh_gpg_keys {

+ 2
- 2
src/freedombone-base-tripwire Datei anzeigen

49
 }
49
 }
50
 
50
 
51
 function install_tripwire {
51
 function install_tripwire {
52
-    if grep -Fxq "install_tripwire" $COMPLETION_FILE; then
52
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
53
         return
53
         return
54
     fi
54
     fi
55
     apt-get -y install tripwire
55
     apt-get -y install tripwire
99
 
99
 
100
        ' | reset-tripwire
100
        ' | reset-tripwire
101
 
101
 
102
-    echo 'install_tripwire' >> $COMPLETION_FILE
102
+    mark_completed $FUNCNAME
103
 }
103
 }
104
 
104
 
105
 # NOTE: deliberately no exit 0
105
 # NOTE: deliberately no exit 0

+ 1
- 1
src/freedombone-controlpanel Datei anzeigen

1746
     exit 1
1746
     exit 1
1747
 fi
1747
 fi
1748
 
1748
 
1749
-ADMIN_USER=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
1749
+ADMIN_USER=$(get_completion_param "Admin user")
1750
 read_repo_servers
1750
 read_repo_servers
1751
 menu_top_level
1751
 menu_top_level
1752
 clear
1752
 clear

+ 7
- 1
src/freedombone-encrypt-mail Datei anzeigen

33
 PROJECT_NAME='freedombone'
33
 PROJECT_NAME='freedombone'
34
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
34
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
35
 
35
 
36
-ADMIN_USER=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
36
+UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
37
+for f in $UTILS_FILES
38
+do
39
+  source $f
40
+done
41
+
42
+ADMIN_USER=$(get_completion_param "Admin user")
37
 
43
 
38
 if [ ! $USERNAME ]; then
44
 if [ ! $USERNAME ]; then
39
     USERNAME=$ADMIN_USER
45
     USERNAME=$ADMIN_USER

+ 2
- 2
src/freedombone-restore-local Datei anzeigen

62
 read_config_param USB_DRIVE
62
 read_config_param USB_DRIVE
63
 
63
 
64
 if [ -f $COMPLETION_FILE ]; then
64
 if [ -f $COMPLETION_FILE ]; then
65
-    ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
65
+    ADMIN_USERNAME=$(get_completion_param "Admin user")
66
 fi
66
 fi
67
 
67
 
68
 # MariaDB password
68
 # MariaDB password
152
 }
152
 }
153
 
153
 
154
 function same_admin_user {
154
 function same_admin_user {
155
-    PREV_ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
155
+    PREV_ADMIN_USERNAME=$(get_completion_param "Admin user")
156
     if [[ "$PREV_ADMIN_USERNAME" != "$ADMIN_USERNAME" ]]; then
156
     if [[ "$PREV_ADMIN_USERNAME" != "$ADMIN_USERNAME" ]]; then
157
         echo $"The admin username has changed from $PREV_ADMIN_USERNAME to $ADMIN_USERNAME. To restore you will first need to install a new ${PROJECT_NAME} system with an initial admin user named $PREV_ADMIN_USERNAME"
157
         echo $"The admin username has changed from $PREV_ADMIN_USERNAME to $ADMIN_USERNAME. To restore you will first need to install a new ${PROJECT_NAME} system with an initial admin user named $PREV_ADMIN_USERNAME"
158
         set_user_permissions
158
         set_user_permissions

+ 6
- 2
src/freedombone-restore-remote Datei anzeigen

36
 export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
36
 export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
37
 export TEXTDOMAINDIR="/usr/share/locale"
37
 export TEXTDOMAINDIR="/usr/share/locale"
38
 
38
 
39
-source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-validation
39
+UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
40
+for f in $UTILS_FILES
41
+do
42
+  source $f
43
+done
40
 
44
 
41
 SERVER_NAME=$1
45
 SERVER_NAME=$1
42
 
46
 
47
     RESTORE_APP=${2}
51
     RESTORE_APP=${2}
48
 fi
52
 fi
49
 
53
 
50
-ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | -nawk -F ':' '{print $2}')
54
+ADMIN_USERNAME=$(get_completion_param "Admin user")
51
 ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME}
55
 ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME}
52
 
56
 
53
 # Temporary location for data to be backed up to other servers
57
 # Temporary location for data to be backed up to other servers

+ 1
- 1
src/freedombone-rmuser Datei anzeigen

74
     exit 5
74
     exit 5
75
 fi
75
 fi
76
 
76
 
77
-ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
77
+ADMIN_USERNAME=$(get_completion_param "Admin user")
78
 if [ ! $ADMIN_USERNAME ]; then
78
 if [ ! $ADMIN_USERNAME ]; then
79
     echo $"No admin username specified in $COMPLETION_FILE"
79
     echo $"No admin username specified in $COMPLETION_FILE"
80
     exit 6
80
     exit 6

+ 7
- 7
src/freedombone-syncthing Datei anzeigen

36
 export TEXTDOMAIN=$PROJECT_NAME-syncthing
36
 export TEXTDOMAIN=$PROJECT_NAME-syncthing
37
 export TEXTDOMAINDIR="/usr/share/locale"
37
 export TEXTDOMAINDIR="/usr/share/locale"
38
 
38
 
39
-source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-validation
39
+UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
40
+for f in $UTILS_FILES
41
+do
42
+  source $f
43
+done
40
 
44
 
41
 # File which keeps track of what has already been installed
45
 # File which keeps track of what has already been installed
42
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
46
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
73
 
77
 
74
 function create_syncthing_config {
78
 function create_syncthing_config {
75
     if grep -q "syncthing ID" $COMPLETION_FILE; then
79
     if grep -q "syncthing ID" $COMPLETION_FILE; then
76
-        SYNCTHING_ID=$(cat $COMPLETION_FILE | grep "syncthing ID" | awk -F ':' '{print $2}')
80
+        SYNCTHING_ID=$(get_completion_param "syncthing ID")
77
     else
81
     else
78
         if [ -f $SYNCTHING_CONFIG_FILE ]; then
82
         if [ -f $SYNCTHING_CONFIG_FILE ]; then
79
             SYNCTHING_ID=$(cat $SYNCTHING_CONFIG_FILE | grep "device id=" | head -n 1 | awk -F '"' '{print $2}')
83
             SYNCTHING_ID=$(cat $SYNCTHING_CONFIG_FILE | grep "device id=" | head -n 1 | awk -F '"' '{print $2}')
82
         fi
86
         fi
83
     fi
87
     fi
84
 
88
 
85
-    if ! grep -q "syncthing ID" $COMPLETION_FILE; then
86
-        echo "syncthing ID:$SYNCTHING_ID" >> $COMPLETION_FILE
87
-    else
88
-        sed -i "s|syncthing ID.*|syncthing ID:$SYNCTHING_ID|g" $COMPLETION_FILE
89
-    fi
89
+    set_completion_param "syncthing ID" "$SYNCTHING_ID"
90
 
90
 
91
     if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
91
     if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
92
         mkdir -p $SYNCTHING_CONFIG_PATH
92
         mkdir -p $SYNCTHING_CONFIG_PATH

+ 2
- 2
src/freedombone-utils-avahi Datei anzeigen

99
         mesh_avahi
99
         mesh_avahi
100
         return
100
         return
101
     fi
101
     fi
102
-    if grep -Fxq "install_avahi" $COMPLETION_FILE; then
102
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
103
         return
103
         return
104
     fi
104
     fi
105
     # only enable avahi if we're doing mesh networking
105
     # only enable avahi if we're doing mesh networking
123
         sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
123
         sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
124
     fi
124
     fi
125
 
125
 
126
-    echo 'install_avahi' >> $COMPLETION_FILE
126
+    mark_completed $FUNCNAME
127
 }
127
 }
128
 
128
 
129
 # NOTE: deliberately there is no "exit 0"
129
 # NOTE: deliberately there is no "exit 0"

+ 3
- 3
src/freedombone-utils-backup Datei anzeigen

49
 }
49
 }
50
 
50
 
51
 function configure_backup_key {
51
 function configure_backup_key {
52
-    if grep -Fxq "configure_backup_key" $COMPLETION_FILE; then
52
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
53
         return
53
         return
54
     fi
54
     fi
55
     apt-get -y install gnupg
55
     apt-get -y install gnupg
102
     shred -zu ${MY_BACKUP_KEY}_public.asc
102
     shred -zu ${MY_BACKUP_KEY}_public.asc
103
     shred -zu ${MY_BACKUP_KEY}_private.asc
103
     shred -zu ${MY_BACKUP_KEY}_private.asc
104
 
104
 
105
-    echo 'configure_backup_key' >> $COMPLETION_FILE
105
+    mark_completed $FUNCNAME
106
 }
106
 }
107
 
107
 
108
 function backup_to_friends_servers {
108
 function backup_to_friends_servers {
122
     fi
122
     fi
123
 
123
 
124
     # get the admin user
124
     # get the admin user
125
-    ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
125
+    ADMIN_USERNAME=$(get_completion_param "Admin user")
126
     if [ $2 ]; then
126
     if [ $2 ]; then
127
         ADMIN_USERNAME=$2
127
         ADMIN_USERNAME=$2
128
     fi
128
     fi

+ 2
- 2
src/freedombone-utils-cmake Datei anzeigen

75
         fi
75
         fi
76
     fi
76
     fi
77
 
77
 
78
-    if grep -Fxq "install_cmake" $COMPLETION_FILE; then
78
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
79
         return
79
         return
80
     fi
80
     fi
81
 
81
 
95
     fi
95
     fi
96
     make install
96
     make install
97
 
97
 
98
-    echo 'install_cmake' >> $COMPLETION_FILE
98
+    mark_completed $FUNCNAME
99
 }
99
 }
100
 
100
 
101
 # NOTE: deliberately there is no "exit 0"
101
 # NOTE: deliberately there is no "exit 0"

+ 85
- 0
src/freedombone-utils-config Datei anzeigen

99
                          ENABLE_BATMAN
99
                          ENABLE_BATMAN
100
                          PUBLIC_MAILING_LIST)
100
                          PUBLIC_MAILING_LIST)
101
 
101
 
102
+function get_completion_param {
103
+    param_name="$1"
104
+
105
+    if [ ${#param_name} -gt 0 ]; then
106
+        if [ $COMPLETION_FILE ]; then
107
+            if [ -f $COMPLETION_FILE ]; then
108
+                if grep -q "${param_name}:" $COMPLETION_FILE; then
109
+                    param_value=$(cat $COMPLETION_FILE | grep "${param_name}:" | head -n 1 | awk -F ':' '{print $2}')
110
+                    echo "$param_value"
111
+                    return
112
+                fi
113
+            fi
114
+        fi
115
+    fi
116
+    echo ""
117
+}
118
+
119
+function set_completion_param {
120
+    param_name="$1"
121
+    param_value="$2"
122
+
123
+    if [ ! $COMPLETION_FILE ]; then
124
+        COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
125
+    fi
126
+    if [ ${#COMPLETION_FILE} -eq 0 ]; then
127
+        COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
128
+    fi
129
+
130
+    if [ ${#param_name} -gt 0 ]; then
131
+        if [ ${#param_value} -gt 0 ]; then
132
+            if [ -f $COMPLETION_FILE ]; then
133
+                if grep -q "${param_name}:" $COMPLETION_FILE; then
134
+                    sed -i "s|${param_name}:.*|${param_name}:${param_value}|g" $COMPLETION_FILE
135
+                else
136
+                    echo "${param_name}:${param_value}" >> $COMPLETION_FILE
137
+                fi
138
+            else
139
+                echo "${param_name}:${param_value}" > $COMPLETION_FILE
140
+            fi
141
+        fi
142
+    fi
143
+}
144
+
145
+function mark_completed {
146
+    param_name="$1"
147
+
148
+    if [ ! $COMPLETION_FILE ]; then
149
+        COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
150
+    fi
151
+    if [ ${#COMPLETION_FILE} -eq 0 ]; then
152
+        COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
153
+    fi
154
+
155
+    if [ ${#param_name} -gt 0 ]; then
156
+        if [ -f $COMPLETION_FILE ]; then
157
+            if ! grep -Fxq "${param_name}" $COMPLETION_FILE; then
158
+                echo "${param_name}" >> $COMPLETION_FILE
159
+            fi
160
+        else
161
+            echo "${param_name}" > $COMPLETION_FILE
162
+        fi
163
+    fi
164
+}
165
+
166
+function is_completed {
167
+    param_name="$1"
168
+
169
+    if [ ! $COMPLETION_FILE ]; then
170
+        COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
171
+    fi
172
+    if [ ${#COMPLETION_FILE} -eq 0 ]; then
173
+        COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
174
+    fi
175
+
176
+    if [ ${#param_name} -gt 0 ]; then
177
+        if [ -f $COMPLETION_FILE ]; then
178
+            if grep -Fxq "${param_name}" $COMPLETION_FILE; then
179
+                echo "1"
180
+                return
181
+            fi
182
+        fi
183
+    fi
184
+    echo "0"
185
+}
186
+
102
 function read_config_param {
187
 function read_config_param {
103
     param_name="$1"
188
     param_name="$1"
104
 
189
 

+ 32
- 32
src/freedombone-utils-cron Datei anzeigen

29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
 
30
 
31
 function cron_add_mins {
31
 function cron_add_mins {
32
-	if ! grep -q "${2}" /etc/crontab; then
33
-		echo "*/${1}            * *   *   *   root ${2}" >> /etc/crontab
34
-		systemctl restart cron
35
-	fi
32
+    if ! grep -q "${2}" /etc/crontab; then
33
+        echo "*/${1}            * *   *   *   root ${2}" >> /etc/crontab
34
+        systemctl restart cron
35
+    fi
36
 }
36
 }
37
 
37
 
38
 function randomize_cron {
38
 function randomize_cron {
39
-	# The predictable default timing of Debian cron jobs might
40
-	# be exploitable knowledge. Avoid too much predictability
41
-	# by randomizing the times when cron jobs run
42
-	if grep -Fxq "randomize_cron" $COMPLETION_FILE; then
43
-		return
44
-	fi
39
+    # The predictable default timing of Debian cron jobs might
40
+    # be exploitable knowledge. Avoid too much predictability
41
+    # by randomizing the times when cron jobs run
42
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
43
+        return
44
+    fi
45
 
45
 
46
-	# randomize the day on which the weekly cron job runs
47
-	randdow=$(($RANDOM%6+1))
48
-	sed -i "s|\* \* 7|* * $randdow|g" /etc/crontab
46
+    # randomize the day on which the weekly cron job runs
47
+    randdow=$(($RANDOM%6+1))
48
+    sed -i "s|\* \* 7|* * $randdow|g" /etc/crontab
49
 
49
 
50
-	# randomize the time when the weekly cron job runs
51
-	randmin=$(($RANDOM%60))
52
-	randhr=$(($RANDOM%3+1))
53
-	sed -i "s|47 6|$randmin $randhr|g" /etc/crontab
50
+    # randomize the time when the weekly cron job runs
51
+    randmin=$(($RANDOM%60))
52
+    randhr=$(($RANDOM%3+1))
53
+    sed -i "s|47 6|$randmin $randhr|g" /etc/crontab
54
 
54
 
55
-	# randomize the time when the daily cron job runs
56
-	randmin=$(($RANDOM%60))
57
-	randhr=$(($RANDOM%3+4))
58
-	sed -i "s|25 6\t\* \* \*|$randmin $randhr\t* * *|g" /etc/crontab
55
+    # randomize the time when the daily cron job runs
56
+    randmin=$(($RANDOM%60))
57
+    randhr=$(($RANDOM%3+4))
58
+    sed -i "s|25 6\t\* \* \*|$randmin $randhr\t* * *|g" /etc/crontab
59
 
59
 
60
-	# randomize the time when the hourly cron job runs
61
-	randmin=$(($RANDOM%60))
62
-	sed -i "s|17 \*\t|$randmin *\t|g" /etc/crontab
60
+    # randomize the time when the hourly cron job runs
61
+    randmin=$(($RANDOM%60))
62
+    sed -i "s|17 \*\t|$randmin *\t|g" /etc/crontab
63
 
63
 
64
-	# randomize monthly cron job time and day
65
-	randmin=$(($RANDOM%60))
66
-	randhr=$(($RANDOM%22+1))
67
-	randdom=$(($RANDOM%27+1))
68
-	sed -i "s|52 6\t|$randmin $randhr\t|g" /etc/crontab
69
-	sed -i "s|\t1 \* \*|\t$randdom * *|g" /etc/crontab
64
+    # randomize monthly cron job time and day
65
+    randmin=$(($RANDOM%60))
66
+    randhr=$(($RANDOM%22+1))
67
+    randdom=$(($RANDOM%27+1))
68
+    sed -i "s|52 6\t|$randmin $randhr\t|g" /etc/crontab
69
+    sed -i "s|\t1 \* \*|\t$randdom * *|g" /etc/crontab
70
 
70
 
71
-	systemctl restart cron
71
+    systemctl restart cron
72
 
72
 
73
-	echo 'randomize_cron' >> $COMPLETION_FILE
73
+    mark_completed $FUNCNAME
74
 }
74
 }
75
 
75
 
76
 # NOTE: deliberately there is no "exit 0"
76
 # NOTE: deliberately there is no "exit 0"

+ 2
- 2
src/freedombone-utils-cryptopp Datei anzeigen

76
         fi
76
         fi
77
     fi
77
     fi
78
 
78
 
79
-    if grep -Fxq "install_cryptopp" $COMPLETION_FILE; then
79
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
80
         return
80
         return
81
     fi
81
     fi
82
 
82
 
98
     fi
98
     fi
99
     make install
99
     make install
100
 
100
 
101
-    echo 'install_cryptopp' >> $COMPLETION_FILE
101
+    mark_completed $FUNCNAME
102
 }
102
 }
103
 
103
 
104
 # NOTE: deliberately there is no "exit 0"
104
 # NOTE: deliberately there is no "exit 0"

+ 4
- 4
src/freedombone-utils-database Datei anzeigen

117
 }
117
 }
118
 
118
 
119
 function install_mariadb {
119
 function install_mariadb {
120
-    if grep -Fxq "install_mariadb" $COMPLETION_FILE; then
120
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
121
         return
121
         return
122
     fi
122
     fi
123
     apt-get -y install python-software-properties debconf-utils
123
     apt-get -y install python-software-properties debconf-utils
160
     fi
160
     fi
161
 
161
 
162
     mysqladmin -u root password "$MARIADB_PASSWORD"
162
     mysqladmin -u root password "$MARIADB_PASSWORD"
163
-    echo 'install_mariadb' >> $COMPLETION_FILE
163
+    mark_completed $FUNCNAME
164
 }
164
 }
165
 
165
 
166
 function backup_databases_script_header {
166
 function backup_databases_script_header {
209
         sed -i "s|/usr/bin/repairdatabase|${PROJECT_NAME}-repair-database|g" /etc/cron.hourly/repair
209
         sed -i "s|/usr/bin/repairdatabase|${PROJECT_NAME}-repair-database|g" /etc/cron.hourly/repair
210
     fi
210
     fi
211
 
211
 
212
-    if grep -Fxq "repair_databases_script" $COMPLETION_FILE; then
212
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
213
         return
213
         return
214
     fi
214
     fi
215
 
215
 
222
     chmod 600 /etc/cron.hourly/repair
222
     chmod 600 /etc/cron.hourly/repair
223
     chmod +x /etc/cron.hourly/repair
223
     chmod +x /etc/cron.hourly/repair
224
 
224
 
225
-    echo 'repair_databases_script' >> $COMPLETION_FILE
225
+    mark_completed $FUNCNAME
226
 }
226
 }
227
 
227
 
228
 function remove_database {
228
 function remove_database {

+ 6
- 6
src/freedombone-utils-dns Datei anzeigen

98
     fi
98
     fi
99
 
99
 
100
     # currently inadyn doesn't work as expected with freeDNS, so this is a workaround
100
     # currently inadyn doesn't work as expected with freeDNS, so this is a workaround
101
-    if grep -Fxq "create_freedns_updater" $COMPLETION_FILE; then
101
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
102
         return
102
         return
103
     fi
103
     fi
104
     if [[ $DDNS_PROVIDER != *"freedns"* ]]; then
104
     if [[ $DDNS_PROVIDER != *"freedns"* ]]; then
114
         systemctl restart cron
114
         systemctl restart cron
115
     fi
115
     fi
116
 
116
 
117
-    echo 'create_freedns_updater' >> $COMPLETION_FILE
117
+    mark_completed $FUNCNAME
118
 }
118
 }
119
 
119
 
120
 function add_ddns_domain {
120
 function add_ddns_domain {
152
 }
152
 }
153
 
153
 
154
 function configure_dns {
154
 function configure_dns {
155
-    if grep -Fxq "configure_dns" $COMPLETION_FILE; then
155
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
156
         return
156
         return
157
     fi
157
     fi
158
     echo 'domain localdomain' > /etc/resolv.conf
158
     echo 'domain localdomain' > /etc/resolv.conf
163
     # prevent resolv.conf from changing
163
     # prevent resolv.conf from changing
164
     chattr +i /etc/resolv.conf
164
     chattr +i /etc/resolv.conf
165
 
165
 
166
-    echo 'configure_dns' >> $COMPLETION_FILE
166
+    mark_completed $FUNCNAME
167
 }
167
 }
168
 
168
 
169
 function set_hostname {
169
 function set_hostname {
180
 }
180
 }
181
 
181
 
182
 function set_your_domain_name {
182
 function set_your_domain_name {
183
-    if grep -Fxq "set_your_domain_name" $COMPLETION_FILE; then
183
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
184
         return
184
         return
185
     fi
185
     fi
186
 
186
 
187
     function_check set_hostname
187
     function_check set_hostname
188
     set_hostname $DEFAULT_DOMAIN_NAME
188
     set_hostname $DEFAULT_DOMAIN_NAME
189
 
189
 
190
-    echo 'set_your_domain_name' >> $COMPLETION_FILE
190
+    mark_completed $FUNCNAME
191
 }
191
 }
192
 
192
 
193
 # NOTE: deliberately no exit 0
193
 # NOTE: deliberately no exit 0

+ 3
- 7
src/freedombone-utils-filesystem Datei anzeigen

62
     set_repo_commit $INSTALL_DIR/tomb "tomb commit" "$TOMB_COMMIT" $TOMB_REPO
62
     set_repo_commit $INSTALL_DIR/tomb "tomb commit" "$TOMB_COMMIT" $TOMB_REPO
63
 
63
 
64
     if [ -f $COMPLETION_FILE ]; then
64
     if [ -f $COMPLETION_FILE ]; then
65
-        if grep -Fxq "install_tomb" $COMPLETION_FILE; then
65
+        if [[ $(is_completed $FUNCNAME) == "1" ]]; then
66
             return
66
             return
67
         fi
67
         fi
68
     fi
68
     fi
77
     cd $INSTALL_DIR/tomb
77
     cd $INSTALL_DIR/tomb
78
 
78
 
79
     git checkout $TOMB_COMMIT -b $TOMB_COMMIT
79
     git checkout $TOMB_COMMIT -b $TOMB_COMMIT
80
-    if ! grep -q "tomb commit" $COMPLETION_FILE; then
81
-        echo "tomb commit:$TOMB_COMMIT" >> $COMPLETION_FILE
82
-    else
83
-        sed -i "s/tomb commit.*/tomb commit:$TOMB_COMMIT/g" $COMPLETION_FILE
84
-    fi
80
+    set_completion_param "tomb commit" "$TOMB_COMMIT"
85
 
81
 
86
     make install
82
     make install
87
     if [ ! -f /usr/local/bin/tomb ]; then
83
     if [ ! -f /usr/local/bin/tomb ]; then
88
         exit 93462
84
         exit 93462
89
     fi
85
     fi
90
 
86
 
91
-    echo 'install_tomb' >> $COMPLETION_FILE
87
+    mark_completed $FUNCNAME
92
 }
88
 }
93
 
89
 
94
 # NOTE: deliberately no exit 0
90
 # NOTE: deliberately no exit 0

+ 2
- 2
src/freedombone-utils-final Datei anzeigen

31
 OPEN_PORTS=()
31
 OPEN_PORTS=()
32
 
32
 
33
 function install_final {
33
 function install_final {
34
-    if grep -Fxq "install_final" $COMPLETION_FILE; then
34
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
35
         return
35
         return
36
     fi
36
     fi
37
     # unmount any attached usb drive
37
     # unmount any attached usb drive
41
     fi
41
     fi
42
     function_check split_gpg_key_into_fragments
42
     function_check split_gpg_key_into_fragments
43
     split_gpg_key_into_fragments
43
     split_gpg_key_into_fragments
44
-    echo 'install_final' >> $COMPLETION_FILE
44
+    mark_completed $FUNCNAME
45
     clear
45
     clear
46
     echo ''
46
     echo ''
47
 
47
 

+ 17
- 17
src/freedombone-utils-firewall Datei anzeigen

64
         # recreate the firewall to remove RELATED
64
         # recreate the firewall to remove RELATED
65
         sed -i "/firewall/d" $COMPLETION_FILE
65
         sed -i "/firewall/d" $COMPLETION_FILE
66
     fi
66
     fi
67
-    if grep -Fxq "configure_firewall" $COMPLETION_FILE; then
67
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
68
         return
68
         return
69
     fi
69
     fi
70
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
70
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
98
     # Incoming malformed NULL packets:
98
     # Incoming malformed NULL packets:
99
     iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
99
     iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
100
 
100
 
101
-    echo 'configure_firewall' >> $COMPLETION_FILE
101
+    mark_completed $FUNCNAME
102
 }
102
 }
103
 
103
 
104
 function configure_firewall_ping {
104
 function configure_firewall_ping {
113
     iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
113
     iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
114
     function_check save_firewall_settings
114
     function_check save_firewall_settings
115
     save_firewall_settings
115
     save_firewall_settings
116
-    echo 'configure_firewall_ping' >> $COMPLETION_FILE
116
+    mark_completed $FUNCNAME
117
 }
117
 }
118
 
118
 
119
 function configure_firewall_for_avahi {
119
 function configure_firewall_for_avahi {
120
-    if grep -Fxq "configure_firewall_for_avahi" $COMPLETION_FILE; then
120
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
121
         return
121
         return
122
     fi
122
     fi
123
     iptables -A INPUT -p tcp --dport 548 -j ACCEPT
123
     iptables -A INPUT -p tcp --dport 548 -j ACCEPT
128
     iptables -A INPUT -p udp --dport 5354 -j ACCEPT
128
     iptables -A INPUT -p udp --dport 5354 -j ACCEPT
129
     function_check save_firewall_settings
129
     function_check save_firewall_settings
130
     save_firewall_settings
130
     save_firewall_settings
131
-    echo 'configure_firewall_for_avahi' >> $COMPLETION_FILE
131
+    mark_completed $FUNCNAME
132
 }
132
 }
133
 
133
 
134
 function configure_firewall_for_dns {
134
 function configure_firewall_for_dns {
135
-    if grep -Fxq "configure_firewall_for_dns" $COMPLETION_FILE; then
135
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
136
         return
136
         return
137
     fi
137
     fi
138
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
138
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
142
     iptables -A INPUT -p udp -m udp --dport 1024:65535 --sport 53 -j ACCEPT
142
     iptables -A INPUT -p udp -m udp --dport 1024:65535 --sport 53 -j ACCEPT
143
     function_check save_firewall_settings
143
     function_check save_firewall_settings
144
     save_firewall_settings
144
     save_firewall_settings
145
-    echo 'configure_firewall_for_dns' >> $COMPLETION_FILE
145
+    mark_completed $FUNCNAME
146
 }
146
 }
147
 
147
 
148
 function configure_firewall_for_web_access {
148
 function configure_firewall_for_web_access {
149
-    if grep -Fxq "configure_firewall_for_web_access" $COMPLETION_FILE; then
149
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
150
         return
150
         return
151
     fi
151
     fi
152
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
152
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
161
     function_check save_firewall_settings
161
     function_check save_firewall_settings
162
     save_firewall_settings
162
     save_firewall_settings
163
 
163
 
164
-    echo 'configure_firewall_for_web_access' >> $COMPLETION_FILE
164
+    mark_completed $FUNCNAME
165
 }
165
 }
166
 
166
 
167
 function configure_firewall_for_web_server {
167
 function configure_firewall_for_web_server {
168
-    if grep -Fxq "configure_firewall_for_web_server" $COMPLETION_FILE; then
168
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
169
         return
169
         return
170
     fi
170
     fi
171
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
171
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
182
 
182
 
183
     OPEN_PORTS+=('HTTP     80')
183
     OPEN_PORTS+=('HTTP     80')
184
     OPEN_PORTS+=('HTTPS    443')
184
     OPEN_PORTS+=('HTTPS    443')
185
-    echo 'configure_firewall_for_web_server' >> $COMPLETION_FILE
185
+    mark_completed $FUNCNAME
186
 }
186
 }
187
 
187
 
188
 function configure_firewall_for_ssh {
188
 function configure_firewall_for_ssh {
189
-    if grep -Fxq "configure_firewall_for_ssh" $COMPLETION_FILE; then
189
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
190
         return
190
         return
191
     fi
191
     fi
192
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
192
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
199
     save_firewall_settings
199
     save_firewall_settings
200
 
200
 
201
     OPEN_PORTS+=("SSH      $SSH_PORT")
201
     OPEN_PORTS+=("SSH      $SSH_PORT")
202
-    echo 'configure_firewall_for_ssh' >> $COMPLETION_FILE
202
+    mark_completed $FUNCNAME
203
 }
203
 }
204
 
204
 
205
 function configure_firewall_for_git {
205
 function configure_firewall_for_git {
206
-    if grep -Fxq "configure_firewall_for_git" $COMPLETION_FILE; then
206
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
207
         return
207
         return
208
     fi
208
     fi
209
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
209
     if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
218
     save_firewall_settings
218
     save_firewall_settings
219
 
219
 
220
     OPEN_PORTS+=("Git      9418")
220
     OPEN_PORTS+=("Git      9418")
221
-    echo 'configure_firewall_for_git' >> $COMPLETION_FILE
221
+    mark_completed $FUNCNAME
222
 }
222
 }
223
 
223
 
224
 function configure_internet_protocol {
224
 function configure_internet_protocol {
225
-    if grep -Fxq "configure_internet_protocol" $COMPLETION_FILE; then
225
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
226
         return
226
         return
227
     fi
227
     fi
228
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
228
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
257
         echo 'net.ipv4.tcp_keepalive_intvl = 75' >> /etc/sysctl.conf
257
         echo 'net.ipv4.tcp_keepalive_intvl = 75' >> /etc/sysctl.conf
258
         echo 'net.ipv4.tcp_keepalive_time = 7200' >> /etc/sysctl.conf
258
         echo 'net.ipv4.tcp_keepalive_time = 7200' >> /etc/sysctl.conf
259
     fi
259
     fi
260
-    echo 'configure_internet_protocol' >> $COMPLETION_FILE
260
+    mark_completed $FUNCNAME
261
 }
261
 }
262
 
262
 
263
 function mesh_firewall {
263
 function mesh_firewall {

+ 3
- 6
src/freedombone-utils-git Datei anzeigen

90
     repo_commit=$3
90
     repo_commit=$3
91
     if [ -d $repo_dir ]; then
91
     if [ -d $repo_dir ]; then
92
         if grep -q "$repo_commit_name" $COMPLETION_FILE; then
92
         if grep -q "$repo_commit_name" $COMPLETION_FILE; then
93
-            CURRENT_REPO_COMMIT=$(grep "$repo_commit_name" $COMPLETION_FILE | awk -F ':' '{print $2}')
93
+            CURRENT_REPO_COMMIT=$(get_completion_param "$repo_commit_name")
94
             if [[ "$CURRENT_REPO_COMMIT" != "$repo_commit" ]]; then
94
             if [[ "$CURRENT_REPO_COMMIT" != "$repo_commit" ]]; then
95
                 echo "1"
95
                 echo "1"
96
             fi
96
             fi
131
             systemctl restart inadyn
131
             systemctl restart inadyn
132
         fi
132
         fi
133
 
133
 
134
-        if ! grep -q "${repo_commit_name}:" $COMPLETION_FILE; then
135
-            echo "${repo_commit_name}:${repo_commit}" >> $COMPLETION_FILE
136
-        else
137
-            sed -i "s/${repo_commit_name}.*/${repo_commit_name}:$repo_commit/g" $COMPLETION_FILE
138
-        fi
134
+        function_check set_completion_param
135
+        set_completion_param "${repo_commit_name}" "${repo_commit}"
139
     fi
136
     fi
140
 }
137
 }
141
 
138
 

+ 1
- 1
src/freedombone-utils-go Datei anzeigen

207
         systemctl restart gogs
207
         systemctl restart gogs
208
     fi
208
     fi
209
 
209
 
210
-    echo "upgrade_golang:$GO_VERSION" >> $COMPLETION_FILE
210
+    set_completion_param "$FUNCNAME" "$GO_VERSION"
211
 }
211
 }
212
 
212
 
213
 # NOTE: deliberately there is no "exit 0"
213
 # NOTE: deliberately there is no "exit 0"

+ 2
- 2
src/freedombone-utils-international Datei anzeigen

29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
 
30
 
31
 function locale_setup {
31
 function locale_setup {
32
-    if grep -Fxq "locale_setup" $COMPLETION_FILE; then
32
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
33
         return
33
         return
34
     fi
34
     fi
35
 
35
 
49
     update-locale LC_ALL=${DEFAULT_LANGUAGE}
49
     update-locale LC_ALL=${DEFAULT_LANGUAGE}
50
     update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
50
     update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
51
 
51
 
52
-    echo 'locale_setup' >> $COMPLETION_FILE
52
+    mark_completed $FUNCNAME
53
 }
53
 }
54
 
54
 
55
 # NOTE: deliberately no exit 0
55
 # NOTE: deliberately no exit 0

+ 2
- 2
src/freedombone-utils-login Datei anzeigen

29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
 
30
 
31
 function change_login_message {
31
 function change_login_message {
32
-    if grep -Fxq "change_login_message" $COMPLETION_FILE; then
32
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
33
         return
33
         return
34
     fi
34
     fi
35
 
35
 
46
     echo "'    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'" >> /etc/motd
46
     echo "'    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'" >> /etc/motd
47
     echo $'                  Freedom in the Cloud' >> /etc/motd
47
     echo $'                  Freedom in the Cloud' >> /etc/motd
48
     echo '' >> /etc/motd
48
     echo '' >> /etc/motd
49
-    echo 'change_login_message' >> $COMPLETION_FILE
49
+    mark_completed $FUNCNAME
50
 }
50
 }
51
 
51
 
52
 # NOTE: deliberately no exit 0
52
 # NOTE: deliberately no exit 0

+ 29
- 29
src/freedombone-utils-monkeysphere Datei anzeigen

29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
 
30
 
31
 function install_monkeysphere {
31
 function install_monkeysphere {
32
-	if grep -Fxq "install_monkeysphere" $COMPLETION_FILE; then
33
-		return
34
-	fi
35
-	apt-get -y install monkeysphere msva-perl
36
-	#su -c "monkeysphere gen-subkey $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
37
-	mkdir /home/$MY_USERNAME/.monkeysphere
38
-	chmod 755 /home/$MY_USERNAME/.monkeysphere
39
-	echo "$MY_NAME <${MY_EMAIL_ADDRESS}>" > /home/$MY_USERNAME/.monkeysphere/authorized_user_ids
40
-	chmod 644 /home/$MY_USERNAME/.monkeysphere/authorized_user_ids
41
-	chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.monkeysphere
42
-	monkeysphere-authentication update-users
32
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
33
+        return
34
+    fi
35
+    apt-get -y install monkeysphere msva-perl
36
+    #su -c "monkeysphere gen-subkey $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
37
+    mkdir /home/$MY_USERNAME/.monkeysphere
38
+    chmod 755 /home/$MY_USERNAME/.monkeysphere
39
+    echo "$MY_NAME <${MY_EMAIL_ADDRESS}>" > /home/$MY_USERNAME/.monkeysphere/authorized_user_ids
40
+    chmod 644 /home/$MY_USERNAME/.monkeysphere/authorized_user_ids
41
+    chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.monkeysphere
42
+    monkeysphere-authentication update-users
43
 
43
 
44
-	if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
45
-		echo $'monkeysphere import: ssh host key not found'
46
-		exit 76295
47
-	fi
48
-	monkeysphere-host import-key /etc/ssh/ssh_host_rsa_key ssh://$DEFAULT_DOMAIN_NAME
49
-	SSH_ONION_HOSTNAME=$(cat ${COMPLETION_FILE} | grep 'ssh onion domain' | awk -F ':' '{print $2}')
50
-	monkeysphere-host import-key /etc/ssh/ssh_host_rsa_key ssh://$SSH_ONION_HOSTNAME
44
+    if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
45
+        echo $'monkeysphere import: ssh host key not found'
46
+        exit 76295
47
+    fi
48
+    monkeysphere-host import-key /etc/ssh/ssh_host_rsa_key ssh://$DEFAULT_DOMAIN_NAME
49
+    SSH_ONION_HOSTNAME=$(cat ${COMPLETION_FILE} | grep 'ssh onion domain' | awk -F ':' '{print $2}')
50
+    monkeysphere-host import-key /etc/ssh/ssh_host_rsa_key ssh://$SSH_ONION_HOSTNAME
51
 
51
 
52
-	if [ ! $MY_GPG_PUBLIC_KEY_ID ]; then
53
-		MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_USERNAME@$HOSTNAME")
54
-		if [ ${#MY_GPG_PUBLIC_KEY_ID} -lt 4 ]; then
55
-			echo $'monkeysphere unable to get GPG key ID for user $MY_USERNAME'
56
-			exit 52825
57
-		fi
58
-	fi
59
-	# The admin user is the identity certifier
60
-	fpr=$(gpg --with-colons --fingerprint $MY_GPG_PUBLIC_KEY_ID | grep fpr | head -n 1 | awk -F ':' '{print $10}')
61
-	monkeysphere-authentication add-identity-certifier $fpr
52
+    if [ ! $MY_GPG_PUBLIC_KEY_ID ]; then
53
+        MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_USERNAME@$HOSTNAME")
54
+        if [ ${#MY_GPG_PUBLIC_KEY_ID} -lt 4 ]; then
55
+            echo $'monkeysphere unable to get GPG key ID for user $MY_USERNAME'
56
+            exit 52825
57
+        fi
58
+    fi
59
+    # The admin user is the identity certifier
60
+    fpr=$(gpg --with-colons --fingerprint $MY_GPG_PUBLIC_KEY_ID | grep fpr | head -n 1 | awk -F ':' '{print $10}')
61
+    monkeysphere-authentication add-identity-certifier $fpr
62
 
62
 
63
-	echo 'install_monkeysphere' >> $COMPLETION_FILE
63
+    mark_completed $FUNCNAME
64
 }
64
 }
65
 
65
 
66
 # NOTE: deliberately no exit 0
66
 # NOTE: deliberately no exit 0

+ 42
- 42
src/freedombone-utils-network Datei anzeigen

41
 MESH_INSTALL_DIR=/var/lib
41
 MESH_INSTALL_DIR=/var/lib
42
 
42
 
43
 function install_static_network {
43
 function install_static_network {
44
-	if grep -Fxq "install_static_network" $COMPLETION_FILE; then
45
-		return
46
-	fi
47
-	if [[ $INSTALLING_ON_BBB == "yes" ]]; then
48
-		return
49
-	fi
50
-	if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
51
-		return
52
-	fi
44
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
45
+        return
46
+    fi
47
+    if [[ $INSTALLING_ON_BBB == "yes" ]]; then
48
+        return
49
+    fi
50
+    if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
51
+        return
52
+    fi
53
 
53
 
54
-	echo '# The loopback network interface' > /etc/network/interfaces
55
-	echo 'auto lo' >> /etc/network/interfaces
56
-	echo 'iface lo inet loopback' >> /etc/network/interfaces
57
-	echo '' >> /etc/network/interfaces
58
-	echo '# The primary network interface' >> /etc/network/interfaces
59
-	echo 'auto eth0' >> /etc/network/interfaces
60
-	echo 'iface eth0 inet static' >> /etc/network/interfaces
61
-	echo "    address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces
62
-	echo '    netmask 255.255.255.0' >> /etc/network/interfaces
63
-	echo "    gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces
64
-	echo "    dns-nameservers $NAMESERVER1 $NAMESERVER2" >> /etc/network/interfaces
65
-	echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
66
-	echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
67
-	echo '' >> /etc/network/interfaces
68
-	echo '# The secondary network interface' >> /etc/network/interfaces
69
-	echo '#auto eth1' >> /etc/network/interfaces
70
-	echo '#iface eth1 inet dhcp' >> /etc/network/interfaces
71
-	echo '' >> /etc/network/interfaces
72
-	echo '# WiFi Example' >> /etc/network/interfaces
73
-	echo "#auto $WIFI_INTERFACE" >> /etc/network/interfaces
74
-	echo "#iface $WIFI_INTERFACE inet dhcp" >> /etc/network/interfaces
75
-	echo '#    wpa-ssid "essid"' >> /etc/network/interfaces
76
-	echo '#    wpa-psk  "password"' >> /etc/network/interfaces
77
-	echo '' >> /etc/network/interfaces
78
-	echo '# Ethernet/RNDIS gadget (g_ether)' >> /etc/network/interfaces
79
-	echo '# ... or on host side, usbnet and random hwaddr' >> /etc/network/interfaces
80
-	echo '# Note on some boards, usb0 is automaticly setup with an init script' >> /etc/network/interfaces
81
-	echo '#iface usb0 inet static' >> /etc/network/interfaces
82
-	echo '#    address 192.168.7.2' >> /etc/network/interfaces
83
-	echo '#    netmask 255.255.255.0' >> /etc/network/interfaces
84
-	echo '#    network 192.168.7.0' >> /etc/network/interfaces
85
-	echo '#    gateway 192.168.7.1' >> /etc/network/interfaces
54
+    echo '# The loopback network interface' > /etc/network/interfaces
55
+    echo 'auto lo' >> /etc/network/interfaces
56
+    echo 'iface lo inet loopback' >> /etc/network/interfaces
57
+    echo '' >> /etc/network/interfaces
58
+    echo '# The primary network interface' >> /etc/network/interfaces
59
+    echo 'auto eth0' >> /etc/network/interfaces
60
+    echo 'iface eth0 inet static' >> /etc/network/interfaces
61
+    echo "    address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces
62
+    echo '    netmask 255.255.255.0' >> /etc/network/interfaces
63
+    echo "    gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces
64
+    echo "    dns-nameservers $NAMESERVER1 $NAMESERVER2" >> /etc/network/interfaces
65
+    echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
66
+    echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
67
+    echo '' >> /etc/network/interfaces
68
+    echo '# The secondary network interface' >> /etc/network/interfaces
69
+    echo '#auto eth1' >> /etc/network/interfaces
70
+    echo '#iface eth1 inet dhcp' >> /etc/network/interfaces
71
+    echo '' >> /etc/network/interfaces
72
+    echo '# WiFi Example' >> /etc/network/interfaces
73
+    echo "#auto $WIFI_INTERFACE" >> /etc/network/interfaces
74
+    echo "#iface $WIFI_INTERFACE inet dhcp" >> /etc/network/interfaces
75
+    echo '#    wpa-ssid "essid"' >> /etc/network/interfaces
76
+    echo '#    wpa-psk  "password"' >> /etc/network/interfaces
77
+    echo '' >> /etc/network/interfaces
78
+    echo '# Ethernet/RNDIS gadget (g_ether)' >> /etc/network/interfaces
79
+    echo '# ... or on host side, usbnet and random hwaddr' >> /etc/network/interfaces
80
+    echo '# Note on some boards, usb0 is automaticly setup with an init script' >> /etc/network/interfaces
81
+    echo '#iface usb0 inet static' >> /etc/network/interfaces
82
+    echo '#    address 192.168.7.2' >> /etc/network/interfaces
83
+    echo '#    netmask 255.255.255.0' >> /etc/network/interfaces
84
+    echo '#    network 192.168.7.0' >> /etc/network/interfaces
85
+    echo '#    gateway 192.168.7.1' >> /etc/network/interfaces
86
 
86
 
87
-	echo 'install_static_network' >> $COMPLETION_FILE
87
+    mark_completed $FUNCNAME
88
 }
88
 }
89
 
89
 
90
 # NOTE: deliberately no exit 0
90
 # NOTE: deliberately no exit 0

+ 2
- 2
src/freedombone-utils-nodejs Datei anzeigen

70
         mesh_install_nodejs
70
         mesh_install_nodejs
71
         return
71
         return
72
     fi
72
     fi
73
-    if grep -Fxq "install_nodejs" $COMPLETION_FILE; then
73
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
74
         return
74
         return
75
     fi
75
     fi
76
 
76
 
101
     fi
101
     fi
102
     rm -f /root/install-nodejs.sh
102
     rm -f /root/install-nodejs.sh
103
 
103
 
104
-    echo 'install_nodejs' >> $COMPLETION_FILE
104
+    mark_completed $FUNCNAME
105
 }
105
 }
106
 
106
 
107
 # NOTE: deliberately there is no "exit 0"
107
 # NOTE: deliberately there is no "exit 0"

+ 12
- 22
src/freedombone-utils-onion Datei anzeigen

107
     onion_address=$(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
107
     onion_address=$(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
108
 
108
 
109
     # Record the domain in the completion file
109
     # Record the domain in the completion file
110
-    if [ -f $COMPLETION_FILE ]; then
111
-        if ! grep "${onion_service_name} onion domain" $COMPLETION_FILE; then
112
-            echo "${onion_service_name} onion domain:${onion_address}" >> $COMPLETION_FILE
113
-        else
114
-            sed -i "s|${onion_service_name} onion domain.*|${onion_service_name} onion domain:${onion_address}|g" $COMPLETION_FILE
115
-        fi
116
-    fi
110
+    set_completion_param "${onion_service_name} onion domain" "${onion_address}"
117
 
111
 
118
     echo $onion_address
112
     echo $onion_address
119
 }
113
 }
179
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
173
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
180
         return
174
         return
181
     fi
175
     fi
182
-    if grep -Fxq "enable_ssh_via_onion" $COMPLETION_FILE; then
176
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
183
         return
177
         return
184
     fi
178
     fi
185
     apt-get -y install tor connect-proxy
179
     apt-get -y install tor connect-proxy
199
         echo 'Host *.onion' >> /root/.ssh/config
193
         echo 'Host *.onion' >> /root/.ssh/config
200
         echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /root/.ssh/config
194
         echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /root/.ssh/config
201
     fi
195
     fi
202
-    echo 'enable_ssh_via_onion' >> $COMPLETION_FILE
196
+    mark_completed $FUNCNAME
203
 }
197
 }
204
 
198
 
205
 function configure_ssh_onion {
199
 function configure_ssh_onion {
206
-    if grep -Fxq "configure_ssh_onion" $COMPLETION_FILE; then
200
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
207
         return
201
         return
208
     fi
202
     fi
209
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
203
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
212
 
206
 
213
     SSH_ONION_HOSTNAME=$(add_onion_service ssh ${SSH_PORT} ${SSH_PORT})
207
     SSH_ONION_HOSTNAME=$(add_onion_service ssh ${SSH_PORT} ${SSH_PORT})
214
 
208
 
215
-    if ! grep -q "ssh onion domain" $COMPLETION_FILE; then
216
-        echo "ssh onion domain:${SSH_ONION_HOSTNAME}" >> $COMPLETION_FILE
217
-    else
218
-        sed -i "s|ssh onion domain.*|ssh onion domain:${SSH_ONION_HOSTNAME}|g" $COMPLETION_FILE
219
-    fi
209
+    set_completion_param "ssh onion domain" "${SSH_ONION_HOSTNAME}"
220
 
210
 
221
-    echo 'configure_ssh_onion' >> $COMPLETION_FILE
211
+    mark_completed $FUNCNAME
222
 }
212
 }
223
 
213
 
224
 function install_tor {
214
 function install_tor {
225
     if [[ $SYSTEM_TYPE == "mesh*" ]]; then
215
     if [[ $SYSTEM_TYPE == "mesh*" ]]; then
226
         return
216
         return
227
     fi
217
     fi
228
-    if grep -Fxq "install_tor" $COMPLETION_FILE; then
218
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
229
         return
219
         return
230
     fi
220
     fi
231
     apt-get -y install tor
221
     apt-get -y install tor
233
         echo 'Tor failed to install'
223
         echo 'Tor failed to install'
234
         exit 38259
224
         exit 38259
235
     fi
225
     fi
236
-    echo 'install_tor' >> $COMPLETION_FILE
226
+    mark_completed $FUNCNAME
237
 }
227
 }
238
 
228
 
239
 function resolve_dns_via_tor {
229
 function resolve_dns_via_tor {
240
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
230
     if [[ $SYSTEM_TYPE == "mesh"* ]]; then
241
         return
231
         return
242
     fi
232
     fi
243
-    if grep -Fxq "resolve_dns_via_tor" $COMPLETION_FILE; then
233
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
244
         return
234
         return
245
     fi
235
     fi
246
     if [ ! -f /etc/tor/torrc ]; then
236
     if [ ! -f /etc/tor/torrc ]; then
265
     # prevent resolv.conf from changing
255
     # prevent resolv.conf from changing
266
     chattr +i /etc/resolv.conf
256
     chattr +i /etc/resolv.conf
267
 
257
 
268
-    echo 'resolve_dns_via_tor' >> $COMPLETION_FILE
258
+    mark_completed $FUNCNAME
269
 }
259
 }
270
 
260
 
271
 # see https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy
261
 # see https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy
272
 # Local Redirection and Anonymizing Middlebox
262
 # Local Redirection and Anonymizing Middlebox
273
 function route_outgoing_traffic_through_tor {
263
 function route_outgoing_traffic_through_tor {
274
-    if grep -Fxq "route_outgoing_traffic_through_tor" $COMPLETION_FILE; then
264
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
275
         return
265
         return
276
     fi
266
     fi
277
     if [[ $ROUTE_THROUGH_TOR != "yes" ]]; then
267
     if [[ $ROUTE_THROUGH_TOR != "yes" ]]; then
364
         echo "DNSListenAddress $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/tor/torrc
354
         echo "DNSListenAddress $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/tor/torrc
365
     fi
355
     fi
366
 
356
 
367
-    echo 'route_outgoing_traffic_through_tor' >> $COMPLETION_FILE
357
+    mark_completed $FUNCNAME
368
 }
358
 }
369
 
359
 
370
 # NOTE: deliberately no exit 0
360
 # NOTE: deliberately no exit 0

+ 2
- 2
src/freedombone-utils-passwords Datei anzeigen

41
 
41
 
42
 function enforce_good_passwords {
42
 function enforce_good_passwords {
43
     # because humans are generally bad at choosing passwords
43
     # because humans are generally bad at choosing passwords
44
-    if grep -Fxq "enforce_good_passwords" $COMPLETION_FILE; then
44
+    if [[ $(is_completd $FUNCNAME) == "1" ]]; then
45
         return
45
         return
46
     fi
46
     fi
47
     apt-get -y install libpam-cracklib
47
     apt-get -y install libpam-cracklib
48
 
48
 
49
     sed -i 's/password.*requisite.*pam_cracklib.so.*/password        required                       pam_cracklib.so retry=2 dcredit=-4 ucredit=-1 ocredit=-1 lcredit=0 minlen=10 reject_username/g' /etc/pam.d/common-password
49
     sed -i 's/password.*requisite.*pam_cracklib.so.*/password        required                       pam_cracklib.so retry=2 dcredit=-4 ucredit=-1 ocredit=-1 lcredit=0 minlen=10 reject_username/g' /etc/pam.d/common-password
50
-    echo 'enforce_good_passwords' >> $COMPLETION_FILE
50
+    mark_completed $FUNCNAME
51
 }
51
 }
52
 
52
 
53
 function create_password {
53
 function create_password {

+ 6
- 6
src/freedombone-utils-repos Datei anzeigen

39
 FRIENDS_MIRRORS_SSH_PORT=2222
39
 FRIENDS_MIRRORS_SSH_PORT=2222
40
 
40
 
41
 function create_repo_sources {
41
 function create_repo_sources {
42
-    if grep -Fxq "create_repo_sources" $COMPLETION_FILE; then
42
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
43
         return
43
         return
44
     fi
44
     fi
45
     rm -rf /var/lib/apt/lists/*
45
     rm -rf /var/lib/apt/lists/*
60
     apt-get update
60
     apt-get update
61
     apt-get -y install apt-transport-https
61
     apt-get -y install apt-transport-https
62
 
62
 
63
-    echo 'create_repo_sources' >> $COMPLETION_FILE
63
+    mark_completed $FUNCNAME
64
 }
64
 }
65
 
65
 
66
 function read_repo_servers {
66
 function read_repo_servers {
105
 
105
 
106
 # A command to create a git repository for a project
106
 # A command to create a git repository for a project
107
 function create_git_project {
107
 function create_git_project {
108
-    if grep -Fxq "create_git_project" $COMPLETION_FILE; then
108
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
109
         return
109
         return
110
     fi
110
     fi
111
     apt-get -y install git
111
     apt-get -y install git
133
     echo 'exit 0' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
133
     echo 'exit 0' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
134
     chmod +x /usr/bin/$CREATE_GIT_PROJECT_COMMAND
134
     chmod +x /usr/bin/$CREATE_GIT_PROJECT_COMMAND
135
 
135
 
136
-    echo 'create_git_project' >> $COMPLETION_FILE
136
+    mark_completed $FUNCNAME
137
 }
137
 }
138
 
138
 
139
 function create_mirrors {
139
 function create_mirrors {
140
     if [ -d /home/trove ]; then
140
     if [ -d /home/trove ]; then
141
         userdel -r trove
141
         userdel -r trove
142
     fi
142
     fi
143
-    if grep -Fxq "create_mirrors" $COMPLETION_FILE; then
143
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
144
         return
144
         return
145
     fi
145
     fi
146
     ${PROJECT_NAME}-mirrors
146
     ${PROJECT_NAME}-mirrors
147
-    echo 'create_mirrors' >> $COMPLETION_FILE
147
+    mark_completed $FUNCNAME
148
 }
148
 }
149
 
149
 
150
 # NOTE: deliberately no exit 0
150
 # NOTE: deliberately no exit 0

+ 111
- 111
src/freedombone-utils-rng Datei anzeigen

42
 ONERNG_DEVICE='ttyACM0'
42
 ONERNG_DEVICE='ttyACM0'
43
 
43
 
44
 function check_hwrng {
44
 function check_hwrng {
45
-	if [[ $HWRNG_TYPE == "beaglebone" ]]; then
46
-		# If hardware random number generation was enabled then make sure that the device exists.
47
-		# if /dev/hwrng is not found then any subsequent cryptographic key generation would
48
-		# suffer from low entropy and might be insecure
49
-		if [ ! -e /dev/hwrng ]; then
50
-			ls /dev/hw*
51
-			echo $'The hardware random number generator is enabled but could not be detected on'
52
-			echo $'/dev/hwrng.  There may be a problem with the installation or the Beaglebone hardware.'
53
-			exit 75
54
-		fi
55
-	fi
56
-
57
-	# If a OneRNG device was installed then verify its firmware
58
-	#check_onerng_verification
45
+    if [[ $HWRNG_TYPE == "beaglebone" ]]; then
46
+        # If hardware random number generation was enabled then make sure that the device exists.
47
+        # if /dev/hwrng is not found then any subsequent cryptographic key generation would
48
+        # suffer from low entropy and might be insecure
49
+        if [ ! -e /dev/hwrng ]; then
50
+            ls /dev/hw*
51
+            echo $'The hardware random number generator is enabled but could not be detected on'
52
+            echo $'/dev/hwrng.  There may be a problem with the installation or the Beaglebone hardware.'
53
+            exit 75
54
+        fi
55
+    fi
56
+
57
+    # If a OneRNG device was installed then verify its firmware
58
+    #check_onerng_verification
59
 }
59
 }
60
 
60
 
61
 function check_onerng_verification {
61
 function check_onerng_verification {
62
-	if grep -Fxq "check_onerng_verification" $COMPLETION_FILE; then
63
-		return
64
-	fi
65
-	if [[ $HWRNG_TYPE != "onerng" ]]; then
66
-		return
67
-	fi
68
-	echo $'Checking OneRNG firmware verification'
69
-	last_onerng_validation=$(cat /var/log/syslog.1 | grep "OneRNG: firmware verification" | awk '/./{line=$0} END{print line}')
70
-	if [[ $last_onerng_validation != *"passed OK"* ]]; then
71
-		last_onerng_validation=$(cat /var/log/syslog | grep "OneRNG: firmware verification" | awk '/./{line=$0} END{print line}')
72
-		if [[ $last_onerng_validation != *"passed OK"* ]]; then
73
-			echo $last_onerng_validation
74
-			echo $'OneRNG firmware verification failed'
75
-			exit 735026
76
-		fi
77
-	fi
78
-	echo $'OneRNG firmware verification passed'
79
-	# if haveged was previously installed then remove it
80
-	apt-get -y remove haveged
81
-	echo 'check_onerng_verification' >> $COMPLETION_FILE
62
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
63
+        return
64
+    fi
65
+    if [[ $HWRNG_TYPE != "onerng" ]]; then
66
+        return
67
+    fi
68
+    echo $'Checking OneRNG firmware verification'
69
+    last_onerng_validation=$(cat /var/log/syslog.1 | grep "OneRNG: firmware verification" | awk '/./{line=$0} END{print line}')
70
+    if [[ $last_onerng_validation != *"passed OK"* ]]; then
71
+        last_onerng_validation=$(cat /var/log/syslog | grep "OneRNG: firmware verification" | awk '/./{line=$0} END{print line}')
72
+        if [[ $last_onerng_validation != *"passed OK"* ]]; then
73
+            echo $last_onerng_validation
74
+            echo $'OneRNG firmware verification failed'
75
+            exit 735026
76
+        fi
77
+    fi
78
+    echo $'OneRNG firmware verification passed'
79
+    # if haveged was previously installed then remove it
80
+    apt-get -y remove haveged
81
+    mark_completed $FUNCNAME
82
 }
82
 }
83
 
83
 
84
 function install_onerng {
84
 function install_onerng {
85
-	apt-get -y install rng-tools at python-gnupg
86
-
87
-	# Move to the installation directory
88
-	if [ ! -d $INSTALL_DIR ]; then
89
-		mkdir $INSTALL_DIR
90
-	fi
91
-	cd $INSTALL_DIR
92
-
93
-	# Download the package
94
-	if [ ! -f $ONERNG_PACKAGE ]; then
95
-		wget $ONERNG_PACKAGE_DOWNLOAD
96
-		mv "$ONERNG_PACKAGE?raw=true" $ONERNG_PACKAGE
97
-	fi
98
-	if [ ! -f $ONERNG_PACKAGE ]; then
99
-		echo $"OneRNG package could not be downloaded"
100
-		exit 59249
101
-	fi
102
-
103
-	# Check the hash
104
-	hash=$(sha256sum $ONERNG_PACKAGE | awk -F ' ' '{print $1}')
105
-	if [[ $hash != $ONERNG_PACKAGE_HASH ]]; then
106
-		echo $"OneRNG package: $ONERNG_PACKAGE"
107
-		echo $"Hash does not match. This could indicate that the package has been tampered with."
108
-		echo $"OneRNG expected package hash: $ONERNG_PACKAGE_HASH"
109
-		echo $"OneRNG actual hash: $hash"
110
-		exit 25934
111
-	fi
112
-
113
-	# install the package
114
-	dpkg -i $ONERNG_PACKAGE
115
-
116
-	# Check that the install worked
117
-	if [ ! -f /etc/onerng.conf ]; then
118
-		echo $'OneRNG configuration file not found. The package may not have installed successfully.'
119
-		exit 42904
120
-	fi
121
-
122
-	dialog --title $"OneRNG Device" \
123
-		   --msgbox $"Please plug in the OneRNG device" 6 40
124
-
125
-	# check rng-tools configuration
126
-	if ! grep -q "/dev/$ONERNG_DEVICE" /etc/default/rng-tools; then
127
-		echo "HRNGDEVICE=/dev/$ONERNG_DEVICE" >> /etc/default/rng-tools
128
-	fi
129
-
130
-	systemctl restart rng-tools
85
+    apt-get -y install rng-tools at python-gnupg
86
+
87
+    # Move to the installation directory
88
+    if [ ! -d $INSTALL_DIR ]; then
89
+        mkdir $INSTALL_DIR
90
+    fi
91
+    cd $INSTALL_DIR
92
+
93
+    # Download the package
94
+    if [ ! -f $ONERNG_PACKAGE ]; then
95
+        wget $ONERNG_PACKAGE_DOWNLOAD
96
+        mv "$ONERNG_PACKAGE?raw=true" $ONERNG_PACKAGE
97
+    fi
98
+    if [ ! -f $ONERNG_PACKAGE ]; then
99
+        echo $"OneRNG package could not be downloaded"
100
+        exit 59249
101
+    fi
102
+
103
+    # Check the hash
104
+    hash=$(sha256sum $ONERNG_PACKAGE | awk -F ' ' '{print $1}')
105
+    if [[ $hash != $ONERNG_PACKAGE_HASH ]]; then
106
+        echo $"OneRNG package: $ONERNG_PACKAGE"
107
+        echo $"Hash does not match. This could indicate that the package has been tampered with."
108
+        echo $"OneRNG expected package hash: $ONERNG_PACKAGE_HASH"
109
+        echo $"OneRNG actual hash: $hash"
110
+        exit 25934
111
+    fi
112
+
113
+    # install the package
114
+    dpkg -i $ONERNG_PACKAGE
115
+
116
+    # Check that the install worked
117
+    if [ ! -f /etc/onerng.conf ]; then
118
+        echo $'OneRNG configuration file not found. The package may not have installed successfully.'
119
+        exit 42904
120
+    fi
121
+
122
+    dialog --title $"OneRNG Device" \
123
+           --msgbox $"Please plug in the OneRNG device" 6 40
124
+
125
+    # check rng-tools configuration
126
+    if ! grep -q "/dev/$ONERNG_DEVICE" /etc/default/rng-tools; then
127
+        echo "HRNGDEVICE=/dev/$ONERNG_DEVICE" >> /etc/default/rng-tools
128
+    fi
129
+
130
+    systemctl restart rng-tools
131
 }
131
 }
132
 
132
 
133
 function random_number_generator {
133
 function random_number_generator {
134
-	if grep -Fxq "random_number_generator" $COMPLETION_FILE; then
135
-		return
136
-	fi
137
-	if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
138
-		# it is assumed that docker uses the random number
139
-		# generator of the host system
140
-		return
141
-	fi
142
-
143
-	# if the hrng type has not been set but /dev/hwrng is detected
144
-	if [[ $HWRNG_TYPE != "beaglebone" ]]; then
145
-		if [ -e /dev/hwrng ]; then
146
-			HWRNG_TYPE="beaglebone"
147
-		fi
148
-	fi
149
-
150
-	case $HWRNG_TYPE in
151
-		beaglebone)
152
-			apt-get -y install rng-tools
153
-			sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' /etc/default/rng-tools
154
-			;;
155
-		onerng)
156
-			function_check install_onerng
157
-			install_onerng
158
-			;;
159
-		*)
160
-			apt-get -y install haveged
161
-			;;
162
-	esac
163
-
164
-	echo 'random_number_generator' >> $COMPLETION_FILE
134
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
135
+        return
136
+    fi
137
+    if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
138
+        # it is assumed that docker uses the random number
139
+        # generator of the host system
140
+        return
141
+    fi
142
+
143
+    # if the hrng type has not been set but /dev/hwrng is detected
144
+    if [[ $HWRNG_TYPE != "beaglebone" ]]; then
145
+        if [ -e /dev/hwrng ]; then
146
+            HWRNG_TYPE="beaglebone"
147
+        fi
148
+    fi
149
+
150
+    case $HWRNG_TYPE in
151
+        beaglebone)
152
+            apt-get -y install rng-tools
153
+            sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' /etc/default/rng-tools
154
+            ;;
155
+        onerng)
156
+            function_check install_onerng
157
+            install_onerng
158
+            ;;
159
+        *)
160
+            apt-get -y install haveged
161
+            ;;
162
+    esac
163
+
164
+    mark_completed $FUNCNAME
165
 }
165
 }
166
 
166
 
167
 # NOTE: deliberately no exit 0
167
 # NOTE: deliberately no exit 0

+ 3
- 1
src/freedombone-utils-selector Datei anzeigen

230
     if [ ! ${1} ]; then
230
     if [ ! ${1} ]; then
231
         exit 673935
231
         exit 673935
232
     fi
232
     fi
233
-    echo "install_${1}" >> $COMPLETION_FILE
233
+    if ! grep -Fxq "install_${1}" $COMPLETION_FILE; then
234
+        echo "install_${1}" >> $COMPLETION_FILE
235
+    fi
234
 }
236
 }
235
 
237
 
236
 # populates an array of "0" or "1" for whether apps are installed
238
 # populates an array of "0" or "1" for whether apps are installed

+ 4
- 6
src/freedombone-utils-setup Datei anzeigen

82
 DH_KEYLENGTH=2048
82
 DH_KEYLENGTH=2048
83
 
83
 
84
 function initial_setup {
84
 function initial_setup {
85
-    if grep -Fxq "initial_setup" $COMPLETION_FILE; then
85
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
86
         return
86
         return
87
     fi
87
     fi
88
 
88
 
104
         mkdir -p $INSTALL_DIR
104
         mkdir -p $INSTALL_DIR
105
     fi
105
     fi
106
 
106
 
107
-    echo 'initial_setup' >> $COMPLETION_FILE
107
+    mark_completed $FUNCNAME
108
 }
108
 }
109
 
109
 
110
 function search_for_attached_usb_drive {
110
 function search_for_attached_usb_drive {
210
         fi
210
         fi
211
         echo $'No USB drive attached'
211
         echo $'No USB drive attached'
212
     fi
212
     fi
213
-    echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE
213
+    mark_completed $FUNCNAME
214
 }
214
 }
215
 
215
 
216
 function mark_admin_user_account {
216
 function mark_admin_user_account {
217
-    if ! grep -q "Admin user:" $COMPLETION_FILE; then
218
-        echo "Admin user:$MY_USERNAME" >> $COMPLETION_FILE
219
-    fi
217
+    set_completion_param "Admin user" "$MY_USERNAME"
220
 }
218
 }
221
 
219
 
222
 function remove_instructions_from_motd {
220
 function remove_instructions_from_motd {

+ 6
- 6
src/freedombone-utils-ssh Datei anzeigen

37
 SSH_HOST_KEY_ALGORITHMS="ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-ed25519,ssh-rsa"
37
 SSH_HOST_KEY_ALGORITHMS="ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-ed25519,ssh-rsa"
38
 
38
 
39
 function configure_ssh {
39
 function configure_ssh {
40
-    if grep -Fxq "configure_ssh" $COMPLETION_FILE; then
40
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
41
         return
41
         return
42
     fi
42
     fi
43
     sed -i "s/Port .*/Port $SSH_PORT/g" /etc/ssh/sshd_config
43
     sed -i "s/Port .*/Port $SSH_PORT/g" /etc/ssh/sshd_config
82
 
82
 
83
     function_check configure_firewall_for_ssh
83
     function_check configure_firewall_for_ssh
84
     configure_firewall_for_ssh
84
     configure_firewall_for_ssh
85
-    echo 'configure_ssh' >> $COMPLETION_FILE
85
+    mark_completed $FUNCNAME
86
 }
86
 }
87
 
87
 
88
 # see https://stribika.github.io/2015/01/04/secure-secure-shell.html
88
 # see https://stribika.github.io/2015/01/04/secure-secure-shell.html
92
 }
92
 }
93
 
93
 
94
 function configure_ssh_client {
94
 function configure_ssh_client {
95
-    if grep -Fxq "configure_ssh_client" $COMPLETION_FILE; then
95
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
96
         return
96
         return
97
     fi
97
     fi
98
     #sed -i 's/#   PasswordAuthentication.*/   PasswordAuthentication no/g' /etc/ssh/ssh_config
98
     #sed -i 's/#   PasswordAuthentication.*/   PasswordAuthentication no/g' /etc/ssh/ssh_config
122
 
122
 
123
     function_check ssh_remove_small_moduli
123
     function_check ssh_remove_small_moduli
124
     ssh_remove_small_moduli
124
     ssh_remove_small_moduli
125
-    echo 'configure_ssh_client' >> $COMPLETION_FILE
125
+    mark_completed $FUNCNAME
126
 }
126
 }
127
 
127
 
128
 function regenerate_ssh_keys {
128
 function regenerate_ssh_keys {
129
-    if grep -Fxq "regenerate_ssh_keys" $COMPLETION_FILE; then
129
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
130
         return
130
         return
131
     fi
131
     fi
132
     rm -f /etc/ssh/ssh_host_*
132
     rm -f /etc/ssh/ssh_host_*
136
     ssh_remove_small_moduli
136
     ssh_remove_small_moduli
137
 
137
 
138
     systemctl restart ssh
138
     systemctl restart ssh
139
-    echo 'regenerate_ssh_keys' >> $COMPLETION_FILE
139
+    mark_completed $FUNCNAME
140
 }
140
 }
141
 
141
 
142
 # NOTE: deliberately no exit 0
142
 # NOTE: deliberately no exit 0

+ 2
- 2
src/freedombone-utils-tracker Datei anzeigen

65
         return
65
         return
66
     fi
66
     fi
67
 
67
 
68
-    if grep -Fxq "install_tracker" $COMPLETION_FILE; then
68
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
69
         return
69
         return
70
     fi
70
     fi
71
 
71
 
97
     systemctl enable tracker.service
97
     systemctl enable tracker.service
98
     systemctl start tracker.service
98
     systemctl start tracker.service
99
 
99
 
100
-    echo 'install_tracker' >> $COMPLETION_FILE
100
+    mark_completed $FUNCNAME
101
 }
101
 }
102
 
102
 
103
 # NOTE: deliberately no exit 0
103
 # NOTE: deliberately no exit 0

+ 4
- 4
src/freedombone-utils-upgrade Datei anzeigen

38
         cp /usr/bin/${PROJECT_NAME}-upgrade /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
38
         cp /usr/bin/${PROJECT_NAME}-upgrade /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
39
     fi
39
     fi
40
 
40
 
41
-    if grep -Fxq "create_upgrade_script" $COMPLETION_FILE; then
41
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
42
         return
42
         return
43
     fi
43
     fi
44
 
44
 
45
     apt-get -y install unattended-upgrades
45
     apt-get -y install unattended-upgrades
46
 
46
 
47
-    echo 'create_upgrade_script' >> $COMPLETION_FILE
47
+    mark_completed $FUNCNAME
48
 }
48
 }
49
 
49
 
50
 function upgrade_installation_from_previous_versions {
50
 function upgrade_installation_from_previous_versions {
51
     if [ ! -f $COMPLETION_FILE ]; then
51
     if [ ! -f $COMPLETION_FILE ]; then
52
         return
52
         return
53
     fi
53
     fi
54
-    if grep -Fxq "upgrade_installation_from_previous_versions" $COMPLETION_FILE; then
54
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
55
         return
55
         return
56
     fi
56
     fi
57
 
57
 
84
         rm /usr/local/bin/zeronetavahi
84
         rm /usr/local/bin/zeronetavahi
85
     fi
85
     fi
86
 
86
 
87
-    echo 'upgrade_installation_from_previous_versions' >> $COMPLETION_FILE
87
+    mark_completed $FUNCNAME
88
 }
88
 }
89
 
89
 
90
 # NOTE: deliberately no exit 0
90
 # NOTE: deliberately no exit 0

+ 2
- 2
src/freedombone-utils-watchdog Datei anzeigen

34
 WATCHDOG_SCRIPT_NAME="keepon"
34
 WATCHDOG_SCRIPT_NAME="keepon"
35
 
35
 
36
 function install_watchdog_script {
36
 function install_watchdog_script {
37
-    if grep -Fxq "install_watchdog_script" $COMPLETION_FILE; then
37
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
38
         return
38
         return
39
     fi
39
     fi
40
     echo '#!/bin/bash' > /usr/bin/$WATCHDOG_SCRIPT_NAME
40
     echo '#!/bin/bash' > /usr/bin/$WATCHDOG_SCRIPT_NAME
46
     function_check cron_add_mins
46
     function_check cron_add_mins
47
     cron_add_mins 1 "/usr/bin/$WATCHDOG_SCRIPT_NAME"
47
     cron_add_mins 1 "/usr/bin/$WATCHDOG_SCRIPT_NAME"
48
 
48
 
49
-    echo 'install_watchdog_script' >> $COMPLETION_FILE
49
+    mark_completed $FUNCNAME
50
 }
50
 }
51
 
51
 
52
 function add_watchdog_daemon {
52
 function add_watchdog_daemon {

+ 9
- 16
src/freedombone-utils-web Datei anzeigen

336
     function_check set_repo_commit
336
     function_check set_repo_commit
337
     set_repo_commit $INSTALL_DIR/inadyn "inadyn commit" "$INADYN_COMMIT" $INADYN_REPO
337
     set_repo_commit $INSTALL_DIR/inadyn "inadyn commit" "$INADYN_COMMIT" $INADYN_REPO
338
 
338
 
339
-    if grep -Fxq "install_dynamicdns" $COMPLETION_FILE; then
339
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
340
         return
340
         return
341
     fi
341
     fi
342
 
342
 
357
     fi
357
     fi
358
     cd $INSTALL_DIR/inadyn
358
     cd $INSTALL_DIR/inadyn
359
     git checkout $INADYN_COMMIT -b $INADYN_COMMIT
359
     git checkout $INADYN_COMMIT -b $INADYN_COMMIT
360
-    if ! grep -q "inadyn commit" $COMPLETION_FILE; then
361
-        echo "inadyn commit:$INADYN_COMMIT" >> $COMPLETION_FILE
362
-    else
363
-        sed -i "s/inadyn commit.*/inadyn commit:$INADYN_COMMIT/g" $COMPLETION_FILE
364
-    fi
360
+    set_completion_param "inadyn commit" "$INADYN_COMMIT"
365
 
361
 
366
     ./configure
362
     ./configure
367
     if [ ! "$?" = "0" ]; then
363
     if [ ! "$?" = "0" ]; then
403
     systemctl start inadyn
399
     systemctl start inadyn
404
     systemctl daemon-reload
400
     systemctl daemon-reload
405
 
401
 
406
-    echo 'install_dynamicdns' >> $COMPLETION_FILE
402
+    mark_completed $FUNCNAME
407
 }
403
 }
408
 
404
 
409
 function install_command_line_browser {
405
 function install_command_line_browser {
410
-    if grep -Fxq "install_command_line_browser" $COMPLETION_FILE; then
406
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
411
         return
407
         return
412
     fi
408
     fi
413
     apt-get -y install elinks
409
     apt-get -y install elinks
421
         fi
417
         fi
422
     fi
418
     fi
423
 
419
 
424
-    echo 'install_command_line_browser' >> $COMPLETION_FILE
420
+    mark_completed $FUNCNAME
425
 }
421
 }
426
 
422
 
427
 function mesh_web_server {
423
 function mesh_web_server {
448
     function_check set_repo_commit
444
     function_check set_repo_commit
449
     set_repo_commit $INSTALL_DIR/nginx_ensite "nginx-ensite commit" "$NGINX_ENSITE_COMMIT" $NGINX_ENSITE_REPO
445
     set_repo_commit $INSTALL_DIR/nginx_ensite "nginx-ensite commit" "$NGINX_ENSITE_COMMIT" $NGINX_ENSITE_REPO
450
 
446
 
451
-    if grep -Fxq "install_web_server" $COMPLETION_FILE; then
447
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
452
         return
448
         return
453
     fi
449
     fi
454
     # remove apache
450
     # remove apache
562
     git_clone $NGINX_ENSITE_REPO $INSTALL_DIR/nginx_ensite
558
     git_clone $NGINX_ENSITE_REPO $INSTALL_DIR/nginx_ensite
563
     cd $INSTALL_DIR/nginx_ensite
559
     cd $INSTALL_DIR/nginx_ensite
564
     git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT
560
     git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT
565
-    if ! grep -q "nginx-ensite commit" $COMPLETION_FILE; then
566
-        echo "nginx-ensite commit:$NGINX_ENSITE_COMMIT" >> $COMPLETION_FILE
567
-    else
568
-        sed -i "s/nginx-ensite commit.*/nginx-ensite commit:$NGINX_ENSITE_COMMIT/g" $COMPLETION_FILE
569
-    fi
561
+
562
+    set_completion_param "nginx-ensite commit" "$NGINX_ENSITE_COMMIT"
570
 
563
 
571
     make install
564
     make install
572
     nginx_dissite default
565
     nginx_dissite default
574
     function_check configure_firewall_for_web_access
567
     function_check configure_firewall_for_web_access
575
     configure_firewall_for_web_access
568
     configure_firewall_for_web_access
576
 
569
 
577
-    echo 'install_web_server' >> $COMPLETION_FILE
570
+    mark_completed $FUNCNAME
578
 }
571
 }
579
 
572
 
580
 # NOTE: deliberately no exit 0
573
 # NOTE: deliberately no exit 0

+ 6
- 5
src/freedombone-utils-wifi Datei anzeigen

49
     if [ ${#WIFI_SSID} -lt 2 ]; then
49
     if [ ${#WIFI_SSID} -lt 2 ]; then
50
         return
50
         return
51
     fi
51
     fi
52
-    if grep -Fxq "setup_wifi" $COMPLETION_FILE; then
52
+
53
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
53
         return
54
         return
54
     fi
55
     fi
55
 
56
 
60
 
61
 
61
     if [ -f $WIFI_NETWORKS_FILE ]; then
62
     if [ -f $WIFI_NETWORKS_FILE ]; then
62
         ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE --networks $WIFI_NETWORKS_FILE
63
         ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE --networks $WIFI_NETWORKS_FILE
63
-        echo 'setup_wifi' >> $COMPLETION_FILE
64
+        mark_completed $FUNCNAME
64
         return
65
         return
65
     fi
66
     fi
66
 
67
 
77
     else
78
     else
78
         ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE --hotspot $HOTSPOT --networks $WIFI_NETWORKS_FILE
79
         ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE --hotspot $HOTSPOT --networks $WIFI_NETWORKS_FILE
79
     fi
80
     fi
80
-    echo 'setup_wifi' >> $COMPLETION_FILE
81
+    mark_completed $FUNCNAME
81
 }
82
 }
82
 
83
 
83
 # ath9k_htc driver
84
 # ath9k_htc driver
84
 function install_atheros_wifi {
85
 function install_atheros_wifi {
85
-    if grep -Fxq "install_atheros_wifi" $COMPLETION_FILE; then
86
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
86
         return
87
         return
87
     fi
88
     fi
88
     if [ $INSTALLING_ON_BBB != "yes" ]; then
89
     if [ $INSTALLING_ON_BBB != "yes" ]; then
127
     if [ ! "$?" = "0" ]; then
128
     if [ ! "$?" = "0" ]; then
128
         exit 74681
129
         exit 74681
129
     fi
130
     fi
130
-    echo 'install_atheros_wifi' >> $COMPLETION_FILE
131
+    mark_completed $FUNCNAME
131
 }
132
 }
132
 
133
 
133
 # NOTE: deliberately no exit 0
134
 # NOTE: deliberately no exit 0

+ 9
- 9
src/freedombone-utils-zram Datei anzeigen

29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
 
30
 
31
 function enable_zram {
31
 function enable_zram {
32
-	if grep -Fxq "enable_zram" $COMPLETION_FILE; then
33
-		return
34
-	fi
32
+    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
33
+        return
34
+    fi
35
 
35
 
36
-	if [[ $INSTALLED_WITHIN_DOCKER == "yes" || $INSTALLING_ON_BBB != "yes" ]]; then
37
-		${PROJECT_NAME}-zram off
38
-		return
39
-	fi
36
+    if [[ $INSTALLED_WITHIN_DOCKER == "yes" || $INSTALLING_ON_BBB != "yes" ]]; then
37
+        ${PROJECT_NAME}-zram off
38
+        return
39
+    fi
40
 
40
 
41
-	${PROJECT_NAME}-zram on
41
+    ${PROJECT_NAME}-zram on
42
 
42
 
43
-	echo 'enable_zram' >> $COMPLETION_FILE
43
+    mark_completed $FUNCNAME
44
 }
44
 }
45
 
45
 
46
 # NOTE: deliberately no exit 0
46
 # NOTE: deliberately no exit 0