浏览代码

Change zeronet directory

Bob Mottram 8 年前
父节点
当前提交
2bff9487f5
共有 6 个文件被更改,包括 171 次插入160 次删除
  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 查看文件

529
 ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID"
529
 ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID"
530
 ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b'
530
 ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b'
531
 
531
 
532
+MESH_INSTALL_DIR=/var/lib
533
+
532
 # https://github.com/ipfs/go-ipfs
534
 # https://github.com/ipfs/go-ipfs
533
 IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"
535
 IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"
534
 IPFS_COMMIT='20b06a4cbce8884f5b194da6e98cb11f2c77f166'
536
 IPFS_COMMIT='20b06a4cbce8884f5b194da6e98cb11f2c77f166'
2769
 		return
2771
 		return
2770
 	fi
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
 	if grep -Fxq "install_zeronet_blog" $COMPLETION_FILE; then
2776
 	if grep -Fxq "install_zeronet_blog" $COMPLETION_FILE; then
2775
 		return
2777
 		return
2790
 
2792
 
2791
 	ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
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
 		echo $'Unable to create blog'
2798
 		echo $'Unable to create blog'
2797
 		exit 479
2799
 		exit 479
2798
 	fi
2800
 	fi
2815
 		exit 1639
2817
 		exit 1639
2816
 	fi
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
 		exit 7638
2822
 		exit 7638
2821
 	fi
2823
 	fi
2822
 
2824
 
2823
 	git_clone $ZERONET_BLOG_REPO ZeroBlog
2825
 	git_clone $ZERONET_BLOG_REPO ZeroBlog
2824
-	if [ ! -d /opt/zeronet/ZeroBlog ]; then
2826
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then
2825
 		echo $'ZeroBlog repo could not be cloned'
2827
 		echo $'ZeroBlog repo could not be cloned'
2826
 		exit 6739
2828
 		exit 6739
2827
 	fi
2829
 	fi
2828
-	cd /opt/zeronet/ZeroBlog
2830
+	cd $MESH_INSTALL_DIR/zeronet/ZeroBlog
2829
 	git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
2831
 	git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
2830
 	if ! grep -q "ZeroNet Blog commit" $COMPLETION_FILE; then
2832
 	if ! grep -q "ZeroNet Blog commit" $COMPLETION_FILE; then
2831
 		echo "ZeroNet Blog commit:$ZERONET_BLOG_COMMIT" >> $COMPLETION_FILE
2833
 		echo "ZeroNet Blog commit:$ZERONET_BLOG_COMMIT" >> $COMPLETION_FILE
2835
 
2837
 
2836
 	echo $"ZeroNet Blog address:     $ZERONET_BLOG_ADDRESS"
2838
 	echo $"ZeroNet Blog address:     $ZERONET_BLOG_ADDRESS"
2837
 	echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY"
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
 	fi
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
 	python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
2851
 	python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
2850
 
2852
 
2851
 	# Add an avahi service
2853
 	# Add an avahi service
2881
 		return
2883
 		return
2882
 	fi
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
 	if grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then
2888
 	if grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then
2887
 		return
2889
 		return
2902
 
2904
 
2903
 	ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
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
 		echo $'Unable to create mail'
2910
 		echo $'Unable to create mail'
2909
 		exit 479
2911
 		exit 479
2910
 	fi
2912
 	fi
2927
 		exit 1639
2929
 		exit 1639
2928
 	fi
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
 		exit 7638
2934
 		exit 7638
2933
 	fi
2935
 	fi
2934
 
2936
 
2935
 	git_clone $ZERONET_MAIL_REPO ZeroMail
2937
 	git_clone $ZERONET_MAIL_REPO ZeroMail
2936
-	if [ ! -d /opt/zeronet/ZeroMail ]; then
2938
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
2937
 		echo $'ZeroMail repo could not be cloned'
2939
 		echo $'ZeroMail repo could not be cloned'
2938
 		exit 6739
2940
 		exit 6739
2939
 	fi
2941
 	fi
2940
-	cd /opt/zeronet/ZeroMail
2942
+	cd $MESH_INSTALL_DIR/zeronet/ZeroMail
2941
 	git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
2943
 	git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
