Function to remove tox node

This commit is contained in:
Bob Mottram 2016-07-04 13:32:23 +01:00
parent 62e04497ce
commit 137821b926
2 changed files with 41 additions and 1 deletions

View File

@ -44,6 +44,26 @@ TOXIC_REPO="https://github.com/Tox/toxic"
TOXIC_COMMIT='cf16849b374e484a33a4dffa3dfb937b59d537f2' TOXIC_COMMIT='cf16849b374e484a33a4dffa3dfb937b59d537f2'
TOXIC_FILE=/usr/local/bin/toxic TOXIC_FILE=/usr/local/bin/toxic
function remove_tox_node {
if ! grep -Fxq "install_tox_node" $COMPLETION_FILE; then
return
fi
iptables -D INPUT -p tcp --dport $TOX_PORT -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
function_check remove_onion_service
remove_onion_service tox ${TOX_PORT}
${PROJECT_NAME}-mesh-install -f tox_node --remove yes
if [ ! "$?" = "0" ]; then
echo $'Failed to remove tox node'
exit 763836
fi
sed -i '/install_tox_node/d' $COMPLETION_FILE
}
function configure_firewall_for_tox { function configure_firewall_for_tox {
if grep -Fxq "configure_firewall_for_tox" $COMPLETION_FILE; then if grep -Fxq "configure_firewall_for_tox" $COMPLETION_FILE; then
return return

View File

@ -432,6 +432,22 @@ function mesh_firewall {
$CHROOT_PREFIX systemctl enable meshfirewall $CHROOT_PREFIX systemctl enable meshfirewall
} }
function mesh_tox_node_remove {
systemctl stop tox-bootstrapd
systemctl disable tox-bootstrapd
if [ -f /etc/systemd/system/tox-bootstrapd.service ]; then
rm /etc/systemd/system/tox-bootstrapd.service
fi
if [ -d $INSTALL_DIR/toxcore ]; then
cd $INSTALL_DIR/toxcore
make uninstall
rm -rf $INSTALL_DIR/toxcore
fi
if [ -f /etc/tox-bootstrapd.conf ]; then
rm /etc/tox-bootstrapd.conf
fi
}
function mesh_tox_node { function mesh_tox_node {
# obtain commits from the main file # obtain commits from the main file
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
@ -1083,7 +1099,11 @@ if [[ $FN == 'batman_client' ]]; then
mesh_batman_client mesh_batman_client
fi fi
if [[ $FN == 'tox_node' ]]; then if [[ $FN == 'tox_node' ]]; then
if [[ $REMOVE != 'yes' ]]; then
mesh_tox_node mesh_tox_node
else
mesh_tox_node_remove
fi
fi fi
if [[ $FN == 'tox_client' ]]; then if [[ $FN == 'tox_client' ]]; then
mesh_tox_client mesh_tox_client