diff --git a/src/freedombone-app-tox b/src/freedombone-app-tox index 51e7f309..3293c16d 100755 --- a/src/freedombone-app-tox +++ b/src/freedombone-app-tox @@ -62,6 +62,40 @@ function remove_tox_node { exit 763836 fi sed -i '/install_tox_node/d' $COMPLETION_FILE + sed -i '/configure_firewall_for_tox/d' $COMPLETION_FILE +} + +function remove_tox_avahi { + if ! grep -Fxq "tox_avahi" $COMPLETION_FILE; then + return + fi + cd $INSTALL_DIR/toxid + make uninstall + rm -rf $INSTALL_DIR/toxid + sed -i '/toxavahi/d' /etc/crontab + systemctl restart cron + sed -i '/tox_avahi/d' $COMPLETION_FILE +} + +function remove_tox_client { + if ! grep -Fxq "install_tox_client" $COMPLETION_FILE; then + return + fi + + ${PROJECT_NAME}-mesh-install -f tox_client --remove yes + if [ ! "$?" = "0" ]; then + echo $'Could not remove Tox client' + exit 737253 + fi + sed -i '/install_tox_client/d' $COMPLETION_FILE + sed -i '/Tox /d' $COMPLETION_FILE + sed -i '/Toxic /d' $COMPLETION_FILE +} + +function remove_tox { + remove_tox_client + remove_tox_avahi + remove_tox_node } function configure_firewall_for_tox { diff --git a/src/freedombone-mesh-install b/src/freedombone-mesh-install index 0c0f6c0f..4085c8a0 100755 --- a/src/freedombone-mesh-install +++ b/src/freedombone-mesh-install @@ -589,6 +589,15 @@ function mesh_tox_node { $CHROOT_PREFIX systemctl enable tox-bootstrapd.service } +function mesh_tox_client_remove { + if [ ! -d $INSTALL_DIR/toxic ]; then + return + fi + cd $INSTALL_DIR/toxic + make uninstall + rm -rf $INSTALL_DIR/toxic +} + function mesh_tox_client { if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}') @@ -1106,7 +1115,11 @@ if [[ $FN == 'tox_node' ]]; then fi fi if [[ $FN == 'tox_client' ]]; then - mesh_tox_client + if [[ $REMOVE != 'yes' ]]; then + mesh_tox_client + else + mesh_tox_client_remove + fi fi if [[ $FN == 'zeronet' ]]; then mesh_zeronet