Change zeronet directory

This commit is contained in:
Bob Mottram 2016-06-25 23:46:05 +01:00
parent 94fc4e44d8
commit 2bff9487f5
6 changed files with 171 additions and 160 deletions

View File

@ -529,6 +529,8 @@ ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID" ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID"
ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b' ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b'
MESH_INSTALL_DIR=/var/lib
# https://github.com/ipfs/go-ipfs # https://github.com/ipfs/go-ipfs
IPFS_GO_REPO="https://github.com/ipfs/go-ipfs" IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"
IPFS_COMMIT='20b06a4cbce8884f5b194da6e98cb11f2c77f166' IPFS_COMMIT='20b06a4cbce8884f5b194da6e98cb11f2c77f166'
@ -2769,7 +2771,7 @@ function install_zeronet_blog {
return return
fi fi
set_repo_commit /opt/zeronet/ZeroBlog "ZeroNet Blog commit" "$ZERONET_BLOG_COMMIT" $ZERONET_BLOG_REPO set_repo_commit $MESH_INSTALL_DIR/zeronet/ZeroBlog "ZeroNet Blog commit" "$ZERONET_BLOG_COMMIT" $ZERONET_BLOG_REPO
if grep -Fxq "install_zeronet_blog" $COMPLETION_FILE; then if grep -Fxq "install_zeronet_blog" $COMPLETION_FILE; then
return return
@ -2790,9 +2792,9 @@ function install_zeronet_blog {
ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog" ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
cd /opt/zeronet cd $MESH_INSTALL_DIR/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/blog.txt python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/blog.txt
if [ ! -f /opt/zeronet/blog.txt ]; then if [ ! -f $MESH_INSTALL_DIR/zeronet/blog.txt ]; then
echo $'Unable to create blog' echo $'Unable to create blog'
exit 479 exit 479
fi fi
@ -2815,17 +2817,17 @@ function install_zeronet_blog {
exit 1639 exit 1639
fi fi
if [ ! -d "/opt/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_BLOG_ADDRESS" echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS"
exit 7638 exit 7638
fi fi
git_clone $ZERONET_BLOG_REPO ZeroBlog git_clone $ZERONET_BLOG_REPO ZeroBlog
if [ ! -d /opt/zeronet/ZeroBlog ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then
echo $'ZeroBlog repo could not be cloned' echo $'ZeroBlog repo could not be cloned'
exit 6739 exit 6739
fi fi
cd /opt/zeronet/ZeroBlog cd $MESH_INSTALL_DIR/zeronet/ZeroBlog
git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
if ! grep -q "ZeroNet Blog commit" $COMPLETION_FILE; then if ! grep -q "ZeroNet Blog commit" $COMPLETION_FILE; then
echo "ZeroNet Blog commit:$ZERONET_BLOG_COMMIT" >> $COMPLETION_FILE echo "ZeroNet Blog commit:$ZERONET_BLOG_COMMIT" >> $COMPLETION_FILE
@ -2835,17 +2837,17 @@ function install_zeronet_blog {
echo $"ZeroNet Blog address: $ZERONET_BLOG_ADDRESS" echo $"ZeroNet Blog address: $ZERONET_BLOG_ADDRESS"
echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY" echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroBlog/* /opt/zeronet/data/$ZERONET_BLOG_ADDRESS cp -r $MESH_INSTALL_DIR/zeronet/ZeroBlog/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS
if [ ! -d /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data
fi fi
cp /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data
sed -i "s/MyZeroBlog/$ZERONET_DEFAULT_BLOG_TITLE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json sed -i "s/MyZeroBlog/$ZERONET_DEFAULT_BLOG_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
sed -i "s/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json sed -i "s/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
sed -i "s/ZeroBlog Demo/$ZERONET_DEFAULT_BLOG_TITLE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html sed -i "s/ZeroBlog Demo/$ZERONET_DEFAULT_BLOG_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_BLOG_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html 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
sed -i "s/Blogging platform Demo/Blogging platform/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json sed -i "s/Blogging platform Demo/Blogging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
# Add an avahi service # Add an avahi service
@ -2881,7 +2883,7 @@ function install_zeronet_mail {
return return
fi fi
set_repo_commit /opt/zeronet/ZeroMail "ZeroNet Mail commit" "$ZERONET_MAIL_COMMIT" $ZERONET_MAIL_REPO set_repo_commit $MESH_INSTALL_DIR/zeronet/ZeroMail "ZeroNet Mail commit" "$ZERONET_MAIL_COMMIT" $ZERONET_MAIL_REPO
if grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then if grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then
return return
@ -2902,9 +2904,9 @@ function install_zeronet_mail {
ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail" ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
cd /opt/zeronet cd $MESH_INSTALL_DIR/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/mail.txt
if [ ! -f /opt/zeronet/mail.txt ]; then if [ ! -f $MESH_INSTALL_DIR/zeronet/mail.txt ]; then
echo $'Unable to create mail' echo $'Unable to create mail'
exit 479 exit 479
fi fi
@ -2927,17 +2929,17 @@ function install_zeronet_mail {
exit 1639 exit 1639
fi fi
if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS" echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS"
exit 7638 exit 7638
fi fi
git_clone $ZERONET_MAIL_REPO ZeroMail git_clone $ZERONET_MAIL_REPO ZeroMail
if [ ! -d /opt/zeronet/ZeroMail ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
echo $'ZeroMail repo could not be cloned' echo $'ZeroMail repo could not be cloned'
exit 6739 exit 6739
fi fi
cd /opt/zeronet/ZeroMail cd $MESH_INSTALL_DIR/zeronet/ZeroMail
git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
if ! grep -q "ZeroNet Mail commit" $COMPLETION_FILE; then if ! grep -q "ZeroNet Mail commit" $COMPLETION_FILE; then
echo "ZeroNet Mail commit:$ZERONET_MAIL_COMMIT" >> $COMPLETION_FILE echo "ZeroNet Mail commit:$ZERONET_MAIL_COMMIT" >> $COMPLETION_FILE
@ -2947,17 +2949,17 @@ function install_zeronet_mail {
echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS" echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS"
echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS cp -r $MESH_INSTALL_DIR/zeronet/ZeroMail/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS
if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
fi fi
cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html 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
sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json sed -i "s/Mailging platform Demo/Mailging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
# Add an avahi service # Add an avahi service
@ -2994,7 +2996,7 @@ function install_zeronet_forum {
fi fi
# update to the next commit # update to the next commit
set_repo_commit /opt/zeronet/ZeroTalk "ZeroNet Forum commit" "$ZERONET_FORUM_COMMIT" $ZERONET_FORUM_REPO set_repo_commit $MESH_INSTALL_DIR/zeronet/ZeroTalk "ZeroNet Forum commit" "$ZERONET_FORUM_COMMIT" $ZERONET_FORUM_REPO
if grep -Fxq "install_zeronet_forum" $COMPLETION_FILE; then if grep -Fxq "install_zeronet_forum" $COMPLETION_FILE; then
return return
@ -3015,9 +3017,9 @@ function install_zeronet_forum {
ZERONET_DEFAULT_FORUM_TITLE=$"${MY_USERNAME}'s Forum" ZERONET_DEFAULT_FORUM_TITLE=$"${MY_USERNAME}'s Forum"
cd /opt/zeronet cd $MESH_INSTALL_DIR/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/forum.txt python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/forum.txt
if [ ! -f /opt/zeronet/forum.txt ]; then if [ ! -f $MESH_INSTALL_DIR/zeronet/forum.txt ]; then
echo $'Unable to create forum' echo $'Unable to create forum'
exit 479 exit 479
fi fi
@ -3040,13 +3042,13 @@ function install_zeronet_forum {
exit 87356 exit 87356
fi fi
if [ ! -d "/opt/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_FORUM_ADDRESS" echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS"
exit 7638 exit 7638
fi fi
git_clone $ZERONET_FORUM_REPO ZeroTalk git_clone $ZERONET_FORUM_REPO ZeroTalk
if [ ! -d /opt/zeronet/ZeroTalk ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then
echo $'ZeroTalk repo could not be cloned' echo $'ZeroTalk repo could not be cloned'
exit 6739 exit 6739
fi fi
@ -3059,12 +3061,12 @@ function install_zeronet_forum {
echo $"Forum address: $ZERONET_FORUM_ADDRESS" echo $"Forum address: $ZERONET_FORUM_ADDRESS"
echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY" echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroTalk/* /opt/zeronet/data/$ZERONET_FORUM_ADDRESS cp -r $MESH_INSTALL_DIR/zeronet/ZeroTalk/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS
sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
sed -i "s/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html sed -i "s/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
sed -i "s|Demo for dynamic, decentralized content publishing.|$ZERONET_DEFAULT_FORUM_TAGLINE|g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html sed -i "s|Demo for dynamic, decentralized content publishing.|$ZERONET_DEFAULT_FORUM_TAGLINE|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
sed -i 's/Messaging Board Demo/Messaging Board/g' /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json sed -i 's/Messaging Board Demo/Messaging Board/g' $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
# Add an avahi service # Add an avahi service
@ -3101,7 +3103,7 @@ function install_zeronet {
fi fi
# update to the next commit # update to the next commit
set_repo_commit /opt/zeronet "ZeroNet commit" "$ZERONET_COMMIT" $ZERONET_REPO set_repo_commit $MESH_INSTALL_DIR/zeronet "ZeroNet commit" "$ZERONET_COMMIT" $ZERONET_REPO
if grep -Fxq "install_zeronet" $COMPLETION_FILE; then if grep -Fxq "install_zeronet" $COMPLETION_FILE; then
return return

View File

@ -100,6 +100,8 @@ MESH_DESKTOP_BACKGROUND_IMAGE=/usr/local/share/${PROJECT_NAME}_mesh_background.p
# The browser application to use # The browser application to use
BROWSER=iceweasel BROWSER=iceweasel
MESH_INSTALL_DIR=/var/lib
enable_eatmydata_override() { enable_eatmydata_override() {
chroot $rootdir apt-get install --no-install-recommends -y eatmydata chroot $rootdir apt-get install --no-install-recommends -y eatmydata
if [ -x $rootdir/usr/bin/eatmydata ] && \ if [ -x $rootdir/usr/bin/eatmydata ] && \
@ -922,25 +924,25 @@ function mesh_zeronet {
chroot "$rootdir" apt-get -y install python-pip bittornado chroot "$rootdir" apt-get -y install python-pip bittornado
chroot "$rootdir" pip install msgpack-python --upgrade chroot "$rootdir" pip install msgpack-python --upgrade
chroot "$rootdir" useradd -d /opt/zeronet/ -s /bin/false zeronet chroot "$rootdir" useradd -d $MESH_INSTALL_DIR/zeronet/ -s /bin/false zeronet
git clone $ZERONET_REPO $rootdir/opt/zeronet git clone $ZERONET_REPO $rootdir$MESH_INSTALL_DIR/zeronet
if [ ! -d $rootdir/opt/zeronet ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet ]; then
echo 'WARNING: Unable to clone zeronet' echo 'WARNING: Unable to clone zeronet'
return return
fi fi
cd $rootdir/opt/zeronet cd $rootdir$MESH_INSTALL_DIR/zeronet
git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then
echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE
else else
sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
fi fi
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
# Hack to ensure that the file access port is opened # Hack to ensure that the file access port is opened
# This is because zeronet normally relies on an internet site # This is because zeronet normally relies on an internet site
# to do this, but on a purely local mesh the internet isn't available # to do this, but on a purely local mesh the internet isn't available
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 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
ZERONET_DAEMON=$rootdir/etc/systemd/system/zeronet.service ZERONET_DAEMON=$rootdir/etc/systemd/system/zeronet.service
echo '[Unit]' > $ZERONET_DAEMON echo '[Unit]' > $ZERONET_DAEMON
@ -951,8 +953,8 @@ function mesh_zeronet {
echo 'Type=simple' >> $ZERONET_DAEMON echo 'Type=simple' >> $ZERONET_DAEMON
echo 'User=zeronet' >> $ZERONET_DAEMON echo 'User=zeronet' >> $ZERONET_DAEMON
echo 'Group=zeronet' >> $ZERONET_DAEMON echo 'Group=zeronet' >> $ZERONET_DAEMON
echo 'WorkingDirectory=/opt/zeronet' >> $ZERONET_DAEMON echo "WorkingDirectory=$MESH_INSTALL_DIR/zeronet" >> $ZERONET_DAEMON
echo 'ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file /opt/zeronet/bootstrap' >> $ZERONET_DAEMON echo "ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file $MESH_INSTALL_DIR/zeronet/bootstrap" >> $ZERONET_DAEMON
echo '' >> $ZERONET_DAEMON echo '' >> $ZERONET_DAEMON
echo 'TimeoutSec=300' >> $ZERONET_DAEMON echo 'TimeoutSec=300' >> $ZERONET_DAEMON
echo '' >> $ZERONET_DAEMON echo '' >> $ZERONET_DAEMON
@ -968,19 +970,19 @@ function mesh_zeronet {
echo 'Type=simple' >> $TRACKER_DAEMON echo 'Type=simple' >> $TRACKER_DAEMON
echo 'User=tracker' >> $TRACKER_DAEMON echo 'User=tracker' >> $TRACKER_DAEMON
echo 'Group=tracker' >> $TRACKER_DAEMON echo 'Group=tracker' >> $TRACKER_DAEMON
echo 'WorkingDirectory=/opt/tracker' >> $TRACKER_DAEMON echo "WorkingDirectory=$MESH_INSTALL_DIR/tracker" >> $TRACKER_DAEMON
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 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
echo '' >> $TRACKER_DAEMON echo '' >> $TRACKER_DAEMON
echo 'TimeoutSec=300' >> $TRACKER_DAEMON echo 'TimeoutSec=300' >> $TRACKER_DAEMON
echo '' >> $TRACKER_DAEMON echo '' >> $TRACKER_DAEMON
echo '[Install]' >> $TRACKER_DAEMON echo '[Install]' >> $TRACKER_DAEMON
echo 'WantedBy=multi-user.target' >> $TRACKER_DAEMON echo 'WantedBy=multi-user.target' >> $TRACKER_DAEMON
chroot "$rootdir" useradd -d /opt/tracker/ -s /bin/false tracker chroot "$rootdir" useradd -d $MESH_INSTALL_DIR/tracker/ -s /bin/false tracker
if [ ! -d $rootdir/opt/tracker ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/tracker ]; then
mkdir $rootdir/opt/tracker mkdir $rootdir$MESH_INSTALL_DIR/tracker
fi fi
chroot "$rootdir" chown -R tracker:tracker /opt/tracker chroot "$rootdir" chown -R tracker:tracker $MESH_INSTALL_DIR/tracker
# publish regularly # publish regularly
echo "* * * * * root zeronetavahi > /dev/null" >> $rootdir/etc/crontab echo "* * * * * root zeronetavahi > /dev/null" >> $rootdir/etc/crontab
@ -998,14 +1000,14 @@ function mesh_zeronet_blog {
ZERONET_BLOG_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') ZERONET_BLOG_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi fi
git clone $ZERONET_BLOG_REPO $rootdir/opt/zeronet/ZeroBlog git clone $ZERONET_BLOG_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog
if [ ! -d $rootdir/opt/zeronet/ZeroBlog ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then
echo $'ZeroBlog repo could not be cloned' echo $'ZeroBlog repo could not be cloned'
exit 6739 exit 6739
fi fi
cd $rootdir/opt/zeronet/ZeroBlog cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog
git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
} }
function mesh_zeronet_mail { function mesh_zeronet_mail {
@ -1017,14 +1019,14 @@ function mesh_zeronet_mail {
ZERONET_MAIL_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') ZERONET_MAIL_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi fi
git clone $ZERONET_MAIL_REPO $rootdir/opt/zeronet/ZeroMail git clone $ZERONET_MAIL_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail
if [ ! -d $rootdir/opt/zeronet/ZeroMail ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
echo $'ZeroMail repo could not be cloned' echo $'ZeroMail repo could not be cloned'
exit 78493 exit 78493
fi fi
cd $rootdir/opt/zeronet/ZeroMail cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail
git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
} }
function mesh_zeronet_forum { function mesh_zeronet_forum {
@ -1036,14 +1038,14 @@ function mesh_zeronet_forum {
ZERONET_FORUM_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') ZERONET_FORUM_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi fi
git clone $ZERONET_FORUM_REPO $rootdir/opt/zeronet/ZeroTalk git clone $ZERONET_FORUM_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk
if [ ! -d $rootdir/opt/zeronet/ZeroTalk ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then
echo $'ZeroTalk repo could not be cloned' echo $'ZeroTalk repo could not be cloned'
exit 78252 exit 78252
fi fi
cd $rootdir/opt/zeronet/ZeroTalk cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk
git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
} }
function mesh_zeronet_id { function mesh_zeronet_id {
@ -1055,14 +1057,14 @@ function mesh_zeronet_id {
ZERONET_ID_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') ZERONET_ID_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi fi
git clone $ZERONET_ID_REPO $rootdir/opt/zeronet/ZeroID git clone $ZERONET_ID_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID
if [ ! -d $rootdir/opt/zeronet/ZeroID ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID ]; then
echo $'ZeroID repo could not be cloned' echo $'ZeroID repo could not be cloned'
exit 37936 exit 37936
fi fi
cd $rootdir/opt/zeronet/ZeroID cd $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID
git checkout $ZERONET_ID_COMMIT -b $ZERONET_ID_COMMIT git checkout $ZERONET_ID_COMMIT -b $ZERONET_ID_COMMIT
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet chroot "$rootdir" chown -R zeronet:zeronet $MESH_INSTALL_DIR/zeronet
} }
function mesh_web_server { function mesh_web_server {

View File

@ -44,6 +44,8 @@ TOX_NODES=
# '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE' # '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
#) #)
MESH_INSTALL_DIR=/var/lib
function set_hostname { function set_hostname {
DEFAULT_DOMAIN_NAME="$1" DEFAULT_DOMAIN_NAME="$1"
@ -81,7 +83,7 @@ function regenerate_ssh_host_keys {
} }
function configure_zeronet { function configure_zeronet {
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 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
echo $"zeronet daemon updated to P${PEER_ID}.local" >> $INSTALL_LOG echo $"zeronet daemon updated to P${PEER_ID}.local" >> $INSTALL_LOG
} }
@ -89,9 +91,9 @@ function configure_zeronet_blog {
echo $'Updating ZeroNet Blog' >> $INSTALL_LOG echo $'Updating ZeroNet Blog' >> $INSTALL_LOG
ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog" ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
cd /opt/zeronet cd $MESH_INSTALL_DIR/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/blog.txt python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/blog.txt
if [ ! -f /opt/zeronet/blog.txt ]; then if [ ! -f $MESH_INSTALL_DIR/zeronet/blog.txt ]; then
echo $'Unable to create ZeroNet blog' >> $INSTALL_LOG echo $'Unable to create ZeroNet blog' >> $INSTALL_LOG
exit 7386 exit 7386
fi fi
@ -114,24 +116,24 @@ function configure_zeronet_blog {
exit 1639 exit 1639
fi fi
if [ ! -d "/opt/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
exit 7638 exit 7638
fi fi
echo $"ZeroNet Blog address: $ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG echo $"ZeroNet Blog address: $ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY" >> $INSTALL_LOG echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY" >> $INSTALL_LOG
cp -r /opt/zeronet/ZeroBlog/* /opt/zeronet/data/$ZERONET_BLOG_ADDRESS cp -r $MESH_INSTALL_DIR/zeronet/ZeroBlog/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS
if [ ! -d /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data
fi fi
cp /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data
sed -i "s/MyZeroBlog/$ZERONET_DEFAULT_BLOG_TITLE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json sed -i "s/MyZeroBlog/$ZERONET_DEFAULT_BLOG_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
sed -i "s/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json sed -i "s/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/data/data.json
sed -i "s/ZeroBlog Demo/$ZERONET_DEFAULT_BLOG_TITLE/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html sed -i "s/ZeroBlog Demo/$ZERONET_DEFAULT_BLOG_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_BLOG_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html 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
sed -i "s/Blogging platform Demo/Blogging platform/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json sed -i "s/Blogging platform Demo/Blogging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
# update the avahi service # update the avahi service
@ -163,9 +165,9 @@ function configure_zeronet_mail {
echo $'Updating ZeroNet Mail' >> $INSTALL_LOG echo $'Updating ZeroNet Mail' >> $INSTALL_LOG
ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail" ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
cd /opt/zeronet cd $MESH_INSTALL_DIR/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/mail.txt
if [ ! -f /opt/zeronet/mail.txt ]; then if [ ! -f $MESH_INSTALL_DIR/zeronet/mail.txt ]; then
echo $'Unable to create ZeroNet mail' >> $INSTALL_LOG echo $'Unable to create ZeroNet mail' >> $INSTALL_LOG
exit 72574 exit 72574
fi fi
@ -188,24 +190,24 @@ function configure_zeronet_mail {
exit 1639 exit 1639
fi fi
if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
exit 7638 exit 7638
fi fi
echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" >> $INSTALL_LOG echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" >> $INSTALL_LOG
cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS cp -r $MESH_INSTALL_DIR/zeronet/ZeroMail/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS
if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
fi fi
cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html 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
sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json sed -i "s/Mailging platform Demo/Mailging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
# Add an avahi service # Add an avahi service
@ -237,9 +239,9 @@ function configure_zeronet_forum {
echo $'Updating ZeroNet Forum' >> $INSTALL_LOG echo $'Updating ZeroNet Forum' >> $INSTALL_LOG
ZERONET_DEFAULT_FORUM_TITLE="${MY_USERNAME}'s Forum" ZERONET_DEFAULT_FORUM_TITLE="${MY_USERNAME}'s Forum"
cd /opt/zeronet cd $MESH_INSTALL_DIR/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/forum.txt python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/forum.txt
if [ ! -f /opt/zeronet/forum.txt ]; then if [ ! -f $MESH_INSTALL_DIR/zeronet/forum.txt ]; then
echo $'Unable to create ZeroNet forum' >> $INSTALL_LOG echo $'Unable to create ZeroNet forum' >> $INSTALL_LOG
exit 47962 exit 47962
fi fi
@ -262,19 +264,19 @@ function configure_zeronet_forum {
exit 87356 exit 87356
fi fi
if [ ! -d "/opt/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_FORUM_ADDRESS" >> $INSTALL_LOG echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS" >> $INSTALL_LOG
exit 7638 exit 7638
fi fi
echo $"Forum address: $ZERONET_FORUM_ADDRESS" echo $"Forum address: $ZERONET_FORUM_ADDRESS"
echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY" echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroTalk/* /opt/zeronet/data/$ZERONET_FORUM_ADDRESS cp -r $MESH_INSTALL_DIR/zeronet/ZeroTalk/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS
sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
sed -i "s/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html sed -i "s/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
sed -i "s|Demo for dynamic, decentralized content publishing.|$ZERONET_DEFAULT_FORUM_TAGLINE|g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html sed -i "s|Demo for dynamic, decentralized content publishing.|$ZERONET_DEFAULT_FORUM_TAGLINE|g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/index.html
sed -i 's/Messaging Board Demo/Messaging Board/g' /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json sed -i 's/Messaging Board Demo/Messaging Board/g' $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
# Add an avahi service # Add an avahi service
@ -305,9 +307,9 @@ function configure_zeronet_forum {
function configure_zeronet_id { function configure_zeronet_id {
echo $'Updating ZeroID' >> $INSTALL_LOG echo $'Updating ZeroID' >> $INSTALL_LOG
cd /opt/zeronet cd $MESH_INSTALL_DIR/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/zeroid.txt python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/zeroid.txt
if [ ! -f /opt/zeronet/zeroid.txt ]; then if [ ! -f $MESH_INSTALL_DIR/zeronet/zeroid.txt ]; then
echo $'Unable to create ZeroID' >> $INSTALL_LOG echo $'Unable to create ZeroID' >> $INSTALL_LOG
exit 47962 exit 47962
fi fi
@ -330,16 +332,16 @@ function configure_zeronet_id {
exit 87356 exit 87356
fi fi
if [ ! -d "/opt/zeronet/data/$ZERONET_ID_ADDRESS" ]; then if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_ID_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_ID_ADDRESS" >> $INSTALL_LOG echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_ID_ADDRESS" >> $INSTALL_LOG
exit 378434 exit 378434
fi fi
echo $"ZeroID address: $ZERONET_ID_ADDRESS" echo $"ZeroID address: $ZERONET_ID_ADDRESS"
echo $"ZeroID private key: $ZERONET_ID_PRIVATE_KEY" echo $"ZeroID private key: $ZERONET_ID_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroID/* /opt/zeronet/data/$ZERONET_ID_ADDRESS cp -r $MESH_INSTALL_DIR/zeronet/ZeroID/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_ID_ADDRESS
# TODO # TODO
sed -i "s///g" /opt/zeronet/data/$ZERONET_ID_ADDRESS/content.json sed -i "s///g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_ID_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_ID_ADDRESS $ZERONET_ID_PRIVATE_KEY --inner_path data/users/content.json python zeronet.py siteSign $ZERONET_ID_ADDRESS $ZERONET_ID_PRIVATE_KEY --inner_path data/users/content.json
# Add an avahi service # Add an avahi service

View File

@ -75,6 +75,8 @@ ZERONET_PORT=
# Directory where source code is downloaded and compiled # Directory where source code is downloaded and compiled
INSTALL_DIR=$HOME/build INSTALL_DIR=$HOME/build
MESH_INSTALL_DIR=/var/lib
function show_help { function show_help {
echo '' echo ''
echo $"${PROJECT_NAME}-mesh-install -f [function] -r [rootdir]" echo $"${PROJECT_NAME}-mesh-install -f [function] -r [rootdir]"
@ -682,25 +684,25 @@ function mesh_zeronet {
$CHROOT_PREFIX pip install msgpack-python --upgrade $CHROOT_PREFIX pip install msgpack-python --upgrade
$CHROOT_PREFIX pip install gevent --upgrade $CHROOT_PREFIX pip install gevent --upgrade
$CHROOT_PREFIX useradd -d /opt/zeronet/ -s /bin/false zeronet $CHROOT_PREFIX useradd -d $MESH_INSTALL_DIR/zeronet/ -s /bin/false zeronet
git_clone $ZERONET_REPO $rootdir/opt/zeronet git_clone $ZERONET_REPO $rootdir$MESH_INSTALL_DIR/zeronet
if [ ! -d $rootdir/opt/zeronet ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet ]; then
echo 'WARNING: Unable to clone zeronet' echo 'WARNING: Unable to clone zeronet'
return return
fi fi
cd $rootdir/opt/zeronet cd $rootdir$MESH_INSTALL_DIR/zeronet
git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then if ! grep -q "ZeroNet commit" $COMPLETION_FILE; then
echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE echo "ZeroNet commit:$ZERONET_COMMIT" >> $rootdir$COMPLETION_FILE
else else
sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
fi fi
chown -R zeronet:zeronet $rootdir/opt/zeronet chown -R zeronet:zeronet $rootdir$MESH_INSTALL_DIR/zeronet
# Hack to ensure that the file access port is opened # Hack to ensure that the file access port is opened
# This is because zeronet normally relies on an internet site # This is because zeronet normally relies on an internet site
# to do this, but on a purely local mesh the internet isn't available # to do this, but on a purely local mesh the internet isn't available
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 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
ZERPNET_DAEMON=$rootdir/etc/systemd/system/zeronet.service ZERPNET_DAEMON=$rootdir/etc/systemd/system/zeronet.service
echo '[Unit]' > $ZERONET_DAEMON echo '[Unit]' > $ZERONET_DAEMON
@ -711,8 +713,8 @@ function mesh_zeronet {
echo 'Type=simple' >> $ZERONET_DAEMON echo 'Type=simple' >> $ZERONET_DAEMON
echo 'User=zeronet' >> $ZERONET_DAEMON echo 'User=zeronet' >> $ZERONET_DAEMON
echo 'Group=zeronet' >> $ZERONET_DAEMON echo 'Group=zeronet' >> $ZERONET_DAEMON
echo 'WorkingDirectory=/opt/zeronet' >> $ZERONET_DAEMON echo "WorkingDirectory=$MESH_INSTALL_DIR/zeronet" >> $ZERONET_DAEMON
echo 'ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file /opt/zeronet/bootstrap' >> $ZERONET_DAEMON echo "ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file $MESH_INSTALL_DIR/zeronet/bootstrap" >> $ZERONET_DAEMON
echo '' >> $ZERONET_DAEMON echo '' >> $ZERONET_DAEMON
echo 'TimeoutSec=300' >> $ZERONET_DAEMON echo 'TimeoutSec=300' >> $ZERONET_DAEMON
echo '' >> $ZERONET_DAEMON echo '' >> $ZERONET_DAEMON
@ -728,19 +730,19 @@ function mesh_zeronet {
echo 'Type=simple' >> $TRACKER_DAEMON echo 'Type=simple' >> $TRACKER_DAEMON
echo 'User=tracker' >> $TRACKER_DAEMON echo 'User=tracker' >> $TRACKER_DAEMON
echo 'Group=tracker' >> $TRACKER_DAEMON echo 'Group=tracker' >> $TRACKER_DAEMON
echo 'WorkingDirectory=/opt/tracker' >> $TRACKER_DAEMON echo "WorkingDirectory=$MESH_INSTALL_DIR/tracker" >> $TRACKER_DAEMON
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 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
echo '' >> $TRACKER_DAEMON echo '' >> $TRACKER_DAEMON
echo 'TimeoutSec=300' >> $TRACKER_DAEMON echo 'TimeoutSec=300' >> $TRACKER_DAEMON
echo '' >> $TRACKER_DAEMON echo '' >> $TRACKER_DAEMON
echo '[Install]' >> $TRACKER_DAEMON echo '[Install]' >> $TRACKER_DAEMON
echo 'WantedBy=multi-user.target' >> $TRACKER_DAEMON echo 'WantedBy=multi-user.target' >> $TRACKER_DAEMON
$CHROOT_PREFIX useradd -d /opt/tracker/ -s /bin/false tracker $CHROOT_PREFIX useradd -d $MESH_INSTALL_DIR/tracker/ -s /bin/false tracker
if [ ! -d $rootdir/opt/tracker ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/tracker ]; then
mkdir $rootdir/opt/tracker mkdir $rootdir$MESH_INSTALL_DIR/tracker
fi fi
chown -R tracker:tracker $rootdir/opt/tracker chown -R tracker:tracker $rootdir$MESH_INSTALL_DIR/tracker
# publish regularly # publish regularly
echo "* * * * * root zeronetavahi > /dev/null" >> $rootdir/etc/crontab echo "* * * * * root zeronetavahi > /dev/null" >> $rootdir/etc/crontab

View File

@ -61,6 +61,8 @@ ZERONET_DEFAULT_MAIL_TAGLINE=$"Mail for the Mesh"
IPFS_PORT=4001 IPFS_PORT=4001
MESH_INSTALL_DIR=/var/lib
function install_ipfs { function install_ipfs {
if [ ! -f /home/$MY_USERNAME/go/bin/ipfs ]; then if [ ! -f /home/$MY_USERNAME/go/bin/ipfs ]; then
if [ ! -d /usr/local/go ]; then if [ ! -d /usr/local/go ]; then
@ -182,7 +184,7 @@ function install_zeronet_blog {
echo $'ZeroBlog repo could not be cloned' echo $'ZeroBlog repo could not be cloned'
exit 6739 exit 6739
fi fi
cd /opt/zeronet/ZeroBlog cd $MESH_INSTALL_DIR/zeronet/ZeroBlog
git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
echo $"Blog address: $ZERONET_BLOG_ADDRESS" echo $"Blog address: $ZERONET_BLOG_ADDRESS"
@ -243,9 +245,9 @@ function install_zeronet_mail {
ZERONET_DEFAULT_MAIL_TITLE=$"${MY_USERNAME}'s Mail" ZERONET_DEFAULT_MAIL_TITLE=$"${MY_USERNAME}'s Mail"
cd /opt/zeronet cd $MESH_INSTALL_DIR/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt python zeronet.py --batch siteCreate 2> $MESH_INSTALL_DIR/zeronet/mail.txt
if [ ! -f /opt/zeronet/mail.txt ]; then if [ ! -f $MESH_INSTALL_DIR/zeronet/mail.txt ]; then
echo 'Unable to create mail' echo 'Unable to create mail'
exit 479 exit 479
fi fi
@ -268,32 +270,32 @@ function install_zeronet_mail {
exit 1639 exit 1639
fi fi
if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then if [ ! -d "$MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS" echo $"Unable to find site directory: $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS"
exit 7638 exit 7638
fi fi
git clone $ZERONET_MAIL_REPO ZeroMail git clone $ZERONET_MAIL_REPO ZeroMail
if [ ! -d /opt/zeronet/ZeroMail ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
echo $'ZeroMail repo could not be cloned' echo $'ZeroMail repo could not be cloned'
exit 6739 exit 6739
fi fi
cd /opt/zeronet/ZeroMail cd $MESH_INSTALL_DIR/zeronet/ZeroMail
git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS" echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS"
echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS cp -r $MESH_INSTALL_DIR/zeronet/ZeroMail/* $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS
if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then if [ ! -d $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data mkdir $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
fi fi
cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data cp $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data
sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json sed -i "s/MyZeroMail/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json sed -i "s/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/data/data.json
sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html sed -i "s/ZeroMail Demo/$ZERONET_DEFAULT_MAIL_TITLE/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
sed -i "s|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html 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
sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json sed -i "s/Mailging platform Demo/Mailging platform/g" $MESH_INSTALL_DIR/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
# Add an avahi service # Add an avahi service
@ -375,7 +377,7 @@ function install_zeronet_forum {
echo $'ZeroTalk repo could not be cloned' echo $'ZeroTalk repo could not be cloned'
exit 6739 exit 6739
fi fi
cd /opt/zeronet/ZeroTalk cd $MESH_INSTALL_DIR/zeronet/ZeroTalk
git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
echo $"Forum address: $ZERONET_FORUM_ADDRESS" echo $"Forum address: $ZERONET_FORUM_ADDRESS"
@ -483,8 +485,8 @@ if [[ $SERVER_INSTALLATION == "no" ]]; then
fi fi
fi fi
if [ -d /opt/zeronet ]; then if [ -d $MESH_INSTALL_DIR/zeronet ]; then
ZERONET_DIR=/opt/zeronet ZERONET_DIR=$MESH_INSTALL_DIR/zeronet
fi fi
if [[ $SERVER_INSTALLATION == "no" ]]; then if [[ $SERVER_INSTALLATION == "no" ]]; then

View File

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