Mesh install

This commit is contained in:
Bob Mottram 2016-01-16 23:44:04 +00:00
parent 1657653079
commit bee3da28bc
4 changed files with 40 additions and 19 deletions

View File

@ -7030,10 +7030,10 @@ function install_tox_client {
exit 74872
fi
make install
su -c 'echo "n
su -c "echo 'n
/nick $MY_USERNAME
/exit
" | /usr/bin/toxic -d' - $MY_USERNAME
' | /usr/bin/toxic -d" - $MY_USERNAME
echo 'install_tox_client' >> $COMPLETION_FILE
}

View File

@ -301,7 +301,7 @@ EOF
echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
fi
else
echo ' echo ""'
echo " echo ''" >> $rootdir/root/.bashrc
fi
echo ' if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
echo " if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc
@ -501,7 +501,6 @@ mesh_firewall() {
mesh_tox_node() {
TOX_REPO='git://github.com/irungentoo/toxcore.git'
TOX_COMMIT='73b2144edcfd1ca617e9054479b66ab0c0361a14'
TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
# These are some default nodes, but you can replace them with trusted nodes
# as you prefer. See https://wiki.tox.im/Nodes
TOX_NODES=
@ -515,7 +514,7 @@ mesh_tox_node() {
chroot "$rootdir" apt-get -y install libsodium13 libsodium-dev libcap2-bin
chroot "$rootdir" apt-get -y install libconfig9 libconfig-dev
git clone $TOX_REPO $rootdir/$INSTALL_DIR/toxcore
chroot "$rootdir" git clone $TOX_REPO $INSTALL_DIR/toxcore
chroot "$rootdir" cd $INSTALL_DIR/toxcore
chroot "$rootdir" git checkout $TOX_COMMIT -b $TOX_COMMIT
@ -588,6 +587,18 @@ mesh_tox_node() {
chroot "$rootdir" systemctl enable tox-bootstrapd.service
}
function mesh_tox_client {
chroot "$rootdir" apt-get -y install libncursesw5-dev libconfig-dev libqrencode-dev libcurl4-openssl-dev
chroot "$rootdir" git clone $TOXIC_REPO $INSTALL_DIR/toxic
chroot "$rootdir" cd $INSTALL_DIR/toxic
chroot "$rootdir" git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT
echo "Toxic commit:$TOXIC_COMMIT" >> $rootdir$COMPLETION_FILE
chroot "$rootdir" make
chroot "$rootdir" make install
}
function mesh_zeronet {
ZERONET_REPO='https://github.com/HelloZeroNet/ZeroNet.git'
ZERONET_COMMIT='675bd462556c541d65e2d95f91f899146a373aad'
@ -621,7 +632,7 @@ function mesh_zeronet {
echo 'User=zeronet' >> $rootdir/etc/systemd/system/zeronet.service
echo 'Group=zeronet' >> $rootdir/etc/systemd/system/zeronet.service
echo 'WorkingDirectory=/opt/zeronet' >> $rootdir/etc/systemd/system/zeronet.service
echo "ExecStart=/usr/bin/python zeronet.py --ip_external ${DEFAULT_DOMAIN_NAME}.local --trackers_file /opt/zeronet/bootstrap" >> $rootdir/etc/systemd/system/zeronet.service
echo 'ExecStart=/usr/bin/python zeronet.py --ip_external replace.local --trackers_file /opt/zeronet/bootstrap' >> $rootdir/etc/systemd/system/zeronet.service
echo '' >> $rootdir/etc/systemd/system/zeronet.service
echo 'TimeoutSec=300' >> $rootdir/etc/systemd/system/zeronet.service
echo '' >> $rootdir/etc/systemd/system/zeronet.service
@ -665,6 +676,7 @@ initialise_mesh() {
mesh_avahi
mesh_batman
mesh_tox_node
mesh_tox_client
mesh_zeronet
MESH_SERVICE='mesh-setup.service'

View File

@ -32,6 +32,7 @@ export TEXTDOMAIN=${PROJECT_NAME}-image-mesh
export TEXTDOMAINDIR="/usr/share/locale"
MY_USERNAME='fbone'
PEER_ID=
function change_avahi_name {
decarray=( 1 2 3 4 5 6 7 8 9 0 )
@ -53,6 +54,10 @@ function regenerate_ssh_host_keys {
echo $'ssh small moduli removed'
}
function configure_zeronet {
sed -i "s|replace.local|P${PEER_ID}.local|g" /etc/systemd/system/zeronet.service
}
function configure_zeronet_blog {
echo $'Updating ZeroNet Blog'
ZERONET_DEFAULT_BLOG_TITLE="${MY_USERNAME}'s Blog"
@ -60,8 +65,8 @@ function configure_zeronet_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 blog'
exit 479
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}')
@ -132,8 +137,8 @@ function configure_zeronet_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 mail'
exit 479
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}')
@ -204,8 +209,8 @@ function configure_zeronet_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 forum'
exit 479
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}')
@ -274,8 +279,8 @@ function configure_tox {
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 'Could not obtain the tox node public key'
exit 6529
echo $'WARNING: Could not obtain the tox node public key'
exit 46362
fi
# save the public key for later reference
@ -284,10 +289,10 @@ function configure_tox {
echo $'Resetting toxic client'
if [ -d /home/$MY_USERNAME/.config/tox ]; then
rm -rf /home/$MY_USERNAME/.config/tox
su -c 'echo "n
/nick $MY_USERNAME
su -c "echo 'n
/nick P$PEER_ID
/exit
" | /usr/bin/toxic -d' - $MY_USERNAME
' | /usr/bin/toxic -d" - $MY_USERNAME
fi
}
@ -296,12 +301,16 @@ if [ -f /root/.initial_mesh_setup ]; then
MY_USERNAME=$1
fi
# 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
change_avahi_name
configure_zeronet
rm /root/.initial_mesh_setup
systemctl disable mesh-setup.service

View File

@ -33,7 +33,7 @@
PROJECT_NAME='freedombone'
export TEXTDOMAIN=$PROJECT_NAME
export TEXTDOMAIN=$PROJECT_NAME-zeronetavahi
export TEXTDOMAINDIR="/usr/share/locale"
WEB_PAGE_TITLE=$"${PROJECT_NAME} Mesh"