toxcore on mesh
This commit is contained in:
parent
28110a19b9
commit
72a47da79a
|
@ -331,20 +331,11 @@ function install_tox_client {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mesh_tox_node {
|
function mesh_tox_node {
|
||||||
# obtain commits from the main file
|
|
||||||
TOXCORE_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
|
||||||
if [ ${#TOXCORE_COMMIT_MAIN} -gt 10 ]; then
|
|
||||||
TOXCORE_COMMIT=$TOXCORE_COMMIT_MAIN
|
|
||||||
fi
|
|
||||||
if [ ! $TOXCORE_COMMIT ]; then
|
if [ ! $TOXCORE_COMMIT ]; then
|
||||||
echo $'No Tox commit was specified'
|
echo $'No Tox commit was specified'
|
||||||
exit 76325
|
exit 76325
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TOXCORE_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}')
|
|
||||||
if [ ${#TOXCORE_REPO_MAIN} -gt 10 ]; then
|
|
||||||
TOXCORE_REPO=$TOXCORE_REPO_MAIN
|
|
||||||
fi
|
|
||||||
if [ ! $TOXCORE_REPO ]; then
|
if [ ! $TOXCORE_REPO ]; then
|
||||||
echo $'No Tox repo was specified'
|
echo $'No Tox repo was specified'
|
||||||
exit 16865
|
exit 16865
|
||||||
|
@ -355,46 +346,33 @@ function mesh_tox_node {
|
||||||
chroot "$rootdir" apt-get -y install libsodium13 libsodium-dev libcap2-bin
|
chroot "$rootdir" apt-get -y install libsodium13 libsodium-dev libcap2-bin
|
||||||
chroot "$rootdir" apt-get -y install libconfig9 libconfig-dev
|
chroot "$rootdir" apt-get -y install libconfig9 libconfig-dev
|
||||||
|
|
||||||
|
|
||||||
TEMP_SCRIPT_NAME=fbtmp37272.sh
|
TEMP_SCRIPT_NAME=fbtmp37272.sh
|
||||||
TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME
|
TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME
|
||||||
echo '#!/bin/bash' > $TEMP_SCRIPT
|
|
||||||
echo "mkdir -p $INSTALL_DIR" >> $TEMP_SCRIPT
|
mkdir -p ${rootdir}${INSTALL_DIR}
|
||||||
echo "git clone $TOXCORE_REPO $INSTALL_DIR/toxcore" >> $TEMP_SCRIPT
|
git clone ${TOXCORE_REPO} ${rootdir}${INSTALL_DIR}/toxcore
|
||||||
echo "cd $INSTALL_DIR/toxcore" >> $TEMP_SCRIPT
|
chroot "$rootdir" cd $INSTALL_DIR/toxcore && git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT
|
||||||
echo "git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT" >> $TEMP_SCRIPT
|
chroot "$rootdir" cd $INSTALL_DIR/toxcore && autoreconf -i
|
||||||
echo 'autoreconf -i' >> $TEMP_SCRIPT
|
chroot "$rootdir" cd $INSTALL_DIR/toxcore && ./configure --enable-daemon --disable-av
|
||||||
echo './configure --enable-daemon --disable-av' >> $TEMP_SCRIPT
|
chroot "$rootdir" cd $INSTALL_DIR/toxcore && make
|
||||||
echo 'make' >> $TEMP_SCRIPT
|
if [ ! "$?" = "0" ]; then
|
||||||
echo 'if [ ! "$?" = "0" ]; then' >> $TEMP_SCRIPT
|
exit 429285
|
||||||
echo ' exit 1' >> $TEMP_SCRIPT
|
fi
|
||||||
echo 'fi' >> $TEMP_SCRIPT
|
chroot "$rootdir" cd $INSTALL_DIR/toxcore && make install
|
||||||
echo 'make install' >> $TEMP_SCRIPT
|
cp $rootdir/usr/local/lib/libtoxcore* $rootdir/usr/lib/
|
||||||
echo 'cp /usr/local/lib/libtoxcore* /usr/lib/' >> $TEMP_SCRIPT
|
cp ${rootdir}${INSTALL_DIR}/toxcore/other/bootstrap_daemon/tox-bootstrapd.service $rootdir/etc/systemd/system/
|
||||||
echo "cp $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service /etc/systemd/system/" >> $TEMP_SCRIPT
|
sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' $rootdir/etc/systemd/system/tox-bootstrapd.service
|
||||||
echo "sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' /etc/systemd/system/tox-bootstrapd.service" >> $TEMP_SCRIPT
|
chroot "$rootdir" systemctl enable tox-bootstrapd.service
|
||||||
echo 'systemctl enable tox-bootstrapd.service' >> $TEMP_SCRIPT
|
|
||||||
echo 'exit 0' >> $TEMP_SCRIPT
|
|
||||||
chmod +x $TEMP_SCRIPT
|
|
||||||
cp $TEMP_SCRIPT $rootdir/root/
|
|
||||||
|
|
||||||
SECONDS=0
|
SECONDS=0
|
||||||
chroot "$rootdir" /root/$TEMP_SCRIPT_NAME
|
if [ ! -f $rootdir/usr/local/bin/tox-bootstrapd ]; then
|
||||||
if [ ! "$?" = "0" ]; then
|
|
||||||
duration=$SECONDS
|
duration=$SECONDS
|
||||||
echo $"Toxcore compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
|
echo $"Toxcore compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
|
||||||
echo $'Unable to make toxcore'
|
echo $'Unable to make toxcore'
|
||||||
rm $TEMP_SCRIPT
|
|
||||||
exit 73835
|
exit 73835
|
||||||
fi
|
fi
|
||||||
duration=$SECONDS
|
duration=$SECONDS
|
||||||
echo $"Toxcore compile $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
|
echo $"Toxcore compile $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
|
||||||
rm $TEMP_SCRIPT
|
|
||||||
|
|
||||||
if [ ! -f $rootdir/usr/local/bin/tox-bootstrapd ]; then
|
|
||||||
echo $"File not found /usr/local/bin/tox-bootstrapd"
|
|
||||||
exit 37825
|
|
||||||
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" 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
|
chroot "$rootdir" chmod 700 /var/lib/tox-bootstrapd
|
||||||
|
@ -452,46 +430,30 @@ function mesh_tox_avahi {
|
||||||
exit 87359
|
exit 87359
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TOXID_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
|
|
||||||
if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then
|
|
||||||
TOXID_REPO=$TOXID_REPO_MAIN
|
|
||||||
fi
|
|
||||||
if [ ! $TOXID_REPO ]; then
|
if [ ! $TOXID_REPO ]; then
|
||||||
echo $'No ToxID repo was specified'
|
echo $'No ToxID repo was specified'
|
||||||
exit 78252
|
exit 78252
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TEMP_SCRIPT_NAME=fbtmp5328252.sh
|
if [ ! -d ${rootdir}${INSTALL_DIR} ]; then
|
||||||
TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME
|
mkdir -p ${rootdir}${INSTALL_DIR}
|
||||||
echo '#!/bin/bash' > $TEMP_SCRIPT
|
|
||||||
echo "mkdir -p $INSTALL_DIR" >> $TEMP_SCRIPT
|
|
||||||
echo "git clone $TOXID_REPO $INSTALL_DIR/toxid" >> $TEMP_SCRIPT
|
|
||||||
echo "if [ ! -d $INSTALL_DIR/toxid ]; then" >> $TEMP_SCRIPT
|
|
||||||
echo ' exit 1' >> $TEMP_SCRIPT
|
|
||||||
echo 'fi' >> $TEMP_SCRIPT
|
|
||||||
echo "cd $INSTALL_DIR/toxid" >> $TEMP_SCRIPT
|
|
||||||
echo "make" >> $TEMP_SCRIPT
|
|
||||||
echo 'if [ ! "$?" = "0" ]; then' >> $TEMP_SCRIPT
|
|
||||||
echo ' exit 2' >> $TEMP_SCRIPT
|
|
||||||
echo 'fi' >> $TEMP_SCRIPT
|
|
||||||
echo 'make install' >> $TEMP_SCRIPT
|
|
||||||
echo 'if [ ! -f /usr/local/bin/toxavahi ]; then' >> $TEMP_SCRIPT
|
|
||||||
echo ' exit 3' >> $TEMP_SCRIPT
|
|
||||||
echo 'fi' >> $TEMP_SCRIPT
|
|
||||||
echo 'toxavahi' >> $TEMP_SCRIPT
|
|
||||||
echo 'echo "* * * * * root /usr/local/bin/toxavahi > /dev/null" >> /etc/crontab' >> $TEMP_SCRIPT
|
|
||||||
echo 'systemctl restart avahi-daemon' >> $TEMP_SCRIPT
|
|
||||||
echo 'exit 0' >> $TEMP_SCRIPT
|
|
||||||
chmod +x $TEMP_SCRIPT
|
|
||||||
cp $TEMP_SCRIPT $rootdir/root/
|
|
||||||
|
|
||||||
chroot "$rootdir" /root/$TEMP_SCRIPT_NAME
|
|
||||||
if [ ! "$?" = "0" ]; then
|
|
||||||
echo $"Unable to install toxid, returned $?"
|
|
||||||
rm $TEMP_SCRIPT
|
|
||||||
exit 62835
|
|
||||||
fi
|
fi
|
||||||
rm $TEMP_SCRIPT
|
|
||||||
|
git clone ${TOXID_REPO} ${rootdir}${INSTALL_DIR}/toxid
|
||||||
|
if [ ! -d ${rootdir}${INSTALL_DIR}/toxid ]; then
|
||||||
|
echo $'Unable to clone toxid repo'
|
||||||
|
exit 768352
|
||||||
|
fi
|
||||||
|
chroot "$rootdir" cd $INSTALL_DIR/toxid && make
|
||||||
|
if [ ! "$?" = "0" ]; then
|
||||||
|
echo $'Unable to make toxid'
|
||||||
|
exit 386823
|
||||||
|
fi
|
||||||
|
chroot "$rootdir" cd $INSTALL_DIR/toxid && make install
|
||||||
|
if [ ! -f $rootdir/usr/local/bin/toxavahi ]; then
|
||||||
|
exit 3621729
|
||||||
|
fi
|
||||||
|
echo "* * * * * root /usr/local/bin/toxavahi > /dev/null" >> $rootdir/etc/crontab
|
||||||
}
|
}
|
||||||
|
|
||||||
function mesh_tox_client {
|
function mesh_tox_client {
|
||||||
|
|
|
@ -680,10 +680,6 @@ function configure_user_interface {
|
||||||
|
|
||||||
# IRC client
|
# IRC client
|
||||||
chroot "$rootdir" apt-get -y install hexchat profanity
|
chroot "$rootdir" apt-get -y install hexchat profanity
|
||||||
|
|
||||||
# zeronet
|
|
||||||
|
|
||||||
# TODO
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue