瀏覽代碼

Compile toxid on mesh nodes

Bob Mottram 9 年之前
父節點
當前提交
68b0ae84a8
共有 2 個文件被更改,包括 57 次插入13 次删除
  1. 28
    13
      src/freedombone-image-customise
  2. 29
    0
      src/freedombone-image-mesh

+ 28
- 13
src/freedombone-image-customise 查看文件

597
 	fi
597
 	fi
598
 
598
 
599
 	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
599
 	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
600
-		TOXID_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
601
-	else
602
-		TOXID_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
603
-	fi
604
-	if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then
605
-		TOXID_REPO=$TOXID_REPO_MAIN
606
-	fi
607
-	if [ ! $TOXID_REPO ]; then
608
-		echo $'No ToxID repo was specified'
609
-		exit 78252
610
-	fi
611
-
612
-	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
613
 		TOX_PORT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}')
600
 		TOX_PORT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}')
614
 	else
601
 	else
615
 		TOX_PORT_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}')
602
 		TOX_PORT_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}')
658
 	fi
645
 	fi
659
 }
646
 }
660
 
647
 
648
+function mesh_tox_avahi {
649
+	if [ ! -d $rootdir/etc/avahi ]; then
650
+		echo $'tox_avahi: avahi is not installed'
651
+		exit 87359
652
+	fi
653
+
654
+	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
655
+		TOXID_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
656
+	else
657
+		TOXID_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
658
+	fi
659
+	if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then
660
+		TOXID_REPO=$TOXID_REPO_MAIN
661
+	fi
662
+	if [ ! $TOXID_REPO ]; then
663
+		echo $'No ToxID repo was specified'
664
+		exit 78252
665
+	fi
666
+	
667
+	# install a command to obtain the Tox ID
668
+	chroot "$rootdir" $INSTALL_DIR
669
+	chroot "$rootdir" git clone $TOXID_REPO $INSTALL_DIR/toxid
670
+	if [ ! -d $rootdir$INSTALL_DIR/toxid ]; then
671
+		exit 63921
672
+	fi
673
+}
674
+
661
 function mesh_tox_client {
675
 function mesh_tox_client {
662
 	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
676
 	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
663
 		TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
677
 		TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
822
 	mesh_avahi
836
 	mesh_avahi
823
 	mesh_batman
837
 	mesh_batman
824
 	mesh_tox_node
838
 	mesh_tox_node
839
+	mesh_tox_avahi
825
 	mesh_tox_client
840
 	mesh_tox_client
826
 	mesh_zeronet
841
 	mesh_zeronet
827
 
842
 

+ 29
- 0
src/freedombone-image-mesh 查看文件

386
 	echo $'toxcore compile completed' >> $INSTALL_LOG
386
 	echo $'toxcore compile completed' >> $INSTALL_LOG
387
 }
387
 }
388
 
388
 
389
+function compile_toxid {
390
+	if [ ! -d $INSTALL_DIR/toxid ]; then
391
+		echo $'toxid repo not found' >> $INSTALL_LOG
392
+		exit 52682
393
+	fi
394
+	cd $INSTALL_DIR/toxid
395
+	if [ -f $INSTALL_DIR/make_toxid.txt ]; then
396
+		rm $INSTALL_DIR/make_toxid.txt
397
+	fi
398
+	make > $INSTALL_DIR/make_toxid.txt
399
+	if [ ! "$?" = "0" ]; then
400
+		echo $'Failed to compile toxid' >> $INSTALL_LOG
401
+		echo $"See $INSTALL_DIR/make_toxid.txt" >> $INSTALL_LOG
402
+		exit 58432
403
+	fi
404
+	rm $INSTALL_DIR/make_toxid.txt
405
+	make install
406
+
407
+	toxavahi
408
+
409
+	# publish regularly
410
+	if ! grep -q "toxavahi" /etc/crontab; then
411
+		echo "* *     * * *   root    toxavahi > /dev/null" >> /etc/crontab
412
+	fi
413
+
414
+	systemctl restart avahi-daemon
415
+}
416
+
389
 function compile_tox_client {
417
 function compile_tox_client {
390
 	echo $'Compiling tox client' >> $INSTALL_LOG
418
 	echo $'Compiling tox client' >> $INSTALL_LOG
391
 
419
 
479
 	configure_zeronet_mail
507
 	configure_zeronet_mail
480
 	configure_zeronet_forum
508
 	configure_zeronet_forum
481
 	compile_toxcore
509
 	compile_toxcore
510
+	compile_toxid
482
 	compile_tox_client
511
 	compile_tox_client
483
 	configure_toxcore
512
 	configure_toxcore
484
 	configure_zeronet
513
 	configure_zeronet