|
@@ -302,175 +302,6 @@ function configure_zeronet_forum {
|
302
|
302
|
echo $'Update of ZeroNet Forum completed' >> $INSTALL_LOG
|
303
|
303
|
}
|
304
|
304
|
|
305
|
|
-function compile_toxcore {
|
306
|
|
- echo $'Compiling toxcore' >> $INSTALL_LOG
|
307
|
|
- if [ ! -d $INSTALL_DIR/toxcore ]; then
|
308
|
|
- echo $"$INSTALL_DIR/toxcore not found" >> $INSTALL_LOG
|
309
|
|
- exit 63856
|
310
|
|
- fi
|
311
|
|
- cd $INSTALL_DIR/toxcore
|
312
|
|
- SECONDS=0
|
313
|
|
- if [ -f $INSTALL_DIR/configure_toxcore.txt ]; then
|
314
|
|
- rm $INSTALL_DIR/configure_toxcore.txt
|
315
|
|
- fi
|
316
|
|
- if [ -f $INSTALL_DIR/make_toxcore.txt ]; then
|
317
|
|
- rm $INSTALL_DIR/make_toxcore.txt
|
318
|
|
- fi
|
319
|
|
- aclocal
|
320
|
|
- autoreconf -vfi
|
321
|
|
- ./configure --enable-daemon --disable-av > $INSTALL_DIR/configure_toxcore.txt
|
322
|
|
- make clean
|
323
|
|
- make -k > $INSTALL_DIR/make_toxcore.txt
|
324
|
|
- if [ ! "$?" = "0" ]; then
|
325
|
|
- duration=$SECONDS
|
326
|
|
- echo $"Toxcore compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." >> $INSTALL_LOG
|
327
|
|
- echo $'Unable to make toxcore' >> $INSTALL_LOG
|
328
|
|
- echo $'See $INSTALL_DIR/make_toxcore.txt' >> $INSTALL_LOG
|
329
|
|
- exit 73835
|
330
|
|
- fi
|
331
|
|
- rm $INSTALL_DIR/configure_toxcore.txt
|
332
|
|
- rm $INSTALL_DIR/make_toxcore.txt
|
333
|
|
- make install
|
334
|
|
- duration=$SECONDS
|
335
|
|
- echo $"Toxcore compile $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." >> $INSTALL_LOG
|
336
|
|
- cp /usr/local/lib/libtoxcore* /usr/lib/
|
337
|
|
-
|
338
|
|
- if [ ! -f /usr/local/bin/tox-bootstrapd ]; then
|
339
|
|
- echo $"File not found /usr/local/bin/tox-bootstrapd" >> $INSTALL_LOG
|
340
|
|
- exit 37825
|
341
|
|
- fi
|
342
|
|
-
|
343
|
|
- useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment $"Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
|
344
|
|
- chmod 700 /var/lib/tox-bootstrapd
|
345
|
|
- if [ ! -f $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf ]; then
|
346
|
|
- echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf" >> $INSTALL_LOG
|
347
|
|
- fi
|
348
|
|
- # remove Maildir
|
349
|
|
- if [ -d /var/lib/tox-bootstrapd/Maildir ]; then
|
350
|
|
- rm -rf /var/lib/tox-bootstrapd/Maildir
|
351
|
|
- fi
|
352
|
|
-
|
353
|
|
- # create configuration file
|
354
|
|
- TOX_BOOTSTRAP_CONFIG=/etc/tox-bootstrapd.conf
|
355
|
|
- echo "port = $TOX_PORT" > $TOX_BOOTSTRAP_CONFIG
|
356
|
|
- echo 'keys_file_path = "/var/lib/tox-bootstrapd/keys"' >> $TOX_BOOTSTRAP_CONFIG
|
357
|
|
- echo 'pid_file_path = "/var/run/tox-bootstrapd/tox-bootstrapd.pid"' >> $TOX_BOOTSTRAP_CONFIG
|
358
|
|
- echo 'enable_ipv6 = true' >> $TOX_BOOTSTRAP_CONFIG
|
359
|
|
- echo 'enable_ipv4_fallback = true' >> $TOX_BOOTSTRAP_CONFIG
|
360
|
|
- echo 'enable_lan_discovery = true' >> $TOX_BOOTSTRAP_CONFIG
|
361
|
|
- echo 'enable_tcp_relay = true' >> $TOX_BOOTSTRAP_CONFIG
|
362
|
|
- echo "tcp_relay_ports = [443, 3389, $TOX_PORT]" >> $TOX_BOOTSTRAP_CONFIG
|
363
|
|
- echo 'enable_motd = true' >> $TOX_BOOTSTRAP_CONFIG
|
364
|
|
- echo 'motd = "tox-bootstrapd"' >> $TOX_BOOTSTRAP_CONFIG
|
365
|
|
-
|
366
|
|
- if [ $TOX_NODES ]; then
|
367
|
|
- echo 'bootstrap_nodes = (' >> $TOX_BOOTSTRAP_CONFIG
|
368
|
|
- toxcount=0
|
369
|
|
- while [ "x${TOX_NODES[toxcount]}" != "x" ]
|
370
|
|
- do
|
371
|
|
- toxval_ipv4=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $1}')
|
372
|
|
- toxval_ipv6=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $2}')
|
373
|
|
- toxval_port=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $3}')
|
374
|
|
- toxval_pubkey=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $4}')
|
375
|
|
- toxval_maintainer=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $5}')
|
376
|
|
- echo "{ // $toxval_maintainer" >> $TOX_BOOTSTRAP_CONFIG
|
377
|
|
- if [[ $toxval_ipv6 != 'NONE' ]]; then
|
378
|
|
- echo " address = \"$toxval_ipv6\"" >> $TOX_BOOTSTRAP_CONFIG
|
379
|
|
- else
|
380
|
|
- echo " address = \"$toxval_ipv4\"" >> $TOX_BOOTSTRAP_CONFIG
|
381
|
|
- fi
|
382
|
|
- echo " port = $toxval_port" >> $TOX_BOOTSTRAP_CONFIG
|
383
|
|
- echo " public_key = \"$toxval_pubkey\"" >> $TOX_BOOTSTRAP_CONFIG
|
384
|
|
- toxcount=$(( $toxcount + 1 ))
|
385
|
|
- if [ "x${TOX_NODES[toxcount]}" != "x" ]; then
|
386
|
|
- echo "}," >> $TOX_BOOTSTRAP_CONFIG
|
387
|
|
- else
|
388
|
|
- echo "}" >> $TOX_BOOTSTRAP_CONFIG
|
389
|
|
- fi
|
390
|
|
- done
|
391
|
|
- echo ')' >> $TOX_BOOTSTRAP_CONFIG
|
392
|
|
- fi
|
393
|
|
-
|
394
|
|
- if [ ! -f $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service ]; then
|
395
|
|
- echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service" >> $INSTALL_LOG
|
396
|
|
- return
|
397
|
|
- fi
|
398
|
|
- cp $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service /etc/systemd/system/
|
399
|
|
- sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' /etc/systemd/system/tox-bootstrapd.service
|
400
|
|
-
|
401
|
|
- systemctl daemon-reload
|
402
|
|
- systemctl enable tox-bootstrapd.service
|
403
|
|
- echo $'toxcore compile completed' >> $INSTALL_LOG
|
404
|
|
-}
|
405
|
|
-
|
406
|
|
-function compile_toxid {
|
407
|
|
- if [ ! -d $INSTALL_DIR/toxid ]; then
|
408
|
|
- echo $'toxid repo not found' >> $INSTALL_LOG
|
409
|
|
- exit 52682
|
410
|
|
- fi
|
411
|
|
- cd $INSTALL_DIR/toxid
|
412
|
|
- if [ -f $INSTALL_DIR/make_toxid.txt ]; then
|
413
|
|
- rm $INSTALL_DIR/make_toxid.txt
|
414
|
|
- fi
|
415
|
|
- make > $INSTALL_DIR/make_toxid.txt
|
416
|
|
- if [ ! "$?" = "0" ]; then
|
417
|
|
- echo $'Failed to compile toxid' >> $INSTALL_LOG
|
418
|
|
- echo $"See $INSTALL_DIR/make_toxid.txt" >> $INSTALL_LOG
|
419
|
|
- exit 58432
|
420
|
|
- fi
|
421
|
|
- rm $INSTALL_DIR/make_toxid.txt
|
422
|
|
- make install
|
423
|
|
-
|
424
|
|
- toxavahi
|
425
|
|
-
|
426
|
|
- # publish regularly
|
427
|
|
- if ! grep -q "toxavahi" /etc/crontab; then
|
428
|
|
- echo "* * * * * root toxavahi > /dev/null" >> /etc/crontab
|
429
|
|
- fi
|
430
|
|
-
|
431
|
|
- systemctl restart avahi-daemon
|
432
|
|
-}
|
433
|
|
-
|
434
|
|
-function compile_tox_client {
|
435
|
|
- echo $'Compiling tox client' >> $INSTALL_LOG
|
436
|
|
-
|
437
|
|
- if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
438
|
|
- TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
|
439
|
|
- else
|
440
|
|
- TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
|
441
|
|
- fi
|
442
|
|
-
|
443
|
|
- if [ ! -d $INSTALL_DIR/toxic ]; then
|
444
|
|
- echo $"$INSTALL_DIR/toxic not found" >> $INSTALL_LOG
|
445
|
|
- exit 347835
|
446
|
|
- fi
|
447
|
|
-
|
448
|
|
- cd $INSTALL_DIR/toxic
|
449
|
|
- if [ -f $INSTALL_DIR/make_toxic.txt ]; then
|
450
|
|
- rm $INSTALL_DIR/make_toxic.txt
|
451
|
|
- fi
|
452
|
|
- SECONDS=0
|
453
|
|
- make clean
|
454
|
|
- make -k > $INSTALL_DIR/make_toxic.txt
|
455
|
|
- if [ ! -f $INSTALL_DIR/toxic/build/toxic ]; then
|
456
|
|
- duration=$SECONDS
|
457
|
|
- echo $"Toxic client compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." >> $INSTALL_LOG
|
458
|
|
- echo $'Unable to make tox client' >> $INSTALL_LOG
|
459
|
|
- echo $"See $INSTALL_DIR/make_toxic.txt" >> $INSTALL_LOG
|
460
|
|
- exit 74872
|
461
|
|
- fi
|
462
|
|
- rm $INSTALL_DIR/make_toxic.txt
|
463
|
|
- make install
|
464
|
|
- if [ ! -f $TOXIC_FILE ]; then
|
465
|
|
- echo $"Tox client was not installed to $TOXIC_FILE" >> $INSTALL_LOG
|
466
|
|
- exit 63278
|
467
|
|
- fi
|
468
|
|
- duration=$SECONDS
|
469
|
|
- echo $"Toxic client compile $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." >> $INSTALL_LOG
|
470
|
|
-
|
471
|
|
- echo $'toxic client compile completed' >> $INSTALL_LOG
|
472
|
|
-}
|
473
|
|
-
|
474
|
305
|
function configure_toxcore {
|
475
|
306
|
echo $'Configuring toxcore' >> $INSTALL_LOG
|
476
|
307
|
|
|
@@ -547,9 +378,6 @@ if [ -f /root/.initial_mesh_setup ]; then
|
547
|
378
|
configure_zeronet_blog
|
548
|
379
|
configure_zeronet_mail
|
549
|
380
|
configure_zeronet_forum
|
550
|
|
- #compile_toxcore
|
551
|
|
- #compile_toxid
|
552
|
|
- #compile_tox_client
|
553
|
381
|
configure_toxcore
|
554
|
382
|
configure_zeronet
|
555
|
383
|
disable_password_logins
|