Function to remove tox

This commit is contained in:
Bob Mottram 2016-07-04 19:03:55 +01:00
parent 137821b926
commit 3f7be9c1d6
2 changed files with 48 additions and 1 deletions

View File

@ -62,6 +62,40 @@ function remove_tox_node {
exit 763836 exit 763836
fi fi
sed -i '/install_tox_node/d' $COMPLETION_FILE 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 { function configure_firewall_for_tox {

View File

@ -589,6 +589,15 @@ function mesh_tox_node {
$CHROOT_PREFIX systemctl enable tox-bootstrapd.service $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 { function mesh_tox_client {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then 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}') 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
fi fi
if [[ $FN == 'tox_client' ]]; then if [[ $FN == 'tox_client' ]]; then
mesh_tox_client if [[ $REMOVE != 'yes' ]]; then
mesh_tox_client
else
mesh_tox_client_remove
fi
fi fi
if [[ $FN == 'zeronet' ]]; then if [[ $FN == 'zeronet' ]]; then
mesh_zeronet mesh_zeronet