Ver código fonte

Merge branch 'stretch' of https://github.com/bashrc/freedombone

Bob Mottram 7 anos atrás
pai
commit
9605ba0a48

+ 438
- 0
src/freedombone-app-fedwiki Ver arquivo

@@ -0,0 +1,438 @@
1
+#!/bin/bash
2
+#
3
+# .---.                  .              .
4
+# |                      |              |
5
+# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
+# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
+# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
+#
9
+#                    Freedom in the Cloud
10
+#
11
+# Federated wiki
12
+#
13
+# License
14
+# =======
15
+#
16
+# Copyright (C) 2017 Bob Mottram <bob@freedombone.net>
17
+#
18
+# This program is free software: you can redistribute it and/or modify
19
+# it under the terms of the GNU Affero General Public License as published by
20
+# the Free Software Foundation, either version 3 of the License, or
21
+# (at your option) any later version.
22
+#
23
+# This program is distributed in the hope that it will be useful,
24
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
+# GNU Affero General Public License for more details.
27
+#
28
+# You should have received a copy of the GNU Affero General Public License
29
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
+
31
+VARIANTS="full full-vim media"
32
+
33
+IN_DEFAULT_INSTALL=0
34
+SHOW_ON_ABOUT=1
35
+
36
+FEDWIKI_DOMAIN_NAME=
37
+FEDWIKI_CODE=
38
+FEDWIKI_VERSION='0.13.0'
39
+FEDWIKI_ONION_PORT=8131
40
+FEDWIKI_PORT=3053
41
+FEDWIKI_DATA=/var/lib/fedwiki
42
+
43
+fedwiki_variables=(FEDWIKI_DOMAIN_NAME
44
+                   FEDWIKI_CODE
45
+                   FEDWIKI_ADMIN_PASSWORD
46
+                   ONION_ONLY
47
+                   DDNS_PROVIDER
48
+                   MY_USERNAME
49
+                   MY_EMAIL_ADDRESS)
50
+
51
+function fedwiki_remove_bad_links {
52
+    if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js ]; then
53
+        sed -i 's|maxcdn.bootstrapcdn.com|localhost|g' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
54
+    fi
55
+
56
+    if [ -f /usr/local/lib/node_modules/wiki/node_modules/localforage/docs/theme/style.css ]; then
57
+        sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/localforage/docs/theme/style.css
58
+    fi
59
+
60
+    if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/addAlternativeDialog.html ]; then
61
+        sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/addAlternativeDialog.html
62
+    fi
63
+
64
+    if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/done.html ]; then
65
+        sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/done.html
66
+    fi
67
+
68
+    if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/personaDialog.html ]; then
69
+        sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/personaDialog.html
70
+    fi
71
+
72
+    if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/securityDialog.html ]; then
73
+        sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/securityDialog.html
74
+    fi
75
+
76
+    if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-google-oauth20 ]; then
77
+        rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-google-oauth20
78
+    fi
79
+
80
+    if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2 ]; then
81
+        rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2
82
+    fi
83
+}
84
+
85
+function logging_on_fedwiki {
86
+    echo -n ''
87
+}
88
+
89
+function logging_off_fedwiki {
90
+    echo -n ''
91
+}
92
+
93
+function remove_user_fedwiki {
94
+    remove_username="$1"
95
+}
96
+
97
+function add_user_fedwiki {
98
+    if [[ $(app_is_installed fedwiki) == "0" ]]; then
99
+        echo '0'
100
+        return
101
+    fi
102
+
103
+    new_username="$1"
104
+    new_user_password="$2"
105
+
106
+    echo '0'
107
+}
108
+
109
+function install_interactive_fedwiki {
110
+    if [ ! $ONION_ONLY ]; then
111
+        ONION_ONLY='no'
112
+    fi
113
+
114
+    if [[ $ONION_ONLY != "no" ]]; then
115
+        FEDWIKI_DOMAIN_NAME='fedwiki.local'
116
+        write_config_param "FEDWIKI_DOMAIN_NAME" "$FEDWIKI_DOMAIN_NAME"
117
+    else
118
+        function_check interactive_site_details
119
+        interactive_site_details "fedwiki" "FEDWIKI_DOMAIN_NAME" "FEDWIKI_CODE"
120
+    fi
121
+    APP_INSTALLED=1
122
+}
123
+
124
+function change_password_fedwiki {
125
+    FEDWIKI_USERNAME="$1"
126
+    FEDWIKI_PASSWORD="$2"
127
+    if [ ${#FEDWIKI_PASSWORD} -lt 8 ]; then
128
+        echo $'Fedwiki password is too short'
129
+        return
130
+    fi
131
+    #${PROJECT_NAME}-pass -u $FEDWIKI_USERNAME -a fedwiki -p "$FEDWIKI_PASSWORD"
132
+}
133
+
134
+function reconfigure_fedwiki {
135
+    echo -n ''
136
+}
137
+
138
+function upgrade_fedwiki {
139
+    CURR_FEDWIKI_VERSION=$(get_completion_param "fedwiki version")
140
+    if [[ "$CURR_FEDWIKI_VERSION" == "$FEDWIKI_VERSION" ]]; then
141
+        return
142
+    fi
143
+
144
+    systemctl stop fedwiki
145
+    npm upgrade -g wiki@$FEDWIKI_VERSION
146
+    fedwiki_remove_bad_links
147
+    chown -R fedwiki:fedwiki $FEDWIKI_DATA
148
+    systemctl start fedwiki
149
+
150
+    set_completion_param "fedwiki version" "$FEDWIKI_VERSION"
151
+}
152
+
153
+function backup_local_fedwiki {
154
+    FEDWIKI_DOMAIN_NAME='fedwiki.local'
155
+    if grep -q "fedwiki domain" $COMPLETION_FILE; then
156
+        FEDWIKI_DOMAIN_NAME=$(get_completion_param "fedwiki domain")
157
+    fi
158
+
159
+    systemctl stop fedwiki
160
+    suspend_site ${FEDWIKI_DOMAIN_NAME}
161
+
162
+    fedwiki_path=$FEDWIKI_DATA
163
+    if [ -d $fedwiki_path ]; then
164
+        backup_directory_to_usb $fedwiki_path fedwiki
165
+    fi
166
+
167
+    restart_site
168
+    systemctl start fedwiki
169
+}
170
+
171
+function restore_local_fedwiki {
172
+    FEDWIKI_DOMAIN_NAME='fedwiki.local'
173
+    if grep -q "fedwiki domain" $COMPLETION_FILE; then
174
+        FEDWIKI_DOMAIN_NAME=$(get_completion_param "fedwiki domain")
175
+    fi
176
+    if [ $FEDWIKI_DOMAIN_NAME ]; then
177
+        suspend_site ${FEDWIKI_DOMAIN_NAME}
178
+        systemctl stop fedwiki
179
+
180
+        temp_restore_dir=/root/tempfedwiki
181
+        function_check restore_directory_from_usb
182
+        restore_directory_from_usb $temp_restore_dir fedwiki
183
+        if [ -d $temp_restore_dir ]; then
184
+            if [ -d $temp_restore_dir$FEDWIKI_DATA ]; then
185
+                cp -r $temp_restore_dir$FEDWIKI_DATA/* $FEDWIKI_DATA/
186
+            else
187
+                cp -r $temp_restore_dir/* $FEDWIKI_DATA/
188
+            fi
189
+            chown -R fedwiki:fedwiki $FEDWIKI_DATA
190
+            rm -rf $temp_restore_dir
191
+        fi
192
+
193
+        systemctl start fedwiki
194
+        restart_site
195
+    fi
196
+}
197
+
198
+function backup_remote_fedwiki {
199
+    FEDWIKI_DOMAIN_NAME='fedwiki.local'
200
+    if grep -q "fedwiki domain" $COMPLETION_FILE; then
201
+        FEDWIKI_DOMAIN_NAME=$(get_completion_param "fedwiki domain")
202
+    fi
203
+
204
+    systemctl stop fedwiki
205
+    suspend_site ${FEDWIKI_DOMAIN_NAME}
206
+
207
+    temp_backup_dir=$FEDWIKI_DATA
208
+    if [ -d $temp_backup_dir ]; then
209
+        backup_directory_to_friend $temp_backup_dir fedwiki
210
+    else
211
+        echo $"Fedwiki domain specified but not found in $temp_backup_dir"
212
+        exit 63542852
213
+    fi
214
+
215
+    restart_site
216
+    systemctl start fedwiki
217
+}
218
+
219
+function restore_remote_fedwiki {
220
+    FEDWIKI_DOMAIN_NAME='fedwiki.local'
221
+    if grep -q "fedwiki domain" $COMPLETION_FILE; then
222
+        FEDWIKI_DOMAIN_NAME=$(get_completion_param "fedwiki domain")
223
+    fi
224
+
225
+    systemctl stop fedwiki
226
+    suspend_site ${FEDWIKI_DOMAIN_NAME}
227
+
228
+    temp_restore_dir=/root/tempfedwiki
229
+    function_check restore_directory_from_friend
230
+    restore_directory_from_friend $temp_restore_dir fedwiki
231
+    if [ -d $temp_restore_dir ]; then
232
+        if [ -d $temp_restore_dir$FEDWIKI_DATA ]; then
233
+            cp -r $temp_restore_dir$FEDWIKI_DATA/* $FEDWIKI_DATA/
234
+        else
235
+            cp -r $temp_restore_dir/* $FEDWIKI_DATA/
236
+        fi
237
+        chown -R fedwiki: $FEDWIKI_DATA
238
+        rm -rf $temp_restore_dir
239
+    fi
240
+
241
+    systemctl start fedwiki
242
+    restart_site
243
+}
244
+
245
+function remove_fedwiki {
246
+    if [ ${#FEDWIKI_DOMAIN_NAME} -eq 0 ]; then
247
+        return
248
+    fi
249
+
250
+    systemctl stop fedwiki
251
+    systemctl disable fedwiki
252
+    rm /etc/systemd/system/fedwiki.service
253
+    systemctl daemon-reload
254
+
255
+    npm uninstall -g wiki
256
+
257
+    function_check remove_nodejs
258
+    remove_nodejs fedwiki
259
+
260
+    read_config_param "FEDWIKI_DOMAIN_NAME"
261
+    nginx_dissite $FEDWIKI_DOMAIN_NAME
262
+    remove_certs ${FEDWIKI_DOMAIN_NAME}
263
+    if [ -f /etc/nginx/sites-available/$FEDWIKI_DOMAIN_NAME ]; then
264
+        rm -f /etc/nginx/sites-available/$FEDWIKI_DOMAIN_NAME
265
+    fi
266
+    if [ -d /var/www/$FEDWIKI_DOMAIN_NAME ]; then
267
+        rm -rf /var/www/$FEDWIKI_DOMAIN_NAME
268
+    fi
269
+    remove_config_param FEDWIKI_DOMAIN_NAME
270
+    remove_config_param FEDWIKI_CODE
271
+    function_check remove_onion_service
272
+    remove_onion_service fedwiki ${FEDWIKI_ONION_PORT}
273
+    remove_completion_param "install_fedwiki"
274
+    sed -i '/fedwiki/d' $COMPLETION_FILE
275
+
276
+    groupdel -f fedwiki
277
+    userdel -r fedwiki
278
+
279
+    if [ -d $FEDWIKI_DATA ]; then
280
+        rm -rf $FEDWIKI_DATA
281
+    fi
282
+
283
+    function_check remove_ddns_domain
284
+    remove_ddns_domain $FEDWIKI_DOMAIN_NAME
285
+}
286
+
287
+function fedwiki_setup_web {
288
+    fedwiki_nginx_file=/etc/nginx/sites-available/$FEDWIKI_DOMAIN_NAME
289
+
290
+    if [[ $ONION_ONLY == "no" ]]; then
291
+        echo 'server {' > $fedwiki_nginx_file
292
+        echo '  listen 80;' >> $fedwiki_nginx_file
293
+        echo '  listen [::]:80;' >> $fedwiki_nginx_file
294
+        echo "  server_name $FEDWIKI_DOMAIN_NAME;" >> $fedwiki_nginx_file
295
+        echo '  rewrite ^ https://$server_name$request_uri? permanent;' >> $fedwiki_nginx_file
296
+        echo '}' >> $fedwiki_nginx_file
297
+        echo '' >> $fedwiki_nginx_file
298
+        echo 'server {' >> $fedwiki_nginx_file
299
+        echo '  listen 443 ssl;' >> $fedwiki_nginx_file
300
+        echo '  listen [::]:443 ssl;' >> $fedwiki_nginx_file
301
+        echo "  server_name $FEDWIKI_DOMAIN_NAME;" >> $fedwiki_nginx_file
302
+        echo '' >> $fedwiki_nginx_file
303
+        function_check nginx_ssl
304
+        nginx_ssl $FEDWIKI_DOMAIN_NAME mobile
305
+
306
+        echo '  add_header X-Robots-Tag none;' >> $fedwiki_nginx_file
307
+        echo '  add_header X-Download-Options noopen;' >> $fedwiki_nginx_file
308
+        echo '  add_header X-Frame-Options DENY;' >> $fedwiki_nginx_file
309
+        echo '  add_header X-Content-Type-Options nosniff;' >> $fedwiki_nginx_file
310
+        echo '  add_header Strict-Transport-Security max-age=15768000;' >> $fedwiki_nginx_file
311
+        echo '' >> $fedwiki_nginx_file
312
+        echo '  location / {' >> $fedwiki_nginx_file
313
+        echo "    proxy_pass http://localhost:${FEDWIKI_PORT};" >> $fedwiki_nginx_file
314
+        echo '    proxy_set_header X-Real-IP $remote_addr;' >> $fedwiki_nginx_file
315
+        echo '    proxy_set_header Host $host;' >> $fedwiki_nginx_file
316
+        echo '    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $fedwiki_nginx_file
317
+        echo '    client_max_body_size 1M;' >> $fedwiki_nginx_file
318
+        echo '  }' >> $fedwiki_nginx_file
319
+        echo '}' >> $fedwiki_nginx_file
320
+        echo '' >> $fedwiki_nginx_file
321
+    else
322
+        echo -n '' > $fedwiki_nginx_file
323
+    fi
324
+    echo 'server {' >> $fedwiki_nginx_file
325
+    echo "  listen 127.0.0.1:$FEDWIKI_ONION_PORT default_server;" >> $fedwiki_nginx_file
326
+    echo "  server_name $FEDWIKI_ONION_HOSTNAME;" >> $fedwiki_nginx_file
327
+    echo '' >> $fedwiki_nginx_file
328
+    echo '  add_header X-Robots-Tag none;' >> $fedwiki_nginx_file
329
+    echo '  add_header X-Download-Options noopen;' >> $fedwiki_nginx_file
330
+    echo '  add_header X-Frame-Options DENY;' >> $fedwiki_nginx_file
331
+    echo '  add_header X-Content-Type-Options nosniff;' >> $fedwiki_nginx_file
332
+    echo '' >> $fedwiki_nginx_file
333
+    echo '  location / {' >> $fedwiki_nginx_file
334
+    echo "    proxy_pass http://localhost:${FEDWIKI_PORT};" >> $fedwiki_nginx_file
335
+    echo '    proxy_set_header X-Real-IP $remote_addr;' >> $fedwiki_nginx_file
336
+    echo '    proxy_set_header Host $host;' >> $fedwiki_nginx_file
337
+    echo '    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $fedwiki_nginx_file
338
+    echo '    client_max_body_size 1M;' >> $fedwiki_nginx_file
339
+    echo '  }' >> $fedwiki_nginx_file
340
+    echo '}' >> $fedwiki_nginx_file
341
+
342
+    function_check create_site_certificate
343
+    create_site_certificate $FEDWIKI_DOMAIN_NAME 'yes'
344
+
345
+    function_check nginx_ensite
346
+    nginx_ensite $FEDWIKI_DOMAIN_NAME
347
+}
348
+
349
+function install_fedwiki {
350
+    if [[ $VARIANT == "mesh"* ]]; then
351
+        return
352
+    fi
353
+
354
+    if [ ! $ONION_ONLY ]; then
355
+        ONION_ONLY='no'
356
+    fi
357
+
358
+    if [ ! $FEDWIKI_DOMAIN_NAME ]; then
359
+        echo $'The fedwiki domain name was not specified'
360
+        exit 893635
361
+    fi
362
+
363
+    if [ ! -d /var/www/$FEDWIKI_DOMAIN_NAME/htdocs ]; then
364
+        mkdir -p /var/www/$FEDWIKI_DOMAIN_NAME/htdocs
365
+    fi
366
+
367
+    if [ ! -d $FEDWIKI_DATA ]; then
368
+        mkdir -p $FEDWIKI_DATA
369
+    fi
370
+
371
+    groupadd fedwiki
372
+    useradd -c "Fedwiki system account" -d $FEDWIKI_DATA -m -r -g fedwiki fedwiki
373
+    if [ -d $FEDWIKI_DATA/Maildir ]; then
374
+        rm -rf $FEDWIKI_DATA/Maildir
375
+    fi
376
+
377
+    function_check install_nodejs
378
+    install_nodejs fedwiki
379
+
380
+    npm install -g wiki@$FEDWIKI_VERSION
381
+    if [ ! "$?" = "0" ]; then
382
+        echo $'Failed to install fedwiki'
383
+        exit 6293523
384
+    fi
385
+
386
+    if [ ! -f /usr/local/bin/wiki ]; then
387
+        echo $'wiki was not installed'
388
+        exit 5293524
389
+    fi
390
+
391
+    if [ ! -d /usr/local/lib/node_modules/wiki ]; then
392
+        echo $'wiki directory not found /usr/local/lib/node_modules/wiki'
393
+        exit 6285324
394
+    fi
395
+
396
+    FEDWIKI_ONION_HOSTNAME=$(add_onion_service fedwiki 80 ${FEDWIKI_ONION_PORT})
397
+
398
+    echo '[Unit]' > /etc/systemd/system/fedwiki.service
399
+    echo 'Description=Fedwiki Decentralized video streaming platform' >> /etc/systemd/system/fedwiki.service
400
+    echo 'After=syslog.target' >> /etc/systemd/system/fedwiki.service
401
+    echo 'After=network.target' >> /etc/systemd/system/fedwiki.service
402
+    echo '' >> /etc/systemd/system/fedwiki.service
403
+    echo '[Service]' >> /etc/systemd/system/fedwiki.service
404
+    echo 'User=fedwiki' >> /etc/systemd/system/fedwiki.service
405
+    echo 'Group=fedwiki' >> /etc/systemd/system/fedwiki.service
406
+    echo "WorkingDirectory=/usr/local/lib/node_modules/wiki" >> /etc/systemd/system/fedwiki.service
407
+    echo "ExecStart=/usr/local/bin/wiki --data $FEDWIKI_DATA -p $FEDWIKI_PORT" >> /etc/systemd/system/fedwiki.service
408
+    echo 'StandardOutput=syslog' >> /etc/systemd/system/fedwiki.service
409
+    echo 'StandardError=syslog' >> /etc/systemd/system/fedwiki.service
410
+    echo 'SyslogIdentifier=fedwiki' >> /etc/systemd/system/fedwiki.service
411
+    echo 'Restart=always' >> /etc/systemd/system/fedwiki.service
412
+    echo "Environment=NODE_ENV=production" >> /etc/systemd/system/fedwiki.service
413
+    echo '' >> /etc/systemd/system/fedwiki.service
414
+    echo '[Install]' >> /etc/systemd/system/fedwiki.service
415
+    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/fedwiki.service
416
+
417
+    chown -R fedwiki:fedwiki $FEDWIKI_DATA
418
+
419
+    fedwiki_setup_web
420
+
421
+    ${PROJECT_NAME}-pass -u $MY_USERNAME -a fedwiki -p "$FEDWIKI_ADMIN_PASSWORD"
422
+
423
+    function_check add_ddns_domain
424
+    add_ddns_domain $FEDWIKI_DOMAIN_NAME
425
+
426
+    fedwiki_remove_bad_links
427
+
428
+    systemctl enable fedwiki
429
+    systemctl daemon-reload
430
+    systemctl start fedwiki
431
+    systemctl restart nginx
432
+
433
+    set_completion_param "fedwiki domain" "$FEDWIKI_DOMAIN_NAME"
434
+    set_completion_param "fedwiki version" "$FEDWIKI_VERSION"
435
+    APP_INSTALLED=1
436
+}
437
+
438
+# NOTE: deliberately no exit 0

+ 3
- 2
src/freedombone-app-ghost Ver arquivo

@@ -34,7 +34,7 @@ VARIANTS="full full-vim writer"
34 34
 IN_DEFAULT_INSTALL=0
35 35
 SHOW_ON_ABOUT=1
36 36
 
37
-GHOST_VERSION=1.6.2
37
+GHOST_VERSION=1.19.0
38 38
 GHOST_DOMAIN_NAME=
39 39
 GHOST_CODE=
40 40
 GHOST_ONION_PORT=8104
@@ -209,7 +209,8 @@ function upgrade_ghost {
209 209
     cd /var/www/$GHOST_DOMAIN_NAME/htdocs
210 210
 
211 211
     npm i -g ghost-cli
212
-    /usr/local/bin/ghost update
212
+    /usr/local/bin/ghost update &
213
+    sleep 200
213 214
     ghost_bust
214 215
 
215 216
     ghost_replace_services

+ 27
- 22
src/freedombone-app-scuttlebot Ver arquivo

@@ -224,8 +224,10 @@ function remove_scuttlebot {
224 224
 function git_ssb_script {
225 225
     if [[ "$1" == "mesh" ]]; then
226 226
         git_ssb_script_name=$rootdir/usr/bin/git-ssb-create
227
+        git_ssb_daemon_filename=$rootdir/etc/systemd/system/git_ssb.service
227 228
     else
228 229
         git_ssb_script_name=/usr/bin/git-ssb-create
230
+        git_ssb_daemon_filename=/etc/systemd/system/git_ssb.service
229 231
     fi
230 232
     echo '#!/bin/bash' > $git_ssb_script_name
231 233
     echo 'reponame="$1"' >> $git_ssb_script_name
@@ -239,6 +241,24 @@ function git_ssb_script {
239 241
     echo 'fi' >> $git_ssb_script_name
240 242
     echo 'exit 0' >> $git_ssb_script_name
241 243
     chmod +x $git_ssb_script_name
244
+
245
+    echo '[Unit]' > $git_ssb_daemon_filename
246
+    echo 'Description=Git SSB (SSB git web interface)' >> $git_ssb_daemon_filename
247
+    echo 'After=syslog.target' >> $git_ssb_daemon_filename
248
+    echo 'After=network.target' >> $git_ssb_daemon_filename
249
+    echo 'After=scuttlebot.target' >> $git_ssb_daemon_filename
250
+    echo '' >> $git_ssb_daemon_filename
251
+    echo '[Service]' >> $git_ssb_daemon_filename
252
+    echo 'Type=simple' >> $git_ssb_daemon_filename
253
+    echo 'User=scuttlebot' >> $git_ssb_daemon_filename
254
+    echo 'Group=scuttlebot' >> $git_ssb_daemon_filename
255
+    echo "WorkingDirectory=/etc/scuttlebot" >> $git_ssb_daemon_filename
256
+    echo "ExecStart=/usr/bin/git ssb web --public localhost:$GIT_SSB_PORT" >> $git_ssb_daemon_filename
257
+    echo 'Restart=always' >> $git_ssb_daemon_filename
258
+    echo 'Environment="USER=scuttlebot"' >> $git_ssb_daemon_filename
259
+    echo '' >> $git_ssb_daemon_filename
260
+    echo '[Install]' >> $git_ssb_daemon_filename
261
+    echo 'WantedBy=multi-user.target' >> $git_ssb_daemon_filename
242 262
 }
243 263
 
244 264
 function scuttlebot_git_setup {
@@ -336,7 +356,9 @@ function scuttlebot_git_setup {
336 356
         echo '  }' >> $git_ssb_nginx_site
337 357
         echo '}' >> $git_ssb_nginx_site
338 358
     fi
339
-    nginx_ensite git_ssb
359
+    if [[ "$1" != "mesh" ]]; then
360
+        nginx_ensite git_ssb
361
+    fi
340 362
 }
341 363
 
342 364
 function mesh_install_scuttlebot {
@@ -425,24 +447,6 @@ function install_scuttlebot {
425 447
     echo '[Install]' >> /etc/systemd/system/scuttlebot.service
426 448
     echo 'WantedBy=multi-user.target' >> /etc/systemd/system/scuttlebot.service
427 449
 
428
-    echo '[Unit]' > /etc/systemd/system/git_ssb.service
429
-    echo 'Description=Git SSB (SSB git web interface)' >> /etc/systemd/system/git_ssb.service
430
-    echo 'After=syslog.target' >> /etc/systemd/system/git_ssb.service
431
-    echo 'After=network.target' >> /etc/systemd/system/git_ssb.service
432
-    echo 'After=scuttlebot.target' >> /etc/systemd/system/git_ssb.service
433
-    echo '' >> /etc/systemd/system/git_ssb.service
434
-    echo '[Service]' >> /etc/systemd/system/git_ssb.service
435
-    echo 'Type=simple' >> /etc/systemd/system/git_ssb.service
436
-    echo 'User=scuttlebot' >> /etc/systemd/system/git_ssb.service
437
-    echo 'Group=scuttlebot' >> /etc/systemd/system/git_ssb.service
438
-    echo "WorkingDirectory=/etc/scuttlebot" >> /etc/systemd/system/git_ssb.service
439
-    echo "ExecStart=/usr/bin/git ssb web --public localhost:$GIT_SSB_PORT" >> /etc/systemd/system/git_ssb.service
440
-    echo 'Restart=always' >> /etc/systemd/system/git_ssb.service
441
-    echo 'Environment="USER=scuttlebot"' >> /etc/systemd/system/git_ssb.service
442
-    echo '' >> /etc/systemd/system/git_ssb.service
443
-    echo '[Install]' >> /etc/systemd/system/git_ssb.service
444
-    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/git_ssb.service
445
-
446 450
     chown -R scuttlebot:scuttlebot /etc/scuttlebot
447 451
 
448 452
     # files gw_name myhostname mdns4_minimal [NOTFOUND=return] dns
@@ -452,9 +456,6 @@ function install_scuttlebot {
452 456
     systemctl enable scuttlebot.service
453 457
     systemctl daemon-reload
454 458
     systemctl start scuttlebot.service
455
-    systemctl enable git_ssb.service
456
-    systemctl daemon-reload
457
-    systemctl start git_ssb.service
458 459
 
459 460
     sleep 3
460 461
 
@@ -492,6 +493,10 @@ function install_scuttlebot {
492 493
     scuttlebot_git_setup
493 494
     git_ssb_script
494 495
 
496
+    systemctl enable git_ssb.service
497
+    systemctl daemon-reload
498
+    systemctl start git_ssb.service
499
+
495 500
     function_check create_site_certificate
496 501
     create_site_certificate ${SCUTTLEBOT_DOMAIN_NAME} 'yes'
497 502
 

+ 7
- 0
src/freedombone-app-searx Ver arquivo

@@ -772,6 +772,13 @@ function create_searx_config {
772 772
     echo '    tr : Türkçe (Turkish)' >> $settings_file
773 773
     echo '    uk : українська мова (Ukrainian)' >> $settings_file
774 774
     echo '    zh : 中文 (Chinese)' >> $settings_file
775
+    echo '' >> $settings_file
776
+    echo 'doi_resolvers :' >> $settings_file
777
+    echo "    oadoi.org : 'https://oadoi.org/'" >> $settings_file
778
+    echo "    doi.org : 'https://doi.org/'" >> $settings_file
779
+    echo "    doai.io : 'http://doai.io/'" >> $settings_file
780
+    echo '' >> $settings_file
781
+    echo "default_doi_resolver : 'oadoi.org'" >> $settings_file
775 782
 }
776 783
 
777 784
 function upgrade_searx {

+ 1
- 0
src/freedombone-app-xmpp Ver arquivo

@@ -384,6 +384,7 @@ function upgrade_xmpp {
384 384
     fi
385 385
     function_check update_prosody_modules
386 386
     update_prosody_modules
387
+    xmpp_onion_addresses /etc/prosody/prosody.cfg.lua
387 388
 
388 389
     curr_prosody_filename=$(cat $COMPLETION_FILE | grep "prosody_filename" | awk -F ':' '{print $2}')
389 390
     if [[ "$curr_prosody_filename" != "$prosody_filename" ]]; then

+ 2
- 3
src/freedombone-image-customise Ver arquivo

@@ -588,8 +588,7 @@ cd /etc/patchwork
588 588
 npm install --arch=$NPM_ARCH --build-from-source
589 589
 npm install --arch=$NPM_ARCH --save-dev electron-rebuild
590 590
 ./node_modules/.bin/electron-rebuild
591
-npm install --arch=$NPM_ARCH -g git-ssb --registry=http://localhost:8043/
592
-#npm install --arch=$NPM_ARCH git-ssb
591
+npm install --arch=$NPM_ARCH git-ssb
593 592
 EOF
594 593
     chroot "$rootdir" /bin/chmod +x /usr/bin/install_patchwork
595 594
     chroot "$rootdir" /usr/bin/install_patchwork
@@ -699,11 +698,11 @@ initialise_mesh() {
699 698
     #install_tahoelafs
700 699
     #install_librevault
701 700
     install_patchwork
701
+    install_web_server
702 702
     mesh_install_scuttlebot
703 703
     #install_ferment
704 704
     install_ipfs
705 705
     install_tox
706
-    install_web_server
707 706
     install_pelican
708 707
     mesh_install_cryptpad
709 708
     #mesh_install_peertube

+ 12
- 2
src/freedombone-image-mesh Ver arquivo

@@ -872,6 +872,7 @@ function mesh_amnesic {
872 872
 function mesh_restart_daemons {
873 873
     systemctl restart avahi-daemon
874 874
     systemctl restart tox-bootstrapd
875
+    systemctl restart nginx
875 876
     echo $'Daemons restarted' >> $INSTALL_LOG
876 877
 }
877 878
 
@@ -1288,7 +1289,7 @@ function mesh_setup_vpn {
1288 1289
 function initialise_scuttlebot_pub {
1289 1290
     chown -R scuttlebot:scuttlebot /etc/scuttlebot
1290 1291
 
1291
-    systemctl enable scuttlebot.service
1292
+    systemctl enable git_ssb.service
1292 1293
     systemctl daemon-reload
1293 1294
     systemctl start scuttlebot.service
1294 1295
 
@@ -1301,7 +1302,7 @@ function initialise_scuttlebot_pub {
1301 1302
     fi
1302 1303
 
1303 1304
     echo '{' > /etc/scuttlebot/.ssb/config
1304
-    echo "  \"host\": \"${HOSTNAME}\"," >> /etc/scuttlebot/.ssb/config
1305
+    echo "  \"host\": \"$P{PEER_ID}.local\"," >> /etc/scuttlebot/.ssb/config
1305 1306
     echo "  \"port\": ${SCUTTLEBOT_PORT}," >> /etc/scuttlebot/.ssb/config
1306 1307
     echo '  "allowPrivate": true,' >> /etc/scuttlebot/.ssb/config
1307 1308
     echo '  "timeout": 30000,' >> /etc/scuttlebot/.ssb/config
@@ -1322,6 +1323,15 @@ function initialise_scuttlebot_pub {
1322 1323
     chown scuttlebot:scuttlebot /etc/scuttlebot/.ssb/config
1323 1324
     systemctl restart scuttlebot.service
1324 1325
     echo "scuttlebot pub started" >> /var/log/${PROJECT_NAME}.log
1326
+
1327
+    # git ssb site
1328
+    if [ -f /etc/nginx/sites-available/git_ssb ]; then
1329
+        sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb
1330
+        ln -s /etc/nginx/sites-available/git_ssb /etc/nginx/sites-enabled/git_ssb
1331
+        systemctl enable git_ssb.service
1332
+        systemctl start git_ssb.service
1333
+
1334
+    fi
1325 1335
 }
1326 1336
 
1327 1337
 # whether to reset the identity

+ 10
- 1
src/freedombone-mesh-batman Ver arquivo

@@ -483,7 +483,11 @@ function start {
483 483
             sed -i "s|\"host\": .*|\"host\": \"$(get_ipv4_wlan)\",|g" /etc/scuttlebot/.ssb/config
484 484
             systemctl restart scuttlebot
485 485
         else
486
-            systemctl stop scuttlebot
486
+            if [ ! -f /etc/nginx/sites-available/git_ssb ]; then
487
+                systemctl stop scuttlebot
488
+            else
489
+                systemctl restart scuttlebot
490
+            fi
487 491
         fi
488 492
     fi
489 493
 
@@ -503,6 +507,11 @@ function start {
503 507
         systemctl disable tor
504 508
     fi
505 509
 
510
+    sed -i "s|\"host\":.*|\"host\": \"${HOSTNAME}.local\",|g" /etc/scuttlebot/.ssb/config
511
+    sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb
512
+    systemctl restart scuttlebot
513
+    systemctl restart nginx
514
+
506 515
     verify
507 516
 }
508 517