Compile toxcore and toxic on mesh nodes

This does result in a delay before fully operational but avoids needing to cross compile while building the image, which adds complexity
This commit is contained in:
Bob Mottram 2016-05-28 15:13:03 +01:00
parent a83bf3e8ca
commit 043862ec9a
2 changed files with 410 additions and 273 deletions

View File

@ -640,35 +640,43 @@ function mesh_tox_node {
chroot "$rootdir" apt-get -y install libsodium13 libsodium-dev libcap2-bin
chroot "$rootdir" apt-get -y install libconfig9 libconfig-dev
chroot "$rootdir" git clone $TOXCORE_REPO $INSTALL_DIR/toxcore
chroot "$rootdir" cd $INSTALL_DIR/toxcore; git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT
if [ ! -d $rootdir$INSTALL_DIR ]; then
mkdir -p $rootdir$INSTALL_DIR
fi
git clone $TOXCORE_REPO $rootdir$INSTALL_DIR/toxcore
if [ ! -d $rootdir$INSTALL_DIR/toxcore ]; then
echo $'Unable to clone toxcore'
exit 543335
fi
cd $rootdir$INSTALL_DIR/toxcore
git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT
chroot "$rootdir" cd $INSTALL_DIR/toxcore; autoreconf -i
chroot "$rootdir" cd $INSTALL_DIR/toxcore; ./configure --enable-daemon --disable-av
if [ ! "$?" = "0" ]; then
return
fi
chroot "$rootdir" cd $INSTALL_DIR/toxcore; make
if [ ! "$?" = "0" ]; then
return
fi
chroot "$rootdir" cd $INSTALL_DIR/toxcore; make install
chroot "$rootdir" cp /usr/local/lib/libtoxcore* /usr/lib/
#chroot "$rootdir" cd $INSTALL_DIR/toxcore; autoreconf -i
#chroot "$rootdir" cd $INSTALL_DIR/toxcore; ./configure --enable-daemon --disable-av
#if [ ! "$?" = "0" ]; then
#return
#fi
#chroot "$rootdir" cd $INSTALL_DIR/toxcore; make
#if [ ! "$?" = "0" ]; then
#return
#fi
#chroot "$rootdir" cd $INSTALL_DIR/toxcore; make install
#chroot "$rootdir" cp /usr/local/lib/libtoxcore* /usr/lib/
if [ ! -f $rootdir/usr/local/bin/tox-bootstrapd ]; then
echo $"File not found /usr/local/bin/tox-bootstrapd"
return
fi
#if [ ! -f $rootdir/usr/local/bin/tox-bootstrapd ]; then
#echo $"File not found /usr/local/bin/tox-bootstrapd"
#return
#fi
chroot "$rootdir" useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment $"Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
chroot "$rootdir" chmod 700 /var/lib/tox-bootstrapd
if [ ! -f $rootdir/$INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf ]; then
echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf"
fi
#chroot "$rootdir" useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment $"Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
#chroot "$rootdir" chmod 700 /var/lib/tox-bootstrapd
#if [ ! -f $rootdir/$INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf ]; then
#echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf"
#fi
# remove Maildir
if [ -d $rootdir/var/lib/tox-bootstrapd/Maildir ]; then
rm -rf $rootdir/var/lib/tox-bootstrapd/Maildir
fi
#if [ -d $rootdir/var/lib/tox-bootstrapd/Maildir ]; then
#rm -rf $rootdir/var/lib/tox-bootstrapd/Maildir
#fi
# create configuration file
TOX_BOOTSTRAP_CONFIG=${rootdir}/etc/tox-bootstrapd.conf
@ -751,26 +759,18 @@ function mesh_tox_client {
chroot "$rootdir" apt-get -y install libncursesw5-dev libconfig-dev libqrencode-dev
chroot "$rootdir" apt-get -y install libcurl4-openssl-dev libvpx-dev libopenal-dev
if [ ! -f $rootdir$INSTALL_DIR ]; then
if [ ! -d $rootdir$INSTALL_DIR ]; then
mkdir -p $rootdir$INSTALL_DIR
fi
chroot "$rootdir" git clone $TOXIC_REPO $INSTALL_DIR/toxic
chroot "$rootdir" cd $INSTALL_DIR/toxic; git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT
git clone $TOXIC_REPO $rootdir$INSTALL_DIR/toxic
cd $rootdir$INSTALL_DIR/toxic
git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT
if ! grep -q "Toxic commit" $rootdir$COMPLETION_FILE; then
echo "Toxic commit:$TOXIC_COMMIT" >> $rootdir$COMPLETION_FILE
else
sed -i "s|Toxic commit.*|Toxic commit:$TOXIC_COMMIT|g" $rootdir$COMPLETION_FILE
fi
chroot "$rootdir" cd $INSTALL_DIR/toxic; make
if [ ! -f $INSTALL_DIR/toxic/build/toxic ]; then
exit 74872
fi
chroot "$rootdir" cd $INSTALL_DIR/toxic; make install
if [ ! -f $TOXIC_FILE ]; then
echo $'Tox client was not installed'
exit 63278
fi
}
function mesh_zeronet {

View File

@ -33,295 +33,432 @@ export TEXTDOMAINDIR="/usr/share/locale"
MY_USERNAME='fbone'
PEER_ID=
INSTALL_DIR=/root/build
INSTALL_LOG=/var/log/${PROJECT_NAME}.log
function change_avahi_name {
decarray=( 1 2 3 4 5 6 7 8 9 0 )
PEER_ID=${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}
sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
echo "New avahi name for this peer is P$PEER_ID"
toilet "mesh-$PEER_ID"
decarray=( 1 2 3 4 5 6 7 8 9 0 )
PEER_ID=${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}
sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
echo "New avahi name for this peer is P$PEER_ID"
toilet "mesh-$PEER_ID"
echo $"avahi name changed to P${PEER_ID}.local" >> $INSTALL_LOG
}
function regenerate_ssh_host_keys {
echo $"Regenerating ssh host keys"
rm -f /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
echo $'ssh host keys regenerated'
# remove small moduli
awk '$5 > 2000' /etc/ssh/moduli > ~/moduli
mv ~/moduli /etc/ssh/moduli
echo $'ssh small moduli removed'
echo $"Regenerating ssh host keys" >> $INSTALL_LOG
rm -f /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
echo $'ssh host keys regenerated' >> $INSTALL_LOG
# remove small moduli
awk '$5 > 2000' /etc/ssh/moduli > ~/moduli
mv ~/moduli /etc/ssh/moduli
echo $'ssh small moduli removed' >> $INSTALL_LOG
}
function configure_zeronet {
sed -i "s|replace.local|P${PEER_ID}.local|g" /etc/systemd/system/zeronet.service
sed -i "s|replace.local|P${PEER_ID}.local|g" /etc/systemd/system/zeronet.service
echo $"zeronet daemon updated to P${PEER_ID}.local" >> $INSTALL_LOG
}
function configure_zeronet_blog {
echo $'Updating ZeroNet Blog'
ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
echo $'Updating ZeroNet Blog' >> $INSTALL_LOG
ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
cd /opt/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/blog.txt
if [ ! -f /opt/zeronet/blog.txt ]; then
echo $'Unable to create ZeroNet blog'
exit 7386
fi
blog_address=$(cat blog.txt | grep "Site address" | awk -F ':' '{print $2}')
blog_private_key=$(cat blog.txt | grep "Site private key" | awk -F ':' '{print $2}')
ZERONET_BLOG_ADDRESS=${blog_address//[[:blank:]]/}
ZERONET_BLOG_PRIVATE_KEY=${blog_private_key//[[:blank:]]/}
cd /opt/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/blog.txt
if [ ! -f /opt/zeronet/blog.txt ]; then
echo $'Unable to create ZeroNet blog' >> $INSTALL_LOG
exit 7386
fi
blog_address=$(cat blog.txt | grep "Site address" | awk -F ':' '{print $2}')
blog_private_key=$(cat blog.txt | grep "Site private key" | awk -F ':' '{print $2}')
ZERONET_BLOG_ADDRESS=${blog_address//[[:blank:]]/}
ZERONET_BLOG_PRIVATE_KEY=${blog_private_key//[[:blank:]]/}
if [ ${#ZERONET_BLOG_ADDRESS} -lt 20 ]; then
echo $"Address: $ZERONET_BLOG_ADDRESS"
echo $"Public key: $ZERONET_BLOG_PRIVATE_KEY"
echo $'Unable to create zeronet blog address'
exit 7358
fi
if [ ${#ZERONET_BLOG_ADDRESS} -lt 20 ]; then
echo $"Address: $ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
echo $"Public key: $ZERONET_BLOG_PRIVATE_KEY" >> $INSTALL_LOG
echo $'Unable to create zeronet blog address' >> $INSTALL_LOG
exit 7358
fi
if [ ${#ZERONET_BLOG_PRIVATE_KEY} -lt 20 ]; then
echo $"Address: $ZERONET_BLOG_ADDRESS"
echo $"Public key: $ZERONET_BLOG_PRIVATE_KEY"
echo $'Unable to create zeronet blog private key'
exit 1639
fi
if [ ${#ZERONET_BLOG_PRIVATE_KEY} -lt 20 ]; then
echo $"Address: $ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
echo $"Public key: $ZERONET_BLOG_PRIVATE_KEY" >> $INSTALL_LOG
echo $'Unable to create zeronet blog private key' >> $INSTALL_LOG
exit 1639
fi
if [ ! -d "/opt/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_BLOG_ADDRESS"
exit 7638
fi
if [ ! -d "/opt/zeronet/data/$ZERONET_BLOG_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
exit 7638
fi
echo $"ZeroNet Blog address: $ZERONET_BLOG_ADDRESS"
echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroBlog/* /opt/zeronet/data/$ZERONET_BLOG_ADDRESS
echo $"ZeroNet Blog address: $ZERONET_BLOG_ADDRESS" >> $INSTALL_LOG
echo $"ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY" >> $INSTALL_LOG
cp -r /opt/zeronet/ZeroBlog/* /opt/zeronet/data/$ZERONET_BLOG_ADDRESS
if [ ! -d /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data
fi
cp /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json /opt/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/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" /opt/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|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_BLOG_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
sed -i "s/Blogging platform Demo/Blogging platform/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
if [ ! -d /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data
fi
cp /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/data-default/data.json /opt/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/My ZeroBlog./$ZERONET_DEFAULT_BLOG_TAGLINE/g" /opt/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|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_BLOG_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/index.html
sed -i "s/Blogging platform Demo/Blogging platform/g" /opt/zeronet/data/$ZERONET_BLOG_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_BLOG_ADDRESS $ZERONET_BLOG_PRIVATE_KEY
# update the avahi service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-blog.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-blog.service
echo '<service-group>' >> /tmp/zeronet-blog.service
echo ' <name replace-wildcards="yes">%h ZeroNet Blog</name>' >> /tmp/zeronet-blog.service
echo ' <service>' >> /tmp/zeronet-blog.service
echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-blog.service
echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-blog.service
echo " <txt-record>$ZERONET_URL/$ZERONET_BLOG_ADDRESS</txt-record>" >> /tmp/zeronet-blog.service
echo ' </service>' >> /tmp/zeronet-blog.service
echo '</service-group>' >> /tmp/zeronet-blog.service
cp /tmp/zeronet-blog.service /etc/avahi/services/zeronet-blog.service
# update the avahi service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-blog.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-blog.service
echo '<service-group>' >> /tmp/zeronet-blog.service
echo ' <name replace-wildcards="yes">%h ZeroNet Blog</name>' >> /tmp/zeronet-blog.service
echo ' <service>' >> /tmp/zeronet-blog.service
echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-blog.service
echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-blog.service
echo " <txt-record>$ZERONET_URL/$ZERONET_BLOG_ADDRESS</txt-record>" >> /tmp/zeronet-blog.service
echo ' </service>' >> /tmp/zeronet-blog.service
echo '</service-group>' >> /tmp/zeronet-blog.service
cp /tmp/zeronet-blog.service /etc/avahi/services/zeronet-blog.service
if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
mkdir -p /home/$MY_USERNAME/.config/zeronet
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
fi
echo "$ZERONET_URL/$ZERONET_BLOG_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/myblog
if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
mkdir -p /home/$MY_USERNAME/.config/zeronet
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
fi
echo "$ZERONET_URL/$ZERONET_BLOG_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/myblog
sed -i "s|ZeroNet Blog address.*|ZeroNet Blog address: $ZERONET_BLOG_ADDRESS|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Blog private key.*|ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Blog address.*|ZeroNet Blog address: $ZERONET_BLOG_ADDRESS|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Blog private key.*|ZeroNet Blog private key: $ZERONET_BLOG_PRIVATE_KEY|g" /home/$MY_USERNAME/README
echo $'Update of ZeroNet Blog completed' >> $INSTALL_LOG
}
function configure_zeronet_mail {
echo $'Updating ZeroNet Mail'
ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
echo $'Updating ZeroNet Mail' >> $INSTALL_LOG
ZERONET_DEFAULT_MAIL_TITLE="${MY_USERNAME}'s Mail"
cd /opt/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt
if [ ! -f /opt/zeronet/mail.txt ]; then
echo $'Unable to create ZeroNet mail'
exit 72574
fi
mail_address=$(cat mail.txt | grep "Site address" | awk -F ':' '{print $2}')
mail_private_key=$(cat mail.txt | grep "Site private key" | awk -F ':' '{print $2}')
ZERONET_MAIL_ADDRESS=${mail_address//[[:blank:]]/}
ZERONET_MAIL_PRIVATE_KEY=${mail_private_key//[[:blank:]]/}
cd /opt/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/mail.txt
if [ ! -f /opt/zeronet/mail.txt ]; then
echo $'Unable to create ZeroNet mail' >> $INSTALL_LOG
exit 72574
fi
mail_address=$(cat mail.txt | grep "Site address" | awk -F ':' '{print $2}')
mail_private_key=$(cat mail.txt | grep "Site private key" | awk -F ':' '{print $2}')
ZERONET_MAIL_ADDRESS=${mail_address//[[:blank:]]/}
ZERONET_MAIL_PRIVATE_KEY=${mail_private_key//[[:blank:]]/}
if [ ${#ZERONET_MAIL_ADDRESS} -lt 20 ]; then
echo $"Address: $ZERONET_MAIL_ADDRESS"
echo $"Public key: $ZERONET_MAIL_PRIVATE_KEY"
echo $'Unable to create zeronet mail address'
exit 7358
fi
if [ ${#ZERONET_MAIL_ADDRESS} -lt 20 ]; then
echo $"Address: $ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
echo $"Public key: $ZERONET_MAIL_PRIVATE_KEY" >> $INSTALL_LOG
echo $'Unable to create zeronet mail address' >> $INSTALL_LOG
exit 7358
fi
if [ ${#ZERONET_MAIL_PRIVATE_KEY} -lt 20 ]; then
echo $"Address: $ZERONET_MAIL_ADDRESS"
echo $"Public key: $ZERONET_MAIL_PRIVATE_KEY"
echo $'Unable to create zeronet mail private key'
exit 1639
fi
if [ ${#ZERONET_MAIL_PRIVATE_KEY} -lt 20 ]; then
echo $"Address: $ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
echo $"Public key: $ZERONET_MAIL_PRIVATE_KEY" >> $INSTALL_LOG
echo $'Unable to create zeronet mail private key' >> $INSTALL_LOG
exit 1639
fi
if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS"
exit 7638
fi
if [ ! -d "/opt/zeronet/data/$ZERONET_MAIL_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
exit 7638
fi
echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS"
echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS
echo $"ZeroNet Mail address: $ZERONET_MAIL_ADDRESS" >> $INSTALL_LOG
echo $"ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY" >> $INSTALL_LOG
cp -r /opt/zeronet/ZeroMail/* /opt/zeronet/data/$ZERONET_MAIL_ADDRESS
if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
fi
cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/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/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/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|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
if [ ! -d /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data ]; then
mkdir /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data
fi
cp /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/data-default/data.json /opt/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/My ZeroMail./$ZERONET_DEFAULT_MAIL_TAGLINE/g" /opt/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|<h3 class=\"description\">.*|<h3 class=\"description\">$ZERONET_DEFAULT_MAIL_TAGLINE</h3>|g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/index.html
sed -i "s/Mailging platform Demo/Mailging platform/g" /opt/zeronet/data/$ZERONET_MAIL_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_MAIL_ADDRESS $ZERONET_MAIL_PRIVATE_KEY
# Add an avahi service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-mail.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-mail.service
echo '<service-group>' >> /tmp/zeronet-mail.service
echo ' <name replace-wildcards="yes">%h ZeroNet Mail</name>' >> /tmp/zeronet-mail.service
echo ' <service>' >> /tmp/zeronet-mail.service
echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-mail.service
echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-mail.service
echo " <txt-record>$ZERONET_URL/$ZERONET_MAIL_ADDRESS</txt-record>" >> /tmp/zeronet-mail.service
echo ' </service>' >> /tmp/zeronet-mail.service
echo '</service-group>' >> /tmp/zeronet-mail.service
cp /tmp/zeronet-mail.service /etc/avahi/services/zeronet-mail.service
# Add an avahi service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-mail.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-mail.service
echo '<service-group>' >> /tmp/zeronet-mail.service
echo ' <name replace-wildcards="yes">%h ZeroNet Mail</name>' >> /tmp/zeronet-mail.service
echo ' <service>' >> /tmp/zeronet-mail.service
echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-mail.service
echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-mail.service
echo " <txt-record>$ZERONET_URL/$ZERONET_MAIL_ADDRESS</txt-record>" >> /tmp/zeronet-mail.service
echo ' </service>' >> /tmp/zeronet-mail.service
echo '</service-group>' >> /tmp/zeronet-mail.service
cp /tmp/zeronet-mail.service /etc/avahi/services/zeronet-mail.service
if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
mkdir -p /home/$MY_USERNAME/.config/zeronet
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
fi
echo "$ZERONET_URL/$ZERONET_MAIL_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/mymail
if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
mkdir -p /home/$MY_USERNAME/.config/zeronet
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
fi
echo "$ZERONET_URL/$ZERONET_MAIL_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/mymail
sed -i "s|ZeroNet Mail address.*|ZeroNet Mail address: $ZERONET_MAIL_ADDRESS|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Mail private key.*|ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Mail address.*|ZeroNet Mail address: $ZERONET_MAIL_ADDRESS|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Mail private key.*|ZeroNet Mail private key: $ZERONET_MAIL_PRIVATE_KEY|g" /home/$MY_USERNAME/README
echo $'Update of ZeroNet Mail completed' >> $INSTALL_LOG
}
function configure_zeronet_forum {
echo $'Updating ZeroNet Forum'
ZERONET_DEFAULT_FORUM_TITLE="${MY_USERNAME}'s Forum"
echo $'Updating ZeroNet Forum' >> $INSTALL_LOG
ZERONET_DEFAULT_FORUM_TITLE="${MY_USERNAME}'s Forum"
cd /opt/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/forum.txt
if [ ! -f /opt/zeronet/forum.txt ]; then
echo $'Unable to create ZeroNet forum'
exit 47962
fi
forum_address=$(cat forum.txt | grep "Site address" | awk -F ':' '{print $2}')
forum_private_key=$(cat forum.txt | grep "Site private key" | awk -F ':' '{print $2}')
ZERONET_FORUM_ADDRESS=${forum_address//[[:blank:]]/}
ZERONET_FORUM_PRIVATE_KEY=${forum_private_key//[[:blank:]]/}
cd /opt/zeronet
python zeronet.py --batch siteCreate 2> /opt/zeronet/forum.txt
if [ ! -f /opt/zeronet/forum.txt ]; then
echo $'Unable to create ZeroNet forum' >> $INSTALL_LOG
exit 47962
fi
forum_address=$(cat forum.txt | grep "Site address" | awk -F ':' '{print $2}')
forum_private_key=$(cat forum.txt | grep "Site private key" | awk -F ':' '{print $2}')
ZERONET_FORUM_ADDRESS=${forum_address//[[:blank:]]/}
ZERONET_FORUM_PRIVATE_KEY=${forum_private_key//[[:blank:]]/}
if [ ${#ZERONET_FORUM_ADDRESS} -lt 20 ]; then
echo $"Address: $ZERONET_FORUM_ADDRESS"
echo $"Public key: $ZERONET_FORUM_PRIVATE_KEY"
echo $'Unable to create zeronet forum address'
exit 76352
fi
if [ ${#ZERONET_FORUM_ADDRESS} -lt 20 ]; then
echo $"Address: $ZERONET_FORUM_ADDRESS" >> $INSTALL_LOG
echo $"Public key: $ZERONET_FORUM_PRIVATE_KEY" >> $INSTALL_LOG
echo $'Unable to create zeronet forum address' >> $INSTALL_LOG
exit 76352
fi
if [ ${#ZERONET_FORUM_PRIVATE_KEY} -lt 20 ]; then
echo $"Address: $ZERONET_FORUM_ADDRESS"
echo $"Public key: $ZERONET_FORUM_PRIVATE_KEY"
echo $'Unable to create zeronet forum private key'
exit 87356
fi
if [ ${#ZERONET_FORUM_PRIVATE_KEY} -lt 20 ]; then
echo $"Address: $ZERONET_FORUM_ADDRESS" >> $INSTALL_LOG
echo $"Public key: $ZERONET_FORUM_PRIVATE_KEY" >> $INSTALL_LOG
echo $'Unable to create zeronet forum private key' >> $INSTALL_LOG
exit 87356
fi
if [ ! -d "/opt/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_FORUM_ADDRESS"
exit 7638
fi
if [ ! -d "/opt/zeronet/data/$ZERONET_FORUM_ADDRESS" ]; then
echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_FORUM_ADDRESS" >> $INSTALL_LOG
exit 7638
fi
echo $"Forum address: $ZERONET_FORUM_ADDRESS"
echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroTalk/* /opt/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/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/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/Messaging Board Demo/Messaging Board/g' /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
echo $"Forum address: $ZERONET_FORUM_ADDRESS"
echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
cp -r /opt/zeronet/ZeroTalk/* /opt/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/ZeroTalk/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/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/Messaging Board Demo/Messaging Board/g' /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
sed -i "s/ZeroBoard/$ZERONET_DEFAULT_FORUM_TITLE/g" /opt/zeronet/data/$ZERONET_FORUM_ADDRESS/content.json
python zeronet.py siteSign $ZERONET_FORUM_ADDRESS $ZERONET_FORUM_PRIVATE_KEY --inner_path data/users/content.json
# Add an avahi service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-forum.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-forum.service
echo '<service-group>' >> /tmp/zeronet-forum.service
echo ' <name replace-wildcards="yes">%h ZeroNet Forum</name>' >> /tmp/zeronet-forum.service
echo ' <service>' >> /tmp/zeronet-forum.service
echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-forum.service
echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-forum.service
echo " <txt-record>$ZERONET_URL/$ZERONET_FORUM_ADDRESS</txt-record>" >> /tmp/zeronet-forum.service
echo ' </service>' >> /tmp/zeronet-forum.service
echo '</service-group>' >> /tmp/zeronet-forum.service
sudo cp /tmp/zeronet-forum.service /etc/avahi/services/zeronet-forum.service
# Add an avahi service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-forum.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-forum.service
echo '<service-group>' >> /tmp/zeronet-forum.service
echo ' <name replace-wildcards="yes">%h ZeroNet Forum</name>' >> /tmp/zeronet-forum.service
echo ' <service>' >> /tmp/zeronet-forum.service
echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-forum.service
echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-forum.service
echo " <txt-record>$ZERONET_URL/$ZERONET_FORUM_ADDRESS</txt-record>" >> /tmp/zeronet-forum.service
echo ' </service>' >> /tmp/zeronet-forum.service
echo '</service-group>' >> /tmp/zeronet-forum.service
sudo cp /tmp/zeronet-forum.service /etc/avahi/services/zeronet-forum.service
if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
mkdir -p /home/$MY_USERNAME/.config/zeronet
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
fi
echo "$ZERONET_URL/$ZERONET_FORUM_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/myforum
if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
mkdir -p /home/$MY_USERNAME/.config/zeronet
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
fi
echo "$ZERONET_URL/$ZERONET_FORUM_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/myforum
sed -i "s|ZeroNet Forum address.*|ZeroNet Forum address: $ZERONET_FORUM_ADDRESS|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Forum private key.*|ZeroNet Forum private key: $ZERONET_FORUM_PRIVATE_KEY|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Forum address.*|ZeroNet Forum address: $ZERONET_FORUM_ADDRESS|g" /home/$MY_USERNAME/README
sed -i "s|ZeroNet Forum private key.*|ZeroNet Forum private key: $ZERONET_FORUM_PRIVATE_KEY|g" /home/$MY_USERNAME/README
echo $'Update of ZeroNet Forum completed' >> $INSTALL_LOG
}
function configure_tox {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
function compile_toxcore {
echo $'Compiling toxcore' >> $INSTALL_LOG
if [ ! -d $INSTALL_DIR/toxcore ]; then
echo $"$INSTALL_DIR/toxcore not found" >> $INSTALL_LOG
return
fi
cd $INSTALL_DIR/toxcore
autoreconf -i
./configure --enable-daemon --disable-av
if [ ! "$?" = "0" ]; then
echo $'Unable to configure toxcore' >> $INSTALL_LOG
return
fi
chroot "$rootdir" make
if [ ! "$?" = "0" ]; then
echo $'Unable to make toxcore' >> $INSTALL_LOG
return
fi
make install
cp /usr/local/lib/libtoxcore* /usr/lib/
echo $'Regenerating Tox bootstrap node keys'
systemctl stop tox-bootstrapd.service
if [ -f /var/lib/tox-bootstrapd/keys ]; then
rm /var/lib/tox-bootstrapd/keys
fi
systemctl start tox-bootstrapd.service
TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
echo $'WARNING: Could not obtain the tox node public key'
exit 46362
fi
if [ ! -f $rootdir/usr/local/bin/tox-bootstrapd ]; then
echo $"File not found /usr/local/bin/tox-bootstrapd" >> $INSTALL_LOG
return
fi
# save the public key for later reference
echo "$TOX_PUBLIC_KEY" > $TOX_BOOTSTRAP_ID_FILE
useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment $"Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
chmod 700 /var/lib/tox-bootstrapd
if [ ! -f $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf ]; then
echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf" >> $INSTALL_LOG
fi
# remove Maildir
if [ -d /var/lib/tox-bootstrapd/Maildir ]; then
rm -rf /var/lib/tox-bootstrapd/Maildir
fi
echo $'Resetting toxic client'
if [ -d /home/$MY_USERNAME/.config/tox ]; then
rm -rf /home/$MY_USERNAME/.config/tox
su -c "echo 'n
/nick P$PEER_ID
/exit
' | $TOXIC_FILE -d" - $MY_USERNAME
fi
# create configuration file
TOX_BOOTSTRAP_CONFIG=/etc/tox-bootstrapd.conf
echo "port = $TOX_PORT" > $TOX_BOOTSTRAP_CONFIG
echo 'keys_file_path = "/var/lib/tox-bootstrapd/keys"' >> $TOX_BOOTSTRAP_CONFIG
echo 'pid_file_path = "/var/run/tox-bootstrapd/tox-bootstrapd.pid"' >> $TOX_BOOTSTRAP_CONFIG
echo 'enable_ipv6 = true' >> $TOX_BOOTSTRAP_CONFIG
echo 'enable_ipv4_fallback = true' >> $TOX_BOOTSTRAP_CONFIG
echo 'enable_lan_discovery = true' >> $TOX_BOOTSTRAP_CONFIG
echo 'enable_tcp_relay = true' >> $TOX_BOOTSTRAP_CONFIG
echo "tcp_relay_ports = [443, 3389, $TOX_PORT]" >> $TOX_BOOTSTRAP_CONFIG
echo 'enable_motd = true' >> $TOX_BOOTSTRAP_CONFIG
echo 'motd = "tox-bootstrapd"' >> $TOX_BOOTSTRAP_CONFIG
if [ $TOX_NODES ]; then
echo 'bootstrap_nodes = (' >> $TOX_BOOTSTRAP_CONFIG
toxcount=0
while [ "x${TOX_NODES[toxcount]}" != "x" ]
do
toxval_ipv4=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $1}')
toxval_ipv6=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $2}')
toxval_port=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $3}')
toxval_pubkey=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $4}')
toxval_maintainer=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $5}')
echo "{ // $toxval_maintainer" >> $TOX_BOOTSTRAP_CONFIG
if [[ $toxval_ipv6 != 'NONE' ]]; then
echo " address = \"$toxval_ipv6\"" >> $TOX_BOOTSTRAP_CONFIG
else
echo " address = \"$toxval_ipv4\"" >> $TOX_BOOTSTRAP_CONFIG
fi
echo " port = $toxval_port" >> $TOX_BOOTSTRAP_CONFIG
echo " public_key = \"$toxval_pubkey\"" >> $TOX_BOOTSTRAP_CONFIG
toxcount=$(( $toxcount + 1 ))
if [ "x${TOX_NODES[toxcount]}" != "x" ]; then
echo "}," >> $TOX_BOOTSTRAP_CONFIG
else
echo "}" >> $TOX_BOOTSTRAP_CONFIG
fi
done
echo ')' >> $TOX_BOOTSTRAP_CONFIG
fi
if [ ! -f $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service ]; then
echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service" >> $INSTALL_LOG
return
fi
cp $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service /etc/systemd/system/
sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' /etc/systemd/system/tox-bootstrapd.service
systemctl daemon-reload
systemctl enable tox-bootstrapd.service
echo $'toxcore compile completed' >> $INSTALL_LOG
}
function compile_tox_client {
echo $'Compiling tox client' >> $INSTALL_LOG
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
if [ ! -d $INSTALL_DIR/toxic ]; then
echo $"$INSTALL_DIR/toxic not found" >> $INSTALL_LOG
return
fi
cd $INSTALL_DIR/toxic
make
if [ ! -f $INSTALL_DIR/toxic/build/toxic ]; then
echo $'Unable to make tox client' >> $INSTALL_LOG
exit 74872
fi
make install
if [ ! -f $TOXIC_FILE ]; then
echo $"Tox client was not installed to $TOXIC_FILE" >> $INSTALL_LOG
exit 63278
fi
echo $'toxic client compile completed' >> $INSTALL_LOG
}
function configure_toxcore {
echo $'Configuring toxcore' >> $INSTALL_LOG
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
echo $'Regenerating Tox bootstrap node keys' >> $INSTALL_LOG
systemctl stop tox-bootstrapd.service
if [ -f /var/lib/tox-bootstrapd/keys ]; then
rm /var/lib/tox-bootstrapd/keys
fi
systemctl start tox-bootstrapd.service
TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
echo $'WARNING: Could not obtain the tox node public key' >> $INSTALL_LOG
exit 46362
fi
# save the public key for later reference
echo "$TOX_PUBLIC_KEY" > $TOX_BOOTSTRAP_ID_FILE
echo $'Configured toxcore' >> $INSTALL_LOG
echo $'Clearing toxic client settings' >> $INSTALL_LOG
if [ -d /home/$MY_USERNAME/.config/tox ]; then
rm -rf /home/$MY_USERNAME/.config/tox
fi
echo $'toxic client configured' >> $INSTALL_LOG
}
if [ -f /root/.initial_mesh_setup ]; then
if [ $1 ]; then
MY_USERNAME=$1
fi
if [ $1 ]; then
MY_USERNAME=$1
fi
# sleep in order to allow other daemons to start up
sleep 15
# sleep in order to allow other daemons to start up
sleep 15
change_avahi_name
regenerate_ssh_host_keys
configure_zeronet_blog
configure_zeronet_mail
configure_zeronet_forum
configure_tox
configure_zeronet
# clear the install log
if [ -f $INSTALL_LOG ]; then
rm $INSTALL_LOG
fi
rm /root/.initial_mesh_setup
systemctl disable mesh-setup.service
touch /root/.mesh_setup_completed
reboot
echo $'Beginning mesh node setup' >> $INSTALL_LOG
change_avahi_name
regenerate_ssh_host_keys
configure_zeronet_blog
configure_zeronet_mail
configure_zeronet_forum
compile_toxcore
compile_tox_client
configure_toxcore
configure_zeronet
rm /root/.initial_mesh_setup
systemctl disable mesh-setup.service
touch /root/.mesh_setup_completed
echo $'Mesh node setup complete. Rebooting...' >> $INSTALL_LOG
reboot
fi
exit 0