From 64a64641d1891147c297b12bc4543a2f4b97428b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 3 Jul 2016 19:54:48 +0100 Subject: [PATCH] functions to remove batman --- src/freedombone-app-batman | 14 ++++++++++++++ src/freedombone-mesh-install | 11 ++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/freedombone-app-batman b/src/freedombone-app-batman index c159f178..99db647d 100755 --- a/src/freedombone-app-batman +++ b/src/freedombone-app-batman @@ -45,6 +45,20 @@ function configure_firewall_for_batman { echo 'configure_firewall_for_batman' >> $COMPLETION_FILE } +function remove_batman { + if ! grep -Fxq "mesh_batman" $COMPLETION_FILE; then + return + fi + + ${PROJECT_NAME}-mesh-install -f batman --remove yes + if [ ! "$?" = "0" ]; then + echo $'Failed to remove batman' + exit 79353 + fi + sed -i '/mesh_batman/d' $COMPLETION_FILE + sed -i '/configure_firewall_for_batman/d' $COMPLETION_FILE +} + function mesh_batman { if grep -Fxq "mesh_batman" $COMPLETION_FILE; then return diff --git a/src/freedombone-mesh-install b/src/freedombone-mesh-install index 3ded1046..5372caa3 100755 --- a/src/freedombone-mesh-install +++ b/src/freedombone-mesh-install @@ -333,6 +333,11 @@ function mesh_babel_client { sudo mv $babel_script ${rootdir}/usr/bin/babel } +function mesh_batman_remove { + systemctl stop batman + rm $rootdir/var/lib/batman + rm $rootdir/etc/systemd/system/batman.service +} function mesh_batman { $CHROOT_PREFIX apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl @@ -1068,7 +1073,11 @@ if [[ $FN == 'firewall' ]]; then mesh_firewall fi if [[ $FN == 'batman' ]]; then - mesh_batman + if [[ $REMOVE != 'yes' ]]; then + mesh_batman + else + mesh_batman_remove + fi fi if [[ $FN == 'batman_client' ]]; then mesh_batman_client