2942
 	if ! grep -q "ZeroNet Mail commit" $COMPLETION_FILE; then
2944
 	if ! grep -q "ZeroNet Mail commit" $COMPLETION_FILE; then
2943
 		echo "ZeroNet Mail commit:$ZERONET_MAIL_COMMIT" >> $COMPLETION_FILE
2945
 		echo "ZeroNet Mail commit:$ZERONET_MAIL_COMMIT" >> $COMPLETION_FILE
2947
 
2949
 
2948
 	echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS"
2950
 	echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS"
2949
 	echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
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
 	fi
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
 	python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
2963
 	python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
2962
 
2964
 
2963
 	# Add an avahi service
2965
 	# Add an avahi service
2994
 	fi
2996
 	fi
2995
 
2997
 
2996
 	# update to the next commit
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
 	if grep -Fxq "install_zeronet_forum" $COMPLETION_FILE; then
3001
 	if grep -Fxq "install_zeronet_forum" $COMPLETION_FILE; then
3000
 		return
3002
 		return
3015
 
3017
 
3016
 	ZERONET_DEFAULT_FORUM_TITLE=$"${MY_USERNAME}'s Forum"
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
 		echo $'Unable to create forum'
3023
 		echo $'Unable to create forum'
3022
 		exit 479
3024
 		exit 479
3023
 	fi
3025
 	fi
3040
 		exit 87356
3042
 		exit 87356
3041
 	fi
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
 		exit 7638
3047
 		exit 7638
3046
 	fi
3048
 	fi
3047
 
3049
 
3048
 	git_clone $ZERONET_FORUM_REPO ZeroTalk
3050
 	git_clone $ZERONET_FORUM_REPO ZeroTalk
3049
-	if [ ! -d /opt/zeronet/ZeroTalk ]; then
3051
+	if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then
3050
 		echo $'ZeroTalk repo could not be cloned'
3052
 		echo $'ZeroTalk repo could not be cloned'
3051
 		exit 6739
3053
 		exit 6739
3052
 	fi
3054
 	fi
3059
 
3061
 
3060
 	echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
3062
 	echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
3061
 	echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
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
 	python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
3070
 	python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
3069
 
3071
 
3070
 	# Add an avahi service
3072
 	# Add an avahi service
3101
 	fi
3103
 	fi
3102
 
3104
 
3103
 	# update to the next commit
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
 	if grep -Fxq "install_zeronet" $COMPLETION_FILE; then
3108
 	if grep -Fxq "install_zeronet" $COMPLETION_FILE; then
3107
 		return
3109
 		return

+ 32
- 30
src/freedombone-image-customise 查看文件

100
 # The browser application to use
100
 # The browser application to use
101
 BROWSER=iceweasel
101
 BROWSER=iceweasel
102
 
102
 
