Browse Source

toxcore on mesh

Bob Mottram 8 years ago
parent
commit
72a47da79a
2 changed files with 32 additions and 74 deletions
  1. 32
    70
      src/freedombone-app-tox
  2. 0
    4
      src/freedombone-image-customise

+ 32
- 70
src/freedombone-app-tox View File

@@ -331,20 +331,11 @@ function install_tox_client {
331 331
 }
332 332
 
333 333
 function mesh_tox_node {
334
-	# obtain commits from the main file
335
-	TOXCORE_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
336
-	if [ ${#TOXCORE_COMMIT_MAIN} -gt 10 ]; then
337
-		TOXCORE_COMMIT=$TOXCORE_COMMIT_MAIN
338
-	fi
339 334
 	if [ ! $TOXCORE_COMMIT ]; then
340 335
 		echo $'No Tox commit was specified'
341 336
 		exit 76325
342 337
 	fi
343 338
 
344
-	TOXCORE_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}')
345
-	if [ ${#TOXCORE_REPO_MAIN} -gt 10 ]; then
346
-		TOXCORE_REPO=$TOXCORE_REPO_MAIN
347
-	fi
348 339
 	if [ ! $TOXCORE_REPO ]; then
349 340
 		echo $'No Tox repo was specified'
350 341
 		exit 16865
@@ -355,46 +346,33 @@ function mesh_tox_node {
355 346
 	chroot "$rootdir" apt-get -y install libsodium13 libsodium-dev libcap2-bin
356 347
 	chroot "$rootdir" apt-get -y install libconfig9 libconfig-dev
357 348
 
358
-
359 349
 	TEMP_SCRIPT_NAME=fbtmp37272.sh
360 350
 	TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME
361
-	echo '#!/bin/bash' > $TEMP_SCRIPT
362
-	echo "mkdir -p $INSTALL_DIR" >> $TEMP_SCRIPT
363
-	echo "git clone $TOXCORE_REPO $INSTALL_DIR/toxcore" >> $TEMP_SCRIPT
364
-	echo "cd $INSTALL_DIR/toxcore" >> $TEMP_SCRIPT
365
-	echo "git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT" >> $TEMP_SCRIPT
366
-	echo 'autoreconf -i' >> $TEMP_SCRIPT
367
-	echo './configure --enable-daemon --disable-av' >> $TEMP_SCRIPT
368
-	echo 'make' >> $TEMP_SCRIPT
369
-	echo 'if [ ! "$?" = "0" ]; then' >> $TEMP_SCRIPT
370
-	echo '    exit 1' >> $TEMP_SCRIPT
371
-	echo 'fi' >> $TEMP_SCRIPT
372
-	echo 'make install' >> $TEMP_SCRIPT
373
-	echo 'cp /usr/local/lib/libtoxcore* /usr/lib/' >> $TEMP_SCRIPT
374
-	echo "cp $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service /etc/systemd/system/" >> $TEMP_SCRIPT
375
-	echo "sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' /etc/systemd/system/tox-bootstrapd.service" >> $TEMP_SCRIPT
376
-	echo 'systemctl enable tox-bootstrapd.service' >> $TEMP_SCRIPT
377
-	echo 'exit 0' >> $TEMP_SCRIPT
378
-	chmod +x $TEMP_SCRIPT
379
-	cp $TEMP_SCRIPT $rootdir/root/
380 351
 
381
-	SECONDS=0
382
-	chroot "$rootdir" /root/$TEMP_SCRIPT_NAME
352
+	mkdir -p ${rootdir}${INSTALL_DIR}
353
+	git clone ${TOXCORE_REPO} ${rootdir}${INSTALL_DIR}/toxcore
354
+	chroot "$rootdir" cd $INSTALL_DIR/toxcore && git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT
355
+	chroot "$rootdir" cd $INSTALL_DIR/toxcore && autoreconf -i
356
+	chroot "$rootdir" cd $INSTALL_DIR/toxcore && ./configure --enable-daemon --disable-av
357
+	chroot "$rootdir" cd $INSTALL_DIR/toxcore && make
383 358
 	if [ ! "$?" = "0" ]; then
359
+		exit 429285
360
+	fi
361
+	chroot "$rootdir" cd $INSTALL_DIR/toxcore && make install
362
+	cp $rootdir/usr/local/lib/libtoxcore* $rootdir/usr/lib/
363
+	cp ${rootdir}${INSTALL_DIR}/toxcore/other/bootstrap_daemon/tox-bootstrapd.service $rootdir/etc/systemd/system/
364
+	sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' $rootdir/etc/systemd/system/tox-bootstrapd.service
365
+	chroot "$rootdir" systemctl enable tox-bootstrapd.service
366
+
367
+	SECONDS=0
368
+	if [ ! -f $rootdir/usr/local/bin/tox-bootstrapd ]; then
384 369
 		duration=$SECONDS
385 370
 		echo $"Toxcore compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
386 371
 		echo $'Unable to make toxcore'
387
-		rm $TEMP_SCRIPT
388 372
 		exit 73835
389 373
 	fi
390 374
 	duration=$SECONDS
391 375
 	echo $"Toxcore compile $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
392
-	rm $TEMP_SCRIPT
393
-
394
-	if [ ! -f $rootdir/usr/local/bin/tox-bootstrapd ]; then
395
-		echo $"File not found /usr/local/bin/tox-bootstrapd"
396
-		exit 37825
397
-	fi
398 376
 
399 377
 	chroot "$rootdir" 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
400 378
 	chroot "$rootdir" chmod 700 /var/lib/tox-bootstrapd
@@ -452,46 +430,30 @@ function mesh_tox_avahi {
452 430
 		exit 87359
453 431
 	fi
454 432
 
455
-	TOXID_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
456
-	if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then
457
-		TOXID_REPO=$TOXID_REPO_MAIN
458
-	fi
459 433
 	if [ ! $TOXID_REPO ]; then
460 434
 		echo $'No ToxID repo was specified'
461 435
 		exit 78252
462 436
 	fi
463 437
 
464
-	TEMP_SCRIPT_NAME=fbtmp5328252.sh
465
-	TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME
466
-	echo '#!/bin/bash' > $TEMP_SCRIPT
467
-	echo "mkdir -p $INSTALL_DIR" >> $TEMP_SCRIPT
468
-	echo "git clone $TOXID_REPO $INSTALL_DIR/toxid" >> $TEMP_SCRIPT
469
-	echo "if [ ! -d $INSTALL_DIR/toxid ]; then" >> $TEMP_SCRIPT
470
-	echo '    exit 1' >> $TEMP_SCRIPT
471
-	echo 'fi' >> $TEMP_SCRIPT
472
-	echo "cd $INSTALL_DIR/toxid" >> $TEMP_SCRIPT
473
-	echo "make" >> $TEMP_SCRIPT
474
-	echo 'if [ ! "$?" = "0" ]; then' >> $TEMP_SCRIPT
475
-	echo '    exit 2' >> $TEMP_SCRIPT
476
-	echo 'fi' >> $TEMP_SCRIPT
477
-	echo 'make install' >> $TEMP_SCRIPT
478
-	echo 'if [ ! -f /usr/local/bin/toxavahi ]; then' >> $TEMP_SCRIPT
479
-	echo '  exit 3' >> $TEMP_SCRIPT
480
-	echo 'fi' >> $TEMP_SCRIPT
481
-	echo 'toxavahi' >> $TEMP_SCRIPT
482
-	echo 'echo "* *     * * *   root    /usr/local/bin/toxavahi > /dev/null" >> /etc/crontab' >> $TEMP_SCRIPT
483
-	echo 'systemctl restart avahi-daemon' >> $TEMP_SCRIPT
484
-	echo 'exit 0' >> $TEMP_SCRIPT
485
-	chmod +x $TEMP_SCRIPT
486
-	cp $TEMP_SCRIPT $rootdir/root/
438
+	if [ ! -d ${rootdir}${INSTALL_DIR} ]; then
439
+		mkdir -p ${rootdir}${INSTALL_DIR}
440
+	fi
487 441
 
488
-	chroot "$rootdir" /root/$TEMP_SCRIPT_NAME
442
+	git clone ${TOXID_REPO} ${rootdir}${INSTALL_DIR}/toxid
443
+	if [ ! -d ${rootdir}${INSTALL_DIR}/toxid ]; then
444
+		echo $'Unable to clone toxid repo'
445
+		exit 768352
446
+	fi
447
+	chroot "$rootdir" cd $INSTALL_DIR/toxid && make
489 448
 	if [ ! "$?" = "0" ]; then
490
-		echo $"Unable to install toxid, returned $?"
491
-		rm $TEMP_SCRIPT
492
-		exit 62835
449
+		echo $'Unable to make toxid'
450
+		exit 386823
493 451
 	fi
494
-	rm $TEMP_SCRIPT
452
+	chroot "$rootdir" cd $INSTALL_DIR/toxid && make install
453
+	if [ ! -f $rootdir/usr/local/bin/toxavahi ]; then
454
+	  exit 3621729
455
+	fi
456
+	echo "* *     * * *   root    /usr/local/bin/toxavahi > /dev/null" >> $rootdir/etc/crontab
495 457
 }
496 458
 
497 459
 function mesh_tox_client {

+ 0
- 4
src/freedombone-image-customise View File

@@ -680,10 +680,6 @@ function configure_user_interface {
680 680
 
681 681
 		# IRC client
682 682
 		chroot "$rootdir" apt-get -y install hexchat profanity
683
-
684
-		# zeronet
685
-
686
-		# TODO
687 683
 	fi
688 684
 }
689 685