Browse Source

Change zeronet directory

Bob Mottram 8 years ago
parent
commit
2bff9487f5
6 changed files with 171 additions and 160 deletions
  1. 50
    48
      src/freedombone
  2. 32
    30
      src/freedombone-image-customise
  3. 49
    47
      src/freedombone-image-mesh
  4. 16
    14
      src/freedombone-mesh-install
  5. 22
    20
      src/freedombone-meshweb
  6. 2
    1
      src/zeronetavahi

+ 50
- 48
src/freedombone View File

@@ -529,6 +529,8 @@ ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
529 529
 ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID"
530 530
 ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b'
531 531
 
532
+MESH_INSTALL_DIR=/var/lib
533
+
532 534
 # https://github.com/ipfs/go-ipfs
533 535
 IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"
534 536
 IPFS_COMMIT='20b06a4cbce8884f5b194da6e98cb11f2c77f166'
@@ -2769,7 +2771,7 @@ function install_zeronet_blog {
2769 2771
 		return
2770 2772
 	fi
2771 2773
 
2772
-	set_repo_commit /opt/zeronet/ZeroBlog "ZeroNet Blog commit" "$ZERONET_BLOG_COMMIT" $ZERONET_BLOG_REPO
2774
+	set_repo_commit $MESH_INSTALL_DIR/zeronet/ZeroBlog "ZeroNet Blog commit" "$ZERONET_BLOG_COMMIT" $ZERONET_BLOG_REPO
2773 2775
 
2774 2776
 	if grep -Fxq "install_zeronet_blog" $COMPLETION_FILE; then
2775 2777
 		return
@@ -2790,9 +2792,9 @@ function install_zeronet_blog {
2790 2792
 
2791 2793
 	ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
2792 2794
 
2793
-	cd /opt/zeronet
2794
-	python zeronet.py --batch siteCreate 2> /opt/zeronet/blog.txt
2795
-	if [ ! -f /opt/zeronet/blog.txt ]; then
2795
+	cd $MESH_INSTALL_DIR/zeronet
2796
+	python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/blog.txt
2797
+	if [ ! -f $MESH_INSTALL_DIR/zeronet/blog.txt ]; then
2796 2798
 		echo $'Unable to create blog'
2797 2799
 		exit 479
2798 2800
 	fi
@@ -2815,17 +2817,17 @@ function install_zeronet_blog {
2815 2817
 		exit 1639
2816 2818
 	fi
2817 2819
 
2818
-	if [ ! -d "/opt/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then
2819
-		echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_BLOG_ADDRESS"
2820
+	if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then
2821
+		echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS"
2820 2822
 		exit 7638
2821 2823
 	fi
2822 2824
 
2823 2825
 	git_clone $ZERONET_BLOG_REPO ZeroBlog
2824
-	if [ ! -d /opt/zeronet/ZeroBlog ]; then
2826
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then
2825 2827
 		echo $'ZeroBlog repo could not be cloned'
2826 2828
 		exit 6739
2827 2829
 	fi
2828
-	cd /opt/zeronet/ZeroBlog
2830
+	cd $MESH_INSTALL_DIR/zeronet/ZeroBlog
2829 2831
 	git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
2830 2832
 	if ! grep -q "ZeroNet Blog commit" $COMPLETION_FILE; then
2831 2833
 		echo "ZeroNet Blog commit:$ZERONET_BLOG_COMMIT" >> $COMPLETION_FILE
@@ -2835,17 +2837,17 @@ function install_zeronet_blog {
2835 2837
 
2836 2838
 	echo $"ZeroNet Blog address:     $ZERONET_BLOG_ADDRESS"
2837 2839
 	echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY"
2838
-	cp -r /opt/zeronet/ZeroBlog/* /opt/zeronet/data/$ZERONET_BLOG_ADDRESS
2840
+	cp -r $MESH_INSTALL_DIR/zeronet/ZeroBlog/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS
2839 2841
 
2840
-	if [ ! -d /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then
2841
-		mkdir /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data
2842
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then
2843
+		mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data
2842 2844
 	fi
2843
-	cp /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data
2844
-	sed -i "s/MyZeroBlog/$ZERONET_DEFAULT_BLOG_TITLE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
2845
-	sed -i "s/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
2846
-	sed -i "s/ZeroBlog Demo/$ZERONET_DEFAULT_BLOG_TITLE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
2847
-	sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_BLOG_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
2848
-	sed -i "s/Blogging platform Demo/Blogging platform/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json
2845
+	cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data
2846
+	sed -i "s/MyZeroBlog/$ZERONET_DEFAULT_BLOG_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
2847
+	sed -i "s/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
2848
+	sed -i "s/ZeroBlog Demo/$ZERONET_DEFAULT_BLOG_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
2849
+	sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_BLOG_TAGLINE</h3>|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
2850
+	sed -i "s/Blogging platform Demo/Blogging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json
2849 2851
 	python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
2850 2852
 
2851 2853
 	# Add an avahi service
@@ -2881,7 +2883,7 @@ function install_zeronet_mail {
2881 2883
 		return
2882 2884
 	fi
2883 2885
 
2884
-	set_repo_commit /opt/zeronet/ZeroMail "ZeroNet Mail commit" "$ZERONET_MAIL_COMMIT" $ZERONET_MAIL_REPO
2886
+	set_repo_commit $MESH_INSTALL_DIR/zeronet/ZeroMail "ZeroNet Mail commit" "$ZERONET_MAIL_COMMIT" $ZERONET_MAIL_REPO
2885 2887
 
2886 2888
 	if grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then
2887 2889
 		return
@@ -2902,9 +2904,9 @@ function install_zeronet_mail {
2902 2904
 
2903 2905
 	ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
2904 2906
 
2905
-	cd /opt/zeronet
2906
-	python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt
2907
-	if [ ! -f /opt/zeronet/mail.txt ]; then
2907
+	cd $MESH_INSTALL_DIR/zeronet
2908
+	python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/mail.txt
2909
+	if [ ! -f $MESH_INSTALL_DIR/zeronet/mail.txt ]; then
2908 2910
 		echo $'Unable to create mail'
2909 2911
 		exit 479
2910 2912
 	fi
@@ -2927,17 +2929,17 @@ function install_zeronet_mail {
2927 2929
 		exit 1639
2928 2930
 	fi
2929 2931
 
2930
-	if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
2931
-		echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS"
2932
+	if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
2933
+		echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS"
2932 2934
 		exit 7638
2933 2935
 	fi
2934 2936
 
2935 2937
 	git_clone $ZERONET_MAIL_REPO ZeroMail
2936
-	if [ ! -d /opt/zeronet/ZeroMail ]; then
2938
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
2937 2939
 		echo $'ZeroMail repo could not be cloned'
2938 2940
 		exit 6739
2939 2941
 	fi
2940
-	cd /opt/zeronet/ZeroMail
2942
+	cd $MESH_INSTALL_DIR/zeronet/ZeroMail
2941 2943
 	git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
2942 2944
 	if ! grep -q "ZeroNet Mail commit" $COMPLETION_FILE; then
2943 2945
 		echo "ZeroNet Mail commit:$ZERONET_MAIL_COMMIT" >> $COMPLETION_FILE
@@ -2947,17 +2949,17 @@ function install_zeronet_mail {
2947 2949
 
2948 2950
 	echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS"
2949 2951
 	echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
2950
-	cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS
2952
+	cp -r $MESH_INSTALL_DIR/zeronet/ZeroMail/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS
2951 2953
 
2952
-	if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
2953
-		mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
2954
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
2955
+		mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
2954 2956
 	fi
2955
-	cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
2956
-	sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
2957
-	sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
2958
-	sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
2959
-	sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
2960
-	sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
2957
+	cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
2958
+	sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
2959
+	sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
2960
+	sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
2961
+	sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
2962
+	sed -i "s/Mailging platform Demo/Mailging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
2961 2963
 	python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
2962 2964
 
2963 2965
 	# Add an avahi service
@@ -2994,7 +2996,7 @@ function install_zeronet_forum {
2994 2996
 	fi
2995 2997
 
2996 2998
 	# update to the next commit
2997
-	set_repo_commit /opt/zeronet/ZeroTalk "ZeroNet Forum commit" "$ZERONET_FORUM_COMMIT" $ZERONET_FORUM_REPO
2999
+	set_repo_commit $MESH_INSTALL_DIR/zeronet/ZeroTalk "ZeroNet Forum commit" "$ZERONET_FORUM_COMMIT" $ZERONET_FORUM_REPO
2998 3000
 
2999 3001
 	if grep -Fxq "install_zeronet_forum" $COMPLETION_FILE; then
3000 3002
 		return
@@ -3015,9 +3017,9 @@ function install_zeronet_forum {
3015 3017
 
3016 3018
 	ZERONET_DEFAULT_FORUM_TITLE=$"${MY_USERNAME}'s Forum"
3017 3019
 
3018
-	cd /opt/zeronet
3019
-	python zeronet.py --batch siteCreate 2> /opt/zeronet/forum.txt
3020
-	if [ ! -f /opt/zeronet/forum.txt ]; then
3020
+	cd $MESH_INSTALL_DIR/zeronet
3021
+	python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/forum.txt
3022
+	if [ ! -f $MESH_INSTALL_DIR/zeronet/forum.txt ]; then
3021 3023
 		echo $'Unable to create forum'
3022 3024
 		exit 479
3023 3025
 	fi
@@ -3040,13 +3042,13 @@ function install_zeronet_forum {
3040 3042
 		exit 87356
3041 3043
 	fi
3042 3044
 
3043
-	if [ ! -d "/opt/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then
3044
-		echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_FORUM_ADDRESS"
3045
+	if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then
3046
+		echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS"
3045 3047
 		exit 7638
3046 3048
 	fi
3047 3049
 
3048 3050
 	git_clone $ZERONET_FORUM_REPO ZeroTalk
3049
-	if [ ! -d /opt/zeronet/ZeroTalk ]; then
3051
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then
3050 3052
 		echo $'ZeroTalk repo could not be cloned'
3051 3053
 		exit 6739
3052 3054
 	fi
@@ -3059,12 +3061,12 @@ function install_zeronet_forum {
3059 3061
 
3060 3062
 	echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
3061 3063
 	echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
3062
-	cp -r /opt/zeronet/ZeroTalk/* /opt/zeronet/data/$ZERONET_FORUM_ADDRESS
3063
-	sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
3064
-	sed -i "s/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
3065
-	sed -i "s|Demo for dynamic, decentralized content publishing.|$ZERONET_DEFAULT_FORUM_TAGLINE|g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
3066
-	sed -i 's/Messaging Board Demo/Messaging Board/g' /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
3067
-	sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
3064
+	cp -r $MESH_INSTALL_DIR/zeronet/ZeroTalk/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS
3065
+	sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
3066
+	sed -i "s/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
3067
+	sed -i "s|Demo for dynamic, decentralized content publishing.|$ZERONET_DEFAULT_FORUM_TAGLINE|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
3068
+	sed -i 's/Messaging Board Demo/Messaging Board/g' $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
3069
+	sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
3068 3070
 	python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
3069 3071
 
3070 3072
 	# Add an avahi service
@@ -3101,7 +3103,7 @@ function install_zeronet {
3101 3103
 	fi
3102 3104
 
3103 3105
 	# update to the next commit
3104
-	set_repo_commit /opt/zeronet "ZeroNet commit" "$ZERONET_COMMIT" $ZERONET_REPO
3106
+	set_repo_commit $MESH_INSTALL_DIR/zeronet "ZeroNet commit" "$ZERONET_COMMIT" $ZERONET_REPO
3105 3107
 
3106 3108
 	if grep -Fxq "install_zeronet" $COMPLETION_FILE; then
3107 3109
 		return

+ 32
- 30
src/freedombone-image-customise View File

@@ -100,6 +100,8 @@ MESH_DESKTOP_BACKGROUND_IMAGE=/usr/local/share/${PROJECT_NAME}_mesh_background.p
100 100
 # The browser application to use
101 101
 BROWSER=iceweasel
102 102
 
103
+MESH_INSTALL_DIR=/var/lib
104
+
103 105
 enable_eatmydata_override() {
104 106
 	chroot $rootdir apt-get install --no-install-recommends -y eatmydata
105 107
 	if [ -x $rootdir/usr/bin/eatmydata ] && \
@@ -922,25 +924,25 @@ function mesh_zeronet {
922 924
 	chroot "$rootdir" apt-get -y install python-pip bittornado
923 925
 	chroot "$rootdir" pip install msgpack-python --upgrade
924 926
 
925
-	chroot "$rootdir" useradd -d /opt/zeronet/ -s /bin/false zeronet
926
-	git clone $ZERONET_REPO $rootdir/opt/zeronet
927
-	if [ ! -d $rootdir/opt/zeronet ]; then
927
+	chroot "$rootdir" useradd -d $MESH_INSTALL_DIR/zeronet/ -s /bin/false zeronet
928
+	git clone $ZERONET_REPO $rootdir$MESH_INSTALL_DIR/zeronet
929
+	if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet ]; then
928 930
 		echo 'WARNING: Unable to clone zeronet'
929 931
 		return
930 932
 	fi
931
-	cd $rootdir/opt/zeronet
933
+	cd $rootdir$MESH_INSTALL_DIR/zeronet
932 934
 	git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
933 935
 	if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then
934 936
 		echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE
935 937
 	else
936 938
 		sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
937 939
 	fi
938
-	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
940
+	chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
939 941
 
940 942
 	# Hack to ensure that the file access port is opened
941 943
 	# This is because zeronet normally relies on an internet site
942 944
 	# to do this, but on a purely local mesh the internet isn't available
943
-	sed -i 's|fileserver_port = 0|fileserver_port = config.fileserver_port\n            sys.modules["main"].file_server.port_opened = True|g' $rootdir/opt/zeronet/src/Site/Site.py
945
+	sed -i 's|fileserver_port = 0|fileserver_port = config.fileserver_port\n            sys.modules["main"].file_server.port_opened = True|g' $rootdir$MESH_INSTALL_DIR/zeronet/src/Site/Site.py
944 946
 
945 947
 	ZERONET_DAEMON=$rootdir/etc/systemd/system/zeronet.service
946 948
 	echo '[Unit]' > $ZERONET_DAEMON
@@ -951,8 +953,8 @@ function mesh_zeronet {
951 953
 	echo 'Type=simple' >> $ZERONET_DAEMON
952 954
 	echo 'User=zeronet' >> $ZERONET_DAEMON
953 955
 	echo 'Group=zeronet' >> $ZERONET_DAEMON
954
-	echo 'WorkingDirectory=/opt/zeronet' >> $ZERONET_DAEMON
955
-	echo 'ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file /opt/zeronet/bootstrap' >> $ZERONET_DAEMON
956
+	echo "WorkingDirectory=$MESH_INSTALL_DIR/zeronet" >> $ZERONET_DAEMON
957
+	echo "ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file $MESH_INSTALL_DIR/zeronet/bootstrap" >> $ZERONET_DAEMON
956 958
 	echo '' >> $ZERONET_DAEMON
957 959
 	echo 'TimeoutSec=300' >> $ZERONET_DAEMON
958 960
 	echo '' >> $ZERONET_DAEMON
@@ -968,19 +970,19 @@ function mesh_zeronet {
968 970
 	echo 'Type=simple' >> $TRACKER_DAEMON
969 971
 	echo 'User=tracker' >> $TRACKER_DAEMON
970 972
 	echo 'Group=tracker' >> $TRACKER_DAEMON
971
-	echo 'WorkingDirectory=/opt/tracker' >> $TRACKER_DAEMON
972
-	echo "ExecStart=/usr/bin/bttrack --port $TRACKER_PORT --dfile /opt/tracker/dstate --logfile /opt/tracker/tracker.log --nat_check 0 --scrape_allowed full --ipv6_enabled 0" >> $TRACKER_DAEMON
973
+	echo "WorkingDirectory=$MESH_INSTALL_DIR/tracker" >> $TRACKER_DAEMON
974
+	echo "ExecStart=/usr/bin/bttrack --port $TRACKER_PORT --dfile $MESH_INSTALL_DIR/tracker/dstate --logfile $MESH_INSTALL_DIR/tracker/tracker.log --nat_check 0 --scrape_allowed full --ipv6_enabled 0" >> $TRACKER_DAEMON
973 975
 	echo '' >> $TRACKER_DAEMON
974 976
 	echo 'TimeoutSec=300' >> $TRACKER_DAEMON
975 977
 	echo '' >> $TRACKER_DAEMON
976 978
 	echo '[Install]' >> $TRACKER_DAEMON
977 979
 	echo 'WantedBy=multi-user.target' >> $TRACKER_DAEMON
978 980
 
979
-	chroot "$rootdir" useradd -d /opt/tracker/ -s /bin/false tracker
980
-	if [ ! -d $rootdir/opt/tracker ]; then
981
-		mkdir $rootdir/opt/tracker
981
+	chroot "$rootdir" useradd -d $MESH_INSTALL_DIR/tracker/ -s /bin/false tracker
982
+	if [ ! -d $rootdir$MESH_INSTALL_DIR/tracker ]; then
983
+		mkdir $rootdir$MESH_INSTALL_DIR/tracker
982 984
 	fi
983
-	chroot "$rootdir" chown -R tracker:tracker /opt/tracker
985
+	chroot "$rootdir" chown -R tracker:tracker $MESH_INSTALL_DIR/tracker
984 986
 
985 987
 	# publish regularly
986 988
 	echo "* *     * * *   root    zeronetavahi > /dev/null" >> $rootdir/etc/crontab
@@ -998,14 +1000,14 @@ function mesh_zeronet_blog {
998 1000
 		ZERONET_BLOG_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
999 1001
 	fi
1000 1002
 
1001
-	git clone $ZERONET_BLOG_REPO $rootdir/opt/zeronet/ZeroBlog
1002
-	if [ ! -d $rootdir/opt/zeronet/ZeroBlog ]; then
1003
+	git clone $ZERONET_BLOG_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog
1004
+	if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then
1003 1005
 		echo $'ZeroBlog repo could not be cloned'
1004 1006
 		exit 6739
1005 1007
 	fi
1006
-	cd $rootdir/opt/zeronet/ZeroBlog
1008
+	cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog
1007 1009
 	git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
1008
-	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
1010
+	chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
1009 1011
 }
1010 1012
 
1011 1013
 function mesh_zeronet_mail {
@@ -1017,14 +1019,14 @@ function mesh_zeronet_mail {
1017 1019
 		ZERONET_MAIL_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1018 1020
 	fi
1019 1021
 
1020
-	git clone $ZERONET_MAIL_REPO $rootdir/opt/zeronet/ZeroMail
1021
-	if [ ! -d $rootdir/opt/zeronet/ZeroMail ]; then
1022
+	git clone $ZERONET_MAIL_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail
1023
+	if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
1022 1024
 		echo $'ZeroMail repo could not be cloned'
1023 1025
 		exit 78493
1024 1026
 	fi
1025
-	cd $rootdir/opt/zeronet/ZeroMail
1027
+	cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail
1026 1028
 	git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
1027
-	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
1029
+	chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
1028 1030
 }
1029 1031
 
1030 1032
 function mesh_zeronet_forum {
@@ -1036,14 +1038,14 @@ function mesh_zeronet_forum {
1036 1038
 		ZERONET_FORUM_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1037 1039
 	fi
1038 1040
 
1039
-	git clone $ZERONET_FORUM_REPO $rootdir/opt/zeronet/ZeroTalk
1040
-	if [ ! -d $rootdir/opt/zeronet/ZeroTalk ]; then
1041
+	git clone $ZERONET_FORUM_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk
1042
+	if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then
1041 1043
 		echo $'ZeroTalk repo could not be cloned'
1042 1044
 		exit 78252
1043 1045
 	fi
1044
-	cd $rootdir/opt/zeronet/ZeroTalk
1046
+	cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk
1045 1047
 	git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
1046
-	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
1048
+	chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
1047 1049
 }
1048 1050
 
1049 1051
 function mesh_zeronet_id {
@@ -1055,14 +1057,14 @@ function mesh_zeronet_id {
1055 1057
 		ZERONET_ID_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1056 1058
 	fi
1057 1059
 
1058
-	git clone $ZERONET_ID_REPO $rootdir/opt/zeronet/ZeroID
1059
-	if [ ! -d $rootdir/opt/zeronet/ZeroID ]; then
1060
+	git clone $ZERONET_ID_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID
1061
+	if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID ]; then
1060 1062
 		echo $'ZeroID repo could not be cloned'
1061 1063
 		exit 37936
1062 1064
 	fi
1063
-	cd $rootdir/opt/zeronet/ZeroID
1065
+	cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID
1064 1066
 	git checkout $ZERONET_ID_COMMIT -b $ZERONET_ID_COMMIT
1065
-	chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
1067
+	chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
1066 1068
 }
1067 1069
 
1068 1070
 function mesh_web_server {

+ 49
- 47
src/freedombone-image-mesh View File

@@ -44,6 +44,8 @@ TOX_NODES=
44 44
 #  '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
45 45
 #)
46 46
 
47
+MESH_INSTALL_DIR=/var/lib
48
+
47 49
 function set_hostname {
48 50
 	DEFAULT_DOMAIN_NAME="$1"
49 51
 
@@ -81,7 +83,7 @@ function regenerate_ssh_host_keys {
81 83
 }
82 84
 
83 85
 function configure_zeronet {
84
-	sed -i "s|ExecStart=.*|ExecStart=/usr/bin/python zeronet.py --ip_external P${PEER_ID}.local --trackers_file /opt/zeronet/bootstrap|g" /etc/systemd/system/zeronet.service
86
+	sed -i "s|ExecStart=.*|ExecStart=/usr/bin/python zeronet.py --ip_external P${PEER_ID}.local --trackers_file $MESH_INSTALL_DIR/zeronet/bootstrap|g" /etc/systemd/system/zeronet.service
85 87
 	echo $"zeronet daemon updated to P${PEER_ID}.local" >> $INSTALL_LOG
86 88
 }
87 89
 
@@ -89,9 +91,9 @@ function configure_zeronet_blog {
89 91
 	echo $'Updating ZeroNet Blog' >> $INSTALL_LOG
90 92
 	ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
91 93
 
92
-	cd /opt/zeronet
93
-	python zeronet.py --batch siteCreate 2> /opt/zeronet/blog.txt
94
-	if [ ! -f /opt/zeronet/blog.txt ]; then
94
+	cd $MESH_INSTALL_DIR/zeronet
95
+	python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/blog.txt
96
+	if [ ! -f $MESH_INSTALL_DIR/zeronet/blog.txt ]; then
95 97
 		echo $'Unable to create ZeroNet blog' >> $INSTALL_LOG
96 98
 		exit 7386
97 99
 	fi
@@ -114,24 +116,24 @@ function configure_zeronet_blog {
114 116
 		exit 1639
115 117
 	fi
116 118
 
117
-	if [ ! -d "/opt/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then
118
-		echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
119
+	if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then
120
+		echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
119 121
 		exit 7638
120 122
 	fi
121 123
 
122 124
 	echo $"ZeroNet Blog address:     $ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
123 125
 	echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY" >> $INSTALL_LOG
124
-	cp -r /opt/zeronet/ZeroBlog/* /opt/zeronet/data/$ZERONET_BLOG_ADDRESS
126
+	cp -r $MESH_INSTALL_DIR/zeronet/ZeroBlog/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS
125 127
 
126
-	if [ ! -d /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then
127
-		mkdir /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data
128
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then
129
+		mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data
128 130
 	fi
129
-	cp /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data
130
-	sed -i "s/MyZeroBlog/$ZERONET_DEFAULT_BLOG_TITLE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
131
-	sed -i "s/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
132
-	sed -i "s/ZeroBlog Demo/$ZERONET_DEFAULT_BLOG_TITLE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
133
-	sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_BLOG_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
134
-	sed -i "s/Blogging platform Demo/Blogging platform/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json
131
+	cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data
132
+	sed -i "s/MyZeroBlog/$ZERONET_DEFAULT_BLOG_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
133
+	sed -i "s/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
134
+	sed -i "s/ZeroBlog Demo/$ZERONET_DEFAULT_BLOG_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
135
+	sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_BLOG_TAGLINE</h3>|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
136
+	sed -i "s/Blogging platform Demo/Blogging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json
135 137
 	python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
136 138
 
137 139
 	# update the avahi service
@@ -163,9 +165,9 @@ function configure_zeronet_mail {
163 165
 	echo $'Updating ZeroNet Mail' >> $INSTALL_LOG
164 166
 	ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
165 167
 
166
-	cd /opt/zeronet
167
-	python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt
168
-	if [ ! -f /opt/zeronet/mail.txt ]; then
168
+	cd $MESH_INSTALL_DIR/zeronet
169
+	python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/mail.txt
170
+	if [ ! -f $MESH_INSTALL_DIR/zeronet/mail.txt ]; then
169 171
 		echo $'Unable to create ZeroNet mail' >> $INSTALL_LOG
170 172
 		exit 72574
171 173
 	fi
@@ -188,24 +190,24 @@ function configure_zeronet_mail {
188 190
 		exit 1639
189 191
 	fi
190 192
 
191
-	if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
192
-		echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
193
+	if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
194
+		echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
193 195
 		exit 7638
194 196
 	fi
195 197
 
196 198
 	echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
197 199
 	echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" >> $INSTALL_LOG
198
-	cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS
200
+	cp -r $MESH_INSTALL_DIR/zeronet/ZeroMail/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS
199 201
 
200
-	if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
201
-		mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
202
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
203
+		mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
202 204
 	fi
203
-	cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
204
-	sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
205
-	sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
206
-	sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
207
-	sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
208
-	sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
205
+	cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
206
+	sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
207
+	sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
208
+	sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
209
+	sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
210
+	sed -i "s/Mailging platform Demo/Mailging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
209 211
 	python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
210 212
 
211 213
 	# Add an avahi service
@@ -237,9 +239,9 @@ function configure_zeronet_forum {
237 239
 	echo $'Updating ZeroNet Forum' >> $INSTALL_LOG
238 240
 	ZERONET_DEFAULT_FORUM_TITLE="${MY_USERNAME}'s Forum"
239 241
 
240
-	cd /opt/zeronet
241
-	python zeronet.py --batch siteCreate 2> /opt/zeronet/forum.txt
242
-	if [ ! -f /opt/zeronet/forum.txt ]; then
242
+	cd $MESH_INSTALL_DIR/zeronet
243
+	python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/forum.txt
244
+	if [ ! -f $MESH_INSTALL_DIR/zeronet/forum.txt ]; then
243 245
 		echo $'Unable to create ZeroNet forum' >> $INSTALL_LOG
244 246
 		exit 47962
245 247
 	fi
@@ -262,19 +264,19 @@ function configure_zeronet_forum {
262 264
 		exit 87356
263 265
 	fi
264 266
 
265
-	if [ ! -d "/opt/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then
266
-		echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_FORUM_ADDRESS" >> $INSTALL_LOG
267
+	if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then
268
+		echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS" >> $INSTALL_LOG
267 269
 		exit 7638
268 270
 	fi
269 271
 
270 272
 	echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
271 273
 	echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
272
-	cp -r /opt/zeronet/ZeroTalk/* /opt/zeronet/data/$ZERONET_FORUM_ADDRESS
273
-	sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
274
-	sed -i "s/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
275
-	sed -i "s|Demo for dynamic, decentralized content publishing.|$ZERONET_DEFAULT_FORUM_TAGLINE|g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
276
-	sed -i 's/Messaging Board Demo/Messaging Board/g' /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
277
-	sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
274
+	cp -r $MESH_INSTALL_DIR/zeronet/ZeroTalk/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS
275
+	sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
276
+	sed -i "s/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
277
+	sed -i "s|Demo for dynamic, decentralized content publishing.|$ZERONET_DEFAULT_FORUM_TAGLINE|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
278
+	sed -i 's/Messaging Board Demo/Messaging Board/g' $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
279
+	sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
278 280
 	python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
279 281
 
280 282
 	# Add an avahi service
@@ -305,9 +307,9 @@ function configure_zeronet_forum {
305 307
 function configure_zeronet_id {
306 308
 	echo $'Updating ZeroID' >> $INSTALL_LOG
307 309
 
308
-	cd /opt/zeronet
309
-	python zeronet.py --batch siteCreate 2> /opt/zeronet/zeroid.txt
310
-	if [ ! -f /opt/zeronet/zeroid.txt ]; then
310
+	cd $MESH_INSTALL_DIR/zeronet
311
+	python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/zeroid.txt
312
+	if [ ! -f $MESH_INSTALL_DIR/zeronet/zeroid.txt ]; then
311 313
 		echo $'Unable to create ZeroID' >> $INSTALL_LOG
312 314
 		exit 47962
313 315
 	fi
@@ -330,16 +332,16 @@ function configure_zeronet_id {
330 332
 		exit 87356
331 333
 	fi
332 334
 
333
-	if [ ! -d "/opt/zeronet/data/$ZERONET_ID_ADDRESS" ]; then
334
-		echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_ID_ADDRESS" >> $INSTALL_LOG
335
+	if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_ID_ADDRESS" ]; then
336
+		echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_ID_ADDRESS" >> $INSTALL_LOG
335 337
 		exit 378434
336 338
 	fi
337 339
 
338 340
 	echo $"ZeroID address:     $ZERONET_ID_ADDRESS"
339 341
 	echo $"ZeroID private key: $ZERONET_ID_PRIVATE_KEY"
340
-	cp -r /opt/zeronet/ZeroID/* /opt/zeronet/data/$ZERONET_ID_ADDRESS
342
+	cp -r $MESH_INSTALL_DIR/zeronet/ZeroID/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_ID_ADDRESS
341 343
 	# TODO
342
-	sed -i "s///g" /opt/zeronet/data/$ZERONET_ID_ADDRESS/content.json
344
+	sed -i "s///g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_ID_ADDRESS/content.json
343 345
 	python zeronet.py siteSign $ZERONET_ID_ADDRESS $ZERONET_ID_PRIVATE_KEY --inner_path data/users/content.json
344 346
 
345 347
 	# Add an avahi service

+ 16
- 14
src/freedombone-mesh-install View File

@@ -75,6 +75,8 @@ ZERONET_PORT=
75 75
 # Directory where source code is downloaded and compiled
76 76
 INSTALL_DIR=$HOME/build
77 77
 
78
+MESH_INSTALL_DIR=/var/lib
79
+
78 80
 function show_help {
79 81
 	echo ''
80 82
 	echo $"${PROJECT_NAME}-mesh-install -f [function] -r [rootdir]"
@@ -682,25 +684,25 @@ function mesh_zeronet {
682 684
 	$CHROOT_PREFIX pip install msgpack-python --upgrade
683 685
 	$CHROOT_PREFIX pip install gevent --upgrade
684 686
 
685
-	$CHROOT_PREFIX useradd -d /opt/zeronet/ -s /bin/false zeronet
686
-	git_clone $ZERONET_REPO $rootdir/opt/zeronet
687
-	if [ ! -d $rootdir/opt/zeronet ]; then
687
+	$CHROOT_PREFIX useradd -d $MESH_INSTALL_DIR/zeronet/ -s /bin/false zeronet
688
+	git_clone $ZERONET_REPO $rootdir$MESH_INSTALL_DIR/zeronet
689
+	if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet ]; then
688 690
 		echo 'WARNING: Unable to clone zeronet'
689 691
 		return
690 692
 	fi
691
-	cd $rootdir/opt/zeronet
693
+	cd $rootdir$MESH_INSTALL_DIR/zeronet
692 694
 	git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
693 695
 	if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then
694 696
 		echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE
695 697
 	else
696 698
 		sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
697 699
 	fi
698
-	chown -R zeronet:zeronet $rootdir/opt/zeronet
700
+	chown -R zeronet:zeronet $rootdir$MESH_INSTALL_DIR/zeronet
699 701
 
700 702
 	# Hack to ensure that the file access port is opened
701 703
 	# This is because zeronet normally relies on an internet site
702 704
 	# to do this, but on a purely local mesh the internet isn't available
703
-	sed -i 's|fileserver_port = 0|fileserver_port = config.fileserver_port\n            sys.modules["main"].file_server.port_opened = True|g' $rootdir/opt/zeronet/src/Site/Site.py
705
+	sed -i 's|fileserver_port = 0|fileserver_port = config.fileserver_port\n            sys.modules["main"].file_server.port_opened = True|g' $rootdir$MESH_INSTALL_DIR/zeronet/src/Site/Site.py
704 706
 
705 707
 	ZERPNET_DAEMON=$rootdir/etc/systemd/system/zeronet.service
706 708
 	echo '[Unit]' > $ZERONET_DAEMON
@@ -711,8 +713,8 @@ function mesh_zeronet {
711 713
 	echo 'Type=simple' >> $ZERONET_DAEMON
712 714
 	echo 'User=zeronet' >> $ZERONET_DAEMON
713 715
 	echo 'Group=zeronet' >> $ZERONET_DAEMON
714
-	echo 'WorkingDirectory=/opt/zeronet' >> $ZERONET_DAEMON
715
-	echo 'ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file /opt/zeronet/bootstrap' >> $ZERONET_DAEMON
716
+	echo "WorkingDirectory=$MESH_INSTALL_DIR/zeronet" >> $ZERONET_DAEMON
717
+	echo "ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file $MESH_INSTALL_DIR/zeronet/bootstrap" >> $ZERONET_DAEMON
716 718
 	echo '' >> $ZERONET_DAEMON
717 719
 	echo 'TimeoutSec=300' >> $ZERONET_DAEMON
718 720
 	echo '' >> $ZERONET_DAEMON
@@ -728,19 +730,19 @@ function mesh_zeronet {
728 730
 	echo 'Type=simple' >> $TRACKER_DAEMON
729 731
 	echo 'User=tracker' >> $TRACKER_DAEMON
730 732
 	echo 'Group=tracker' >> $TRACKER_DAEMON
731
-	echo 'WorkingDirectory=/opt/tracker' >> $TRACKER_DAEMON
732
-	echo "ExecStart=/usr/bin/bttrack --port $TRACKER_PORT --dfile /opt/tracker/dstate --logfile /opt/tracker/tracker.log --nat_check 0 --scrape_allowed full --ipv6_enabled 0" >> $TRACKER_DAEMON
733
+	echo "WorkingDirectory=$MESH_INSTALL_DIR/tracker" >> $TRACKER_DAEMON
734
+	echo "ExecStart=/usr/bin/bttrack --port $TRACKER_PORT --dfile $MESH_INSTALL_DIR/tracker/dstate --logfile $MESH_INSTALL_DIR/tracker/tracker.log --nat_check 0 --scrape_allowed full --ipv6_enabled 0" >> $TRACKER_DAEMON
733 735
 	echo '' >> $TRACKER_DAEMON
734 736
 	echo 'TimeoutSec=300' >> $TRACKER_DAEMON
735 737
 	echo '' >> $TRACKER_DAEMON
736 738
 	echo '[Install]' >> $TRACKER_DAEMON
737 739
 	echo 'WantedBy=multi-user.target' >> $TRACKER_DAEMON
738 740
 
739
-	$CHROOT_PREFIX useradd -d /opt/tracker/ -s /bin/false tracker
740
-	if [ ! -d $rootdir/opt/tracker ]; then
741
-		mkdir $rootdir/opt/tracker
741
+	$CHROOT_PREFIX useradd -d $MESH_INSTALL_DIR/tracker/ -s /bin/false tracker
742
+	if [ ! -d $rootdir$MESH_INSTALL_DIR/tracker ]; then
743
+		mkdir $rootdir$MESH_INSTALL_DIR/tracker
742 744
 	fi
743
-	chown -R tracker:tracker $rootdir/opt/tracker
745
+	chown -R tracker:tracker $rootdir$MESH_INSTALL_DIR/tracker
744 746
 
745 747
 	# publish regularly
746 748
 	echo "* *     * * *   root    zeronetavahi > /dev/null" >> $rootdir/etc/crontab

+ 22
- 20
src/freedombone-meshweb View File

@@ -61,6 +61,8 @@ ZERONET_DEFAULT_MAIL_TAGLINE=$"Mail for the Mesh"
61 61
 
62 62
 IPFS_PORT=4001
63 63
 
64
+MESH_INSTALL_DIR=/var/lib
65
+
64 66
 function install_ipfs {
65 67
   if [ ! -f /home/$MY_USERNAME/go/bin/ipfs ]; then
66 68
       if [ ! -d /usr/local/go ]; then
@@ -182,7 +184,7 @@ function install_zeronet_blog {
182 184
         echo $'ZeroBlog repo could not be cloned'
183 185
         exit 6739
184 186
     fi
185
-    cd /opt/zeronet/ZeroBlog
187
+    cd $MESH_INSTALL_DIR/zeronet/ZeroBlog
186 188
     git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
187 189
 
188 190
     echo $"Blog address:     $ZERONET_BLOG_ADDRESS"
@@ -243,9 +245,9 @@ function install_zeronet_mail {
243 245
 
244 246
   ZERONET_DEFAULT_MAIL_TITLE=$"${MY_USERNAME}'s Mail"
245 247
 
246
-  cd /opt/zeronet
247
-  python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt
248
-  if [ ! -f /opt/zeronet/mail.txt ]; then
248
+  cd $MESH_INSTALL_DIR/zeronet
249
+  python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/mail.txt
250
+  if [ ! -f $MESH_INSTALL_DIR/zeronet/mail.txt ]; then
249 251
       echo 'Unable to create mail'
250 252
       exit 479
251 253
   fi
@@ -268,32 +270,32 @@ function install_zeronet_mail {
268 270
       exit 1639
269 271
   fi
270 272
 
271
-  if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
272
-      echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS"
273
+  if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
274
+      echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS"
273 275
       exit 7638
274 276
   fi
275 277
 
276 278
   git clone $ZERONET_MAIL_REPO ZeroMail
277
-  if [ ! -d /opt/zeronet/ZeroMail ]; then
279
+  if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
278 280
       echo $'ZeroMail repo could not be cloned'
279 281
       exit 6739
280 282
   fi
281
-  cd /opt/zeronet/ZeroMail
283
+  cd $MESH_INSTALL_DIR/zeronet/ZeroMail
282 284
   git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
283 285
 
284 286
   echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS"
285 287
   echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
286
-  cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS
288
+  cp -r $MESH_INSTALL_DIR/zeronet/ZeroMail/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS
287 289
 
288
-  if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
289
-      mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
290
+  if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
291
+      mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
290 292
   fi
291
-  cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
292
-  sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
293
-  sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
294
-  sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
295
-  sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
296
-  sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
293
+  cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
294
+  sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
295
+  sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
296
+  sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
297
+  sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
298
+  sed -i "s/Mailging platform Demo/Mailging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
297 299
   python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
298 300
 
299 301
   # Add an avahi service
@@ -375,7 +377,7 @@ function install_zeronet_forum {
375 377
         echo $'ZeroTalk repo could not be cloned'
376 378
         exit 6739
377 379
     fi
378
-    cd /opt/zeronet/ZeroTalk
380
+    cd $MESH_INSTALL_DIR/zeronet/ZeroTalk
379 381
     git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
380 382
 
381 383
     echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
@@ -483,8 +485,8 @@ if [[ $SERVER_INSTALLATION == "no" ]]; then
483 485
     fi
484 486
 fi
485 487
 
486
-if [ -d /opt/zeronet ]; then
487
-    ZERONET_DIR=/opt/zeronet
488
+if [ -d $MESH_INSTALL_DIR/zeronet ]; then
489
+    ZERONET_DIR=$MESH_INSTALL_DIR/zeronet
488 490
 fi
489 491
 
490 492
 if [[ $SERVER_INSTALLATION == "no" ]]; then

+ 2
- 1
src/zeronetavahi View File

@@ -36,9 +36,10 @@ PROJECT_NAME='freedombone'
36 36
 export TEXTDOMAIN=$PROJECT_NAME-zeronetavahi
37 37
 export TEXTDOMAINDIR="/usr/share/locale"
38 38
 
39
+MESH_INSTALL_DIR=/var/lib
39 40
 WEB_PAGE_TITLE=$"${PROJECT_NAME} Mesh"
40 41
 TRACKER_PORT=6969
41
-ZERONET_INSTALL=/opt/zeronet
42
+ZERONET_INSTALL=$MESH_INSTALL_DIR/zeronet
42 43
 ZERONET_USER_HOME=/home/zeronet
43 44
 MY_USERNAME=$USER
44 45