Procházet zdrojové kódy

Add web server to mesh images

Bob Mottram před 8 roky
rodič
revize
f26202a3b7
3 změnil soubory, kde provedl 110 přidání a 0 odebrání
  1. 2
    0
      src/freedombone
  2. 102
    0
      src/freedombone-image-customise
  3. 6
    0
      src/freedombone-meshweb

+ 2
- 0
src/freedombone Zobrazit soubor

526
 ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
526
 ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
527
 ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group"
527
 ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group"
528
 ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
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
 # https://github.com/ipfs/go-ipfs
532
 # https://github.com/ipfs/go-ipfs
531
 IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"
533
 IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"

+ 102
- 0
src/freedombone-image-customise Zobrazit soubor

477
 ZERONET_REPO=
477
 ZERONET_REPO=
478
 ZERONET_COMMIT=
478
 ZERONET_COMMIT=
479
 ZERONET_PORT=
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
 # Directory where source code is downloaded and compiled
489
 # Directory where source code is downloaded and compiled
482
 INSTALL_DIR=$HOME/build
490
 INSTALL_DIR=$HOME/build
981
 	chroot "$rootdir" systemctl enable zeronet.service
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
 initialise_mesh() {
1082
 initialise_mesh() {
985
 	if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
1083
 	if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
986
 		return
1084
 		return
1012
 	mesh_tox_node
1110
 	mesh_tox_node
1013
 	mesh_tox_avahi
1111
 	mesh_tox_avahi
1014
 	mesh_tox_client
1112
 	mesh_tox_client
1113
+	mesh_web_server
1015
 	mesh_zeronet
1114
 	mesh_zeronet
1115
+	mesh_zeronet_blog
1116
+	mesh_zeronet_mail
1117
+	mesh_zeronet_forum
1016
 
1118
 
1017
 	MESH_SERVICE='mesh-setup.service'
1119
 	MESH_SERVICE='mesh-setup.service'
1018
 	MESH_SETUP_DAEMON=$rootdir/etc/systemd/system/$MESH_SERVICE
1120
 	MESH_SETUP_DAEMON=$rootdir/etc/systemd/system/$MESH_SERVICE

+ 6
- 0
src/freedombone-meshweb Zobrazit soubor

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