Obtain zeronet variables from the main install file
This commit is contained in:
parent
e8702fed67
commit
35c76bb980
|
@ -484,7 +484,6 @@ TOX_NODES=
|
|||
TOXIC_REPO="https://github.com/Tox/toxic"
|
||||
TOXIC_COMMIT='4e0e322e32b0d7b5d1692f72876ac7f9ae2e610a'
|
||||
|
||||
#ZERONET_REPO='https://github.com/HelloZeroNet/ZeroNet.git'
|
||||
ZERONET_REPO="https://github.com/HelloZeroNet/ZeroNet.git"
|
||||
ZERONET_COMMIT='675bd462556c541d65e2d95f91f899146a373aad'
|
||||
ZERONET_BLOG_REPO="https://github.com/HelloZeroNet/ZeroBlog"
|
||||
|
|
|
@ -67,8 +67,10 @@ TOX_NODES=
|
|||
# '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
|
||||
# '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
|
||||
#)
|
||||
ZERONET_REPO="https://github.com/HelloZeroNet/ZeroNet.git"
|
||||
ZERONET_COMMIT='675bd462556c541d65e2d95f91f899146a373aad'
|
||||
|
||||
# To avoid confusions these are obtained from the main project file
|
||||
ZERONET_REPO=
|
||||
ZERONET_COMMIT=
|
||||
|
||||
function show_help {
|
||||
echo ''
|
||||
|
@ -460,104 +462,104 @@ function mesh_tox_node {
|
|||
fi
|
||||
|
||||
if [ -f /usr/loca/bin/${PROJECT_NAME} ]; then
|
||||
TOX_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOX_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
else
|
||||
TOX_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOX_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
fi
|
||||
if [ ${#TOX_REPO_MAIN} -gt 10 ]; then
|
||||
TOX_REPO=$TOX_REPO_MAIN
|
||||
fi
|
||||
if [ ! $TOX_REPO ]; then
|
||||
echo $'No Tox repo was specified'
|
||||
exit 16865
|
||||
fi
|
||||
TOX_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOX_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
else
|
||||
TOX_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOX_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
fi
|
||||
if [ ${#TOX_REPO_MAIN} -gt 10 ]; then
|
||||
TOX_REPO=$TOX_REPO_MAIN
|
||||
fi
|
||||
if [ ! $TOX_REPO ]; then
|
||||
echo $'No Tox repo was specified'
|
||||
exit 16865
|
||||
fi
|
||||
|
||||
$CHROOT_PREFIX apt-get -y install build-essential libtool autotools-dev
|
||||
$CHROOT_PREFIX apt-get -y install automake checkinstall check git yasm
|
||||
$CHROOT_PREFIX apt-get -y install libsodium13 libsodium-dev libcap2-bin
|
||||
$CHROOT_PREFIX apt-get -y install libconfig9 libconfig-dev
|
||||
$CHROOT_PREFIX apt-get -y install build-essential libtool autotools-dev
|
||||
$CHROOT_PREFIX apt-get -y install automake checkinstall check git yasm
|
||||
$CHROOT_PREFIX apt-get -y install libsodium13 libsodium-dev libcap2-bin
|
||||
$CHROOT_PREFIX apt-get -y install libconfig9 libconfig-dev
|
||||
|
||||
$CHROOT_PREFIX git_clone $TOX_REPO $INSTALL_DIR/toxcore
|
||||
$CHROOT_PREFIX cd $INSTALL_DIR/toxcore
|
||||
$CHROOT_PREFIX git checkout $TOX_COMMIT -b $TOX_COMMIT
|
||||
$CHROOT_PREFIX git_clone $TOX_REPO $INSTALL_DIR/toxcore
|
||||
$CHROOT_PREFIX cd $INSTALL_DIR/toxcore
|
||||
$CHROOT_PREFIX git checkout $TOX_COMMIT -b $TOX_COMMIT
|
||||
|
||||
$CHROOT_PREFIX autoreconf -i
|
||||
$CHROOT_PREFIX ./configure --enable-daemon --disable-av
|
||||
if [ ! "$?" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
$CHROOT_PREFIX make
|
||||
if [ ! "$?" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
$CHROOT_PREFIX make install
|
||||
$CHROOT_PREFIX cp /usr/local/lib/libtoxcore* /usr/lib/
|
||||
$CHROOT_PREFIX autoreconf -i
|
||||
$CHROOT_PREFIX ./configure --enable-daemon --disable-av
|
||||
if [ ! "$?" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
$CHROOT_PREFIX make
|
||||
if [ ! "$?" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
$CHROOT_PREFIX make install
|
||||
$CHROOT_PREFIX 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_PREFIX 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_PREFIX 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
|
||||
$CHROOT_PREFIX 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_PREFIX 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
|
||||
|
||||
# create configuration file
|
||||
TOX_BOOTSTRAP_CONFIG=${rootdir}/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
|
||||
# create configuration file
|
||||
TOX_BOOTSTRAP_CONFIG=${rootdir}/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 [ $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 $rootdir/$INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service ]; then
|
||||
echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service"
|
||||
return
|
||||
fi
|
||||
cp $rootdir/$INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service $rootdir/etc/systemd/system/
|
||||
sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' $rootdir/etc/systemd/system/tox-bootstrapd.service
|
||||
if [ ! -f $rootdir/$INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service ]; then
|
||||
echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service"
|
||||
return
|
||||
fi
|
||||
cp $rootdir/$INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service $rootdir/etc/systemd/system/
|
||||
sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' $rootdir/etc/systemd/system/tox-bootstrapd.service
|
||||
|
||||
$CHROOT_PREFIX systemctl daemon-reload
|
||||
$CHROOT_PREFIX systemctl enable tox-bootstrapd.service
|
||||
$CHROOT_PREFIX systemctl daemon-reload
|
||||
$CHROOT_PREFIX systemctl enable tox-bootstrapd.service
|
||||
}
|
||||
|
||||
function mesh_tox_client {
|
||||
|
@ -587,6 +589,33 @@ function mesh_tox_client {
|
|||
}
|
||||
|
||||
function mesh_zeronet {
|
||||
# obtain commits from the main file
|
||||
if [ -f /usr/loca/bin/${PROJECT_NAME} ]; then
|
||||
ZERONET_COMMIT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
else
|
||||
ZERONET_COMMIT_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
fi
|
||||
if [ ${#ZERONET_COMMIT_MAIN} -gt 10 ]; then
|
||||
ZERONET_COMMIT=$ZERONET_COMMIT_MAIN
|
||||
fi
|
||||
if [ ! $ZERONET_COMMIT ]; then
|
||||
echo $'No Tox commit was specified'
|
||||
exit 37046
|
||||
fi
|
||||
|
||||
if [ -f /usr/loca/bin/${PROJECT_NAME} ]; then
|
||||
ZERONET_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
else
|
||||
ZERONET_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
fi
|
||||
if [ ${#ZERONET_REPO_MAIN} -gt 5 ]; then
|
||||
ZERONET_REPO=$ZERONET_REPO_MAIN
|
||||
fi
|
||||
if [ ! $ZERONET_REPO ]; then
|
||||
echo $'No Tox commit was specified'
|
||||
exit 37046
|
||||
fi
|
||||
|
||||
$CHROOT_PREFIX apt-get -y install python python-msgpack python-gevent
|
||||
$CHROOT_PREFIX apt-get -y install python-pip bittornado
|
||||
$CHROOT_PREFIX pip install msgpack-python --upgrade
|
||||
|
|
Loading…
Reference in New Issue