More generic
This commit is contained in:
parent
d9af8529d2
commit
e8702fed67
|
@ -420,10 +420,10 @@ function mesh_firewall {
|
|||
|
||||
function mesh_tox_node {
|
||||
# obtain commits from the main file
|
||||
if [ -f /usr/loca/bin/freedombone ]; then
|
||||
TOX_COMMIT_MAIN=$(cat /usr/local/bin/freedombone | grep "TOX_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
if [ -f /usr/loca/bin/${PROJECT_NAME} ]; then
|
||||
TOX_COMMIT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOX_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
else
|
||||
TOX_COMMIT_MAIN=$(cat /usr/bin/freedombone | grep "TOX_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
TOX_COMMIT_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOX_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
fi
|
||||
if [ ${#TOX_COMMIT_MAIN} -gt 10 ]; then
|
||||
TOX_COMMIT=$TOX_COMMIT_MAIN
|
||||
|
@ -433,10 +433,10 @@ function mesh_tox_node {
|
|||
exit 76325
|
||||
fi
|
||||
|
||||
if [ -f /usr/loca/bin/freedombone ]; then
|
||||
TOXID_REPO_MAIN=$(cat /usr/local/bin/freedombone | grep "TOXID_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
if [ -f /usr/loca/bin/${PROJECT_NAME} ]; then
|
||||
TOXID_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXID_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
else
|
||||
TOXID_REPO_MAIN=$(cat /usr/bin/freedombone | grep "TOXID_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
TOXID_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXID_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
fi
|
||||
if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then
|
||||
TOXID_REPO=$TOXID_REPO_MAIN
|
||||
|
@ -446,10 +446,10 @@ function mesh_tox_node {
|
|||
exit 78252
|
||||
fi
|
||||
|
||||
if [ -f /usr/loca/bin/freedombone ]; then
|
||||
TOX_PORT_MAIN=$(cat /usr/local/bin/freedombone | grep "TOX_PORT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
if [ -f /usr/loca/bin/${PROJECT_NAME} ]; then
|
||||
TOX_PORT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOX_PORT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
else
|
||||
TOX_PORT_MAIN=$(cat /usr/bin/freedombone | grep "TOX_PORT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
TOX_PORT_MAIN=$(cat /usr/bin/${PROJECT_NAME} | grep "TOX_PORT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
fi
|
||||
if [ ${#TOX_PORT_MAIN} -gt 2 ]; then
|
||||
TOX_PORT=$TOX_PORT_MAIN
|
||||
|
@ -459,105 +459,105 @@ function mesh_tox_node {
|
|||
exit 32856
|
||||
fi
|
||||
|
||||
if [ -f /usr/loca/bin/freedombone ]; then
|
||||
TOX_REPO_MAIN=$(cat /usr/local/bin/freedombone | grep "TOX_REPO=" | head -n 1 | awk -F "'" '{print $2}')
|
||||
else
|
||||
TOX_REPO_MAIN=$(cat /usr/bin/freedombone | 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
|
||||
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
|
||||
|
||||
$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 {
|
||||
|
|
Loading…
Reference in New Issue