103
+MESH_INSTALL_DIR=/var/lib
104
+
103
 enable_eatmydata_override() {
105
 enable_eatmydata_override() {
104
 	chroot $rootdir apt-get install --no-install-recommends -y eatmydata
106
 	chroot $rootdir apt-get install --no-install-recommends -y eatmydata
105
 	if [ -x $rootdir/usr/bin/eatmydata ] && \
107
 	if [ -x $rootdir/usr/bin/eatmydata ] && \
922
 	chroot "$rootdir" apt-get -y install python-pip bittornado
924
 	chroot "$rootdir" apt-get -y install python-pip bittornado
923
 	chroot "$rootdir" pip install msgpack-python --upgrade
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
 		echo 'WARNING: Unable to clone zeronet'
930
 		echo 'WARNING: Unable to clone zeronet'
929
 		return
931
 		return
930
 	fi
932
 	fi
931
-	cd $rootdir/opt/zeronet
933
+	cd $rootdir$MESH_INSTALL_DIR/zeronet
932
 	git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
934
 	git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
933
 	if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then
935
 	if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then
934
 		echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE
936
 		echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE
935
 	else
937
 	else
936
 		sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
938
 		sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
937
 	fi
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
 	# Hack to ensure that the file access port is opened
942
 	# Hack to ensure that the file access port is opened
941
 	# This is because zeronet normally relies on an internet site
943
 	# This is because zeronet normally relies on an internet site
942
 	# to do this, but on a purely local mesh the internet isn't available
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
 	ZERONET_DAEMON=$rootdir/etc/systemd/system/zeronet.service
947
 	ZERONET_DAEMON=$rootdir/etc/systemd/system/zeronet.service
946
 	echo '[Unit]' > $ZERONET_DAEMON
948
 	echo '[Unit]' > $ZERONET_DAEMON
951
 	echo 'Type=simple' >> $ZERONET_DAEMON
953
 	echo 'Type=simple' >> $ZERONET_DAEMON
952
 	echo 'User=zeronet' >> $ZERONET_DAEMON
954
 	echo 'User=zeronet' >> $ZERONET_DAEMON
953
 	echo 'Group=zeronet' >> $ZERONET_DAEMON
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
 	echo '' >> $ZERONET_DAEMON
958
 	echo '' >> $ZERONET_DAEMON
957
 	echo 'TimeoutSec=300' >> $ZERONET_DAEMON
959
 	echo 'TimeoutSec=300' >> $ZERONET_DAEMON
958
 	echo '' >> $ZERONET_DAEMON
960
 	echo '' >> $ZERONET_DAEMON
968
 	echo 'Type=simple' >> $TRACKER_DAEMON
970
 	echo 'Type=simple' >> $TRACKER_DAEMON
969
 	echo 'User=tracker' >> $TRACKER_DAEMON
971
 	echo 'User=tracker' >> $TRACKER_DAEMON
970
 	echo 'Group=tracker' >> $TRACKER_DAEMON
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
 	echo '' >> $TRACKER_DAEMON
975
 	echo '' >> $TRACKER_DAEMON
974
 	echo 'TimeoutSec=300' >> $TRACKER_DAEMON
976
 	echo 'TimeoutSec=300' >> $TRACKER_DAEMON
975
 	echo '' >> $TRACKER_DAEMON
977
 	echo '' >> $TRACKER_DAEMON
976
 	echo '[Install]' >> $TRACKER_DAEMON
978
 	echo '[Install]' >> $TRACKER_DAEMON
977
 	echo 'WantedBy=multi-user.target' >> $TRACKER_DAEMON
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
 	fi
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
 	# publish regularly
987
 	# publish regularly
986
 	echo "* *     * * *   root    zeronetavahi > /dev/null" >> $rootdir/etc/crontab
988
 	echo "* *     * * *   root    zeronetavahi > /dev/null" >> $rootdir/etc/crontab
998
 		ZERONET_BLOG_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1000
 		ZERONET_BLOG_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
999
 	fi
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
 		echo $'ZeroBlog repo could not be cloned'
1005
 		echo $'ZeroBlog repo could not be cloned'
1004
 		exit 6739
1006
 		exit 6739
1005
 	fi
1007
 	fi
1006
-	cd $rootdir/opt/zeronet/ZeroBlog
1008
+	cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog
1007
 	git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
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
 function mesh_zeronet_mail {
1013
 function mesh_zeronet_mail {
1017
 		ZERONET_MAIL_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1019
 		ZERONET_MAIL_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1018
 	fi
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
 		echo $'ZeroMail repo could not be cloned'
1024
 		echo $'ZeroMail repo could not be cloned'
1023
 		exit 78493
1025
 		exit 78493
1024
 	fi
1026
 	fi
1025
-	cd $rootdir/opt/zeronet/ZeroMail
1027
+	cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail
1026
 	git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
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
 function mesh_zeronet_forum {
1032
 function mesh_zeronet_forum {
1036
 		ZERONET_FORUM_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1038
 		ZERONET_FORUM_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1037
 	fi
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
 		echo $'ZeroTalk repo could not be cloned'
1043
 		echo $'ZeroTalk repo could not be cloned'
1042
 		exit 78252
1044
 		exit 78252
1043
 	fi
1045
 	fi
1044
-	cd $rootdir/opt/zeronet/ZeroTalk
1046
+	cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk
1045
 	git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
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
 function mesh_zeronet_id {
1051
 function mesh_zeronet_id {
1055
 		ZERONET_ID_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1057
 		ZERONET_ID_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
1056
 	fi
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
 		echo $'ZeroID repo could not be cloned'
1062
 		echo $'ZeroID repo could not be cloned'
1061
 		exit 37936
1063
 		exit 37936
1062
 	fi
1064
 	fi
1063
-	cd $rootdir/opt/zeronet/ZeroID
1065
+	cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID
1064
 	git checkout $ZERONET_ID_COMMIT -b $ZERONET_ID_COMMIT
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
 function mesh_web_server {
1070
 function mesh_web_server {

+ 49
- 47
src/freedombone-image-mesh 查看文件

44
 #  '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
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
 function set_hostname {
49
 function set_hostname {
48
 	DEFAULT_DOMAIN_NAME="$1"
50
 	DEFAULT_DOMAIN_NAME="$1"
49
 
51
 
81
 }
83
 }
82
 
84
 
83
 function configure_zeronet {
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
 	echo $"zeronet daemon updated to P${PEER_ID}.local" >> $INSTALL_LOG
87
 	echo $"zeronet daemon updated to P${PEER_ID}.local" >> $INSTALL_LOG
86
 }
88
 }
87
 
89
 
89
 	echo $'Updating ZeroNet Blog' >> $INSTALL_LOG
91
 	echo $'Updating ZeroNet Blog' >> $INSTALL_LOG
90
 	ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
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
 		echo $'Unable to create ZeroNet blog' >> $INSTALL_LOG
97
 		echo $'Unable to create ZeroNet blog' >> $INSTALL_LOG
96
 		exit 7386
98
 		exit 7386
97
 	fi
99
 	fi
114
 		exit 1639
116
 		exit 1639
115
 	fi
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
 		exit 7638
121
 		exit 7638
120
 	fi
122
 	fi
121
 
123
 
122
 	echo $"ZeroNet Blog address:     $ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
124
 	echo $"ZeroNet Blog address:     $ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
123
 	echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY" >> $INSTALL_LOG
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
 	fi
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
 	python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
137
 	python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
136
 
138
 
137
 	# update the avahi service
139
 	# update the avahi service
163
 	echo $'Updating ZeroNet Mail' >> $INSTALL_LOG
165
 	echo $'Updating ZeroNet Mail' >> $INSTALL_LOG
164
 	ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
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
 		echo $'Unable to create ZeroNet mail' >> $INSTALL_LOG
171
 		echo $'Unable to create ZeroNet mail' >> $INSTALL_LOG
170
 		exit 72574
172
 		exit 72574
171
 	fi
173
 	fi
188
 		exit 1639
190
 		exit 1639
189
 	fi
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
 		exit 7638
195
 		exit 7638
194
 	fi
196
 	fi
195
 
197
 
196
 	echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
198
 	echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
197
 	echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" >> $INSTALL_LOG
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
 	fi
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
 	python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
211
 	python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
210
 
212
 
211
 	# Add an avahi service
213
 	# Add an avahi service
237
 	echo $'Updating ZeroNet Forum' >> $INSTALL_LOG
239
 	echo $'Updating ZeroNet Forum' >> $INSTALL_LOG
238
 	ZERONET_DEFAULT_FORUM_TITLE="${MY_USERNAME}'s Forum"
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
 		echo $'Unable to create ZeroNet forum' >> $INSTALL_LOG
245
 		echo $'Unable to create ZeroNet forum' >> $INSTALL_LOG
244
 		exit 47962
246
 		exit 47962
245
 	fi
247
 	fi
262
 		exit 87356
264
 		exit 87356
263
 	fi
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
 		exit 7638
269
 		exit 7638
268
 	fi
270
 	fi
269
 
271
 
270
 	echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
272
 	echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
271
 	echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
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
 	python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
280
 	python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
279
 
281
 
280
 	# Add an avahi service
282
 	# Add an avahi service
305
 function configure_zeronet_id {
307
 function configure_zeronet_id {
306
 	echo $'Updating ZeroID' >> $INSTALL_LOG
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
 		echo $'Unable to create ZeroID' >> $INSTALL_LOG
313
 		echo $'Unable to create ZeroID' >> $INSTALL_LOG
312
 		exit 47962
314
 		exit 47962
313
 	fi
315
 	fi
330
 		exit 87356
332
 		exit 87356
331
 	fi
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
 		exit 378434
337
 		exit 378434
336
 	fi
338
 	fi
337
 
339
 
338
 	echo $"ZeroID address:     $ZERONET_ID_ADDRESS"
340
 	echo $"ZeroID address:     $ZERONET_ID_ADDRESS"
339
 	echo $"ZeroID private key: $ZERONET_ID_PRIVATE_KEY"
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
 	# TODO
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
 	python zeronet.py siteSign $ZERONET_ID_ADDRESS $ZERONET_ID_PRIVATE_KEY --inner_path data/users/content.json
345
 	python zeronet.py siteSign $ZERONET_ID_ADDRESS $ZERONET_ID_PRIVATE_KEY --inner_path data/users/content.json
344
 
346
 
345
 	# Add an avahi service
347
 	# Add an avahi service

+ 16
- 14
src/freedombone-mesh-install 查看文件

75
 # Directory where source code is downloaded and compiled
75
 # Directory where source code is downloaded and compiled
76
 INSTALL_DIR=$HOME/build
76
 INSTALL_DIR=$HOME/build
77
 
77
 
78
+MESH_INSTALL_DIR=/var/lib
79
+
78
 function show_help {
80
 function show_help {
79
 	echo ''
81
 	echo ''
80
 	echo $"${PROJECT_NAME}-mesh-install -f [function] -r [rootdir]"
82
 	echo $"${PROJECT_NAME}-mesh-install -f [function] -r [rootdir]"
682
 	$CHROOT_PREFIX pip install msgpack-python --upgrade
684
 	$CHROOT_PREFIX pip install msgpack-python --upgrade
683
 	$CHROOT_PREFIX pip install gevent --upgrade
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
 		echo 'WARNING: Unable to clone zeronet'
690
 		echo 'WARNING: Unable to clone zeronet'
689
 		return
691
 		return
690
 	fi
692
 	fi
691
-	cd $rootdir/opt/zeronet
693
+	cd $rootdir$MESH_INSTALL_DIR/zeronet
692
 	git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
694
 	git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
693
 	if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then
695
 	if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then
694
 		echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE
696
 		echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE
695
 	else
697
 	else
696
 		sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
698
 		sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
697
 	fi
699
 	fi
698
-	chown -R zeronet:zeronet $rootdir/opt/zeronet
700
+	chown -R zeronet:zeronet $rootdir$MESH_INSTALL_DIR/zeronet
699
 
701
 
700
 	# Hack to ensure that the file access port is opened
702
 	# Hack to ensure that the file access port is opened
701
 	# This is because zeronet normally relies on an internet site
703
 	# This is because zeronet normally relies on an internet site
702
 	# to do this, but on a purely local mesh the internet isn't available
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
 	ZERPNET_DAEMON=$rootdir/etc/systemd/system/zeronet.service
707
 	ZERPNET_DAEMON=$rootdir/etc/systemd/system/zeronet.service
706
 	echo '[Unit]' > $ZERONET_DAEMON
708
 	echo '[Unit]' > $ZERONET_DAEMON
711
 	echo 'Type=simple' >> $ZERONET_DAEMON
713
 	echo 'Type=simple' >> $ZERONET_DAEMON
712
 	echo 'User=zeronet' >> $ZERONET_DAEMON
714
 	echo 'User=zeronet' >> $ZERONET_DAEMON
713
 	echo 'Group=zeronet' >> $ZERONET_DAEMON
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
 	echo '' >> $ZERONET_DAEMON
718
 	echo '' >> $ZERONET_DAEMON
717
 	echo 'TimeoutSec=300' >> $ZERONET_DAEMON
719
 	echo 'TimeoutSec=300' >> $ZERONET_DAEMON
718
 	echo '' >> $ZERONET_DAEMON
720
 	echo '' >> $ZERONET_DAEMON
728
 	echo 'Type=simple' >> $TRACKER_DAEMON
730
 	echo 'Type=simple' >> $TRACKER_DAEMON
729
 	echo 'User=tracker' >> $TRACKER_DAEMON
731
 	echo 'User=tracker' >> $TRACKER_DAEMON
730
 	echo 'Group=tracker' >> $TRACKER_DAEMON
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
 	echo '' >> $TRACKER_DAEMON
735
 	echo '' >> $TRACKER_DAEMON
734
 	echo 'TimeoutSec=300' >> $TRACKER_DAEMON
736
 	echo 'TimeoutSec=300' >> $TRACKER_DAEMON
735
 	echo '' >> $TRACKER_DAEMON
737
 	echo '' >> $TRACKER_DAEMON
736
 	echo '[Install]' >> $TRACKER_DAEMON
738
 	echo '[Install]' >> $TRACKER_DAEMON
737
 	echo 'WantedBy=multi-user.target' >> $TRACKER_DAEMON
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
 	fi
744
 	fi
743
-	chown -R tracker:tracker $rootdir/opt/tracker
745
+	chown -R tracker:tracker $rootdir$MESH_INSTALL_DIR/tracker
744
 
746
 
745
 	# publish regularly
747
 	# publish regularly
746
 	echo "* *     * * *   root    zeronetavahi > /dev/null" >> $rootdir/etc/crontab
748
 	echo "* *     * * *   root    zeronetavahi > /dev/null" >> $rootdir/etc/crontab

+ 22
- 20
src/freedombone-meshweb 查看文件

61
 
61
 
62
 IPFS_PORT=4001
62
 IPFS_PORT=4001
63
 
63
 
64
+MESH_INSTALL_DIR=/var/lib
65
+
64
 function install_ipfs {
66
 function install_ipfs {
65
   if [ ! -f /home/$MY_USERNAME/go/bin/ipfs ]; then
67
   if [ ! -f /home/$MY_USERNAME/go/bin/ipfs ]; then
66
       if [ ! -d /usr/local/go ]; then
68
       if [ ! -d /usr/local/go ]; then
182
         echo $'ZeroBlog repo could not be cloned'
184
         echo $'ZeroBlog repo could not be cloned'
183
         exit 6739
185
         exit 6739
184
     fi
186
     fi
185
-    cd /opt/zeronet/ZeroBlog
187
+    cd $MESH_INSTALL_DIR/zeronet/ZeroBlog
186
     git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
188
     git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
187
 
189
 
188
     echo $"Blog address:     $ZERONET_BLOG_ADDRESS"
190
     echo $"Blog address:     $ZERONET_BLOG_ADDRESS"
243
 
245
 
244
   ZERONET_DEFAULT_MAIL_TITLE=$"${MY_USERNAME}'s Mail"
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
       echo 'Unable to create mail'
251
       echo 'Unable to create mail'
250
       exit 479
252
       exit 479
251
   fi
253
   fi
268
       exit 1639
270
       exit 1639
269
   fi
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
       exit 7638
275
       exit 7638
274
   fi
276
   fi
275
 
277
 
276
   git clone $ZERONET_MAIL_REPO ZeroMail
278
   git clone $ZERONET_MAIL_REPO ZeroMail
277
-  if [ ! -d /opt/zeronet/ZeroMail ]; then
279
+  if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
278
       echo $'ZeroMail repo could not be cloned'
280
       echo $'ZeroMail repo could not be cloned'
279
       exit 6739
281
       exit 6739
280
   fi
282
   fi
281
-  cd /opt/zeronet/ZeroMail
283
+  cd $MESH_INSTALL_DIR/zeronet/ZeroMail
282
   git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
284
   git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
283
 
285
 
284
   echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS"
286
   echo $"ZeroNet Mail address:     $ZERONET_MAIL_ADDRESS"
285
   echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
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
   fi
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
   python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
299
   python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
298
 
300
 
299
   # Add an avahi service
301
   # Add an avahi service
375
         echo $'ZeroTalk repo could not be cloned'
377
         echo $'ZeroTalk repo could not be cloned'
376
         exit 6739
378
         exit 6739
377
     fi
379
     fi
378
-    cd /opt/zeronet/ZeroTalk
380
+    cd $MESH_INSTALL_DIR/zeronet/ZeroTalk
379
     git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
381
     git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
380
 
382
 
381
     echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
383
     echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
483
     fi
485
     fi
484
 fi
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
 fi
490
 fi
489
 
491
 
490
 if [[ $SERVER_INSTALLATION == "no" ]]; then
492
 if [[ $SERVER_INSTALLATION == "no" ]]; then

+ 2
- 1
src/zeronetavahi 查看文件

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