瀏覽代碼

Add web server to mesh images

Bob Mottram 8 年之前
父節點
當前提交
f26202a3b7
共有 3 個檔案被更改,包括 110 行新增0 行删除
  1. 2
    0
      src/freedombone
  2. 102
    0
      src/freedombone-image-customise
  3. 6
    0
      src/freedombone-meshweb

+ 2
- 0
src/freedombone 查看文件

@@ -526,6 +526,8 @@ TRACKER_PORT=6969
526 526
 ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
527 527
 ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group"
528 528
 ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
529
+ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID"
530
+ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b'
529 531
 
530 532
 # https://github.com/ipfs/go-ipfs
531 533
 IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"

+ 102
- 0
src/freedombone-image-customise 查看文件

@@ -477,6 +477,14 @@ TOX_NODES=
477 477
 ZERONET_REPO=
478 478
 ZERONET_COMMIT=
479 479
 ZERONET_PORT=
480
+ZERONET_BLOG_REPO=
481
+ZERONET_BLOG_COMMIT=
482
+ZERONET_MAIL_REPO=
483
+ZERONET_MAIL_COMMIT=
484
+ZERONET_FORUM_REPO=
485
+ZERONET_FORUM_COMMIT=
486
+ZERONET_ID_REPO=
487
+ZERONET_ID_COMMIT=
480 488
 
481 489
 # Directory where source code is downloaded and compiled
482 490
 INSTALL_DIR=$HOME/build
@@ -981,6 +989,96 @@ function mesh_zeronet {
981 989
 	chroot "$rootdir" systemctl enable zeronet.service
982 990
 }
983 991
 
992
+function mesh_zeronet_blog {
993
+	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
994
+		ZERONET_BLOG_REPO=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_REPO=" | head -n 1 | awk -F '"' '{print $2}')
995
+		ZERONET_BLOG_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
996
+	else
997
+		ZERONET_BLOG_REPO=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_REPO=" | head -n 1 | awk -F '"' '{print $2}')
998
+		ZERONET_BLOG_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
999
+	fi
1000
+
1001
+	git clone $ZERONET_BLOG_REPO $rootdir/opt/zeronet/ZeroBlog
1002
+	if [ ! -d $rootdir/opt/zeronet/ZeroBlog ]; then
1003
+		echo $'ZeroBlog repo could not be cloned'
1004
+		exit 6739
1005
+	fi
1006
+	cd $rootdir/opt/zeronet/ZeroBlog
1007
+	git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
1008
+	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
1009
+}
1010
+
1011
+function mesh_zeronet_mail {
1012
+	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
1013
+		ZERONET_MAIL_REPO=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_REPO=" | head -n 1 | awk -F '"' '{print $2}')
1014
+		ZERONET_MAIL_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1015
+	else
1016
+		ZERONET_MAIL_REPO=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_REPO=" | head -n 1 | awk -F '"' '{print $2}')
1017
+		ZERONET_MAIL_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1018
+	fi
1019
+
1020
+	git clone $ZERONET_MAIL_REPO $rootdir/opt/zeronet/ZeroMail
1021
+	if [ ! -d $rootdir/opt/zeronet/ZeroMail ]; then
1022
+		echo $'ZeroMail repo could not be cloned'
1023
+		exit 78493
1024
+	fi
1025
+	cd $rootdir/opt/zeronet/ZeroMail
1026
+	git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
1027
+	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
1028
+}
1029
+
1030
+function mesh_zeronet_forum {
1031
+	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
1032
+		ZERONET_FORUM_REPO=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_REPO=" | head -n 1 | awk -F '"' '{print $2}')
1033
+		ZERONET_FORUM_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1034
+	else
1035
+		ZERONET_FORUM_REPO=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_REPO=" | head -n 1 | awk -F '"' '{print $2}')
1036
+		ZERONET_FORUM_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1037
+	fi
1038
+
1039
+	git clone $ZERONET_FORUM_REPO $rootdir/opt/zeronet/ZeroTalk
1040
+	if [ ! -d $rootdir/opt/zeronet/ZeroTalk ]; then
1041
+		echo $'ZeroTalk repo could not be cloned'
1042
+		exit 78252
1043
+	fi
1044
+	cd $rootdir/opt/zeronet/ZeroTalk
1045
+	git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
1046
+	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
1047
+}
1048
+
1049
+function mesh_zeronet_id {
1050
+	if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
1051
+		ZERONET_ID_REPO=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_ID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
1052
+		ZERONET_ID_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1053
+	else
1054
+		ZERONET_ID_REPO=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
1055
+		ZERONET_ID_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1056
+	fi
1057
+
1058
+	git clone $ZERONET_ID_REPO $rootdir/opt/zeronet/ZeroID
1059
+	if [ ! -d $rootdir/opt/zeronet/ZeroID ]; then
1060
+		echo $'ZeroID repo could not be cloned'
1061
+		exit 37936
1062
+	fi
1063
+	cd $rootdir/opt/zeronet/ZeroID
1064
+	git checkout $ZERONET_ID_COMMIT -b $ZERONET_ID_COMMIT
1065
+	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
1066
+}
1067
+
1068
+function mesh_web_server {
1069
+	if [ -d /etc/apache2 ]; then
1070
+		chroot "$rootdir" apt-get -y remove --purge apache2
1071
+		chroot "$rootdir" rm -rf /etc/apache2
1072
+	fi
1073
+
1074
+	chroot "$rootdir" apt-get -y install nginx
1075
+
1076
+	if [ ! -d /etc/nginx ]; then
1077
+		echo $'Unable to install web server'
1078
+		exit 346825
1079
+	fi
1080
+}
1081
+
984 1082
 initialise_mesh() {
985 1083
 	if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
986 1084
 		return
@@ -1012,7 +1110,11 @@ initialise_mesh() {
1012 1110
 	mesh_tox_node
1013 1111
 	mesh_tox_avahi
1014 1112
 	mesh_tox_client
1113
+	mesh_web_server
1015 1114
 	mesh_zeronet
1115
+	mesh_zeronet_blog
1116
+	mesh_zeronet_mail
1117
+	mesh_zeronet_forum
1016 1118
 
1017 1119
 	MESH_SERVICE='mesh-setup.service'
1018 1120
 	MESH_SETUP_DAEMON=$rootdir/etc/systemd/system/$MESH_SERVICE

+ 6
- 0
src/freedombone-meshweb 查看文件

@@ -483,6 +483,10 @@ if [[ $SERVER_INSTALLATION == "no" ]]; then
483 483
     fi
484 484
 fi
485 485
 
486
+if [ -d /opt/zeronet ]; then
487
+    ZERONET_DIR=/opt/zeronet
488
+fi
489
+
486 490
 if [[ $SERVER_INSTALLATION == "no" ]]; then
487 491
     if [ ! -f /tmp/meshtype ]; then
488 492
         install_web_server
@@ -557,6 +561,8 @@ fi
557 561
 
558 562
 if which firefox > /dev/null; then
559 563
     firefox $ZERONET_INDEX
564
+elif which iceweasel > /dev/null; then
565
+    iceweasel $ZERONET_INDEX
560 566
 elif which chrome > /dev/null; then
561 567
     chrome $ZERONET_INDEX
562 568
 elif which chromium > /dev/null; then