Browse Source

functions to remove batman

Bob Mottram 9 years ago
parent
commit
64a64641d1
2 changed files with 24 additions and 1 deletions
  1. 14
    0
      src/freedombone-app-batman
  2. 10
    1
      src/freedombone-mesh-install

+ 14
- 0
src/freedombone-app-batman View File

45
 	echo 'configure_firewall_for_batman' >> $COMPLETION_FILE
45
 	echo 'configure_firewall_for_batman' >> $COMPLETION_FILE
46
 }
46
 }
47
 
47
 
48
+function remove_batman {
49
+	if ! grep -Fxq "mesh_batman" $COMPLETION_FILE; then
50
+		return
51
+	fi
52
+
53
+	${PROJECT_NAME}-mesh-install -f batman --remove yes
54
+	if [ ! "$?" = "0" ]; then
55
+		echo $'Failed to remove batman'
56
+		exit 79353
57
+	fi
58
+	sed -i '/mesh_batman/d' $COMPLETION_FILE
59
+	sed -i '/configure_firewall_for_batman/d' $COMPLETION_FILE
60
+}
61
+
48
 function mesh_batman {
62
 function mesh_batman {
49
 	if grep -Fxq "mesh_batman" $COMPLETION_FILE; then
63
 	if grep -Fxq "mesh_batman" $COMPLETION_FILE; then
50
 		return
64
 		return

+ 10
- 1
src/freedombone-mesh-install View File

333
 	sudo mv $babel_script ${rootdir}/usr/bin/babel
333
 	sudo mv $babel_script ${rootdir}/usr/bin/babel
334
 }
334
 }
335
 
335
 
336
+function mesh_batman_remove {
337
+	systemctl stop batman
338
+	rm $rootdir/var/lib/batman
339
+	rm $rootdir/etc/systemd/system/batman.service
340
+}
336
 
341
 
337
 function mesh_batman {
342
 function mesh_batman {
338
 	$CHROOT_PREFIX apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
343
 	$CHROOT_PREFIX apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
1068
 	mesh_firewall
1073
 	mesh_firewall
1069
 fi
1074
 fi
1070
 if [[ $FN == 'batman' ]]; then
1075
 if [[ $FN == 'batman' ]]; then
1071
-	mesh_batman
1076
+	if [[ $REMOVE != 'yes' ]]; then
1077
+		mesh_batman
1078
+	else
1079
+		mesh_batman_remove
1080
+	fi
1072
 fi
1081
 fi
1073
 if [[ $FN == 'batman_client' ]]; then
1082
 if [[ $FN == 'batman_client' ]]; then
1074
 	mesh_batman_client
1083
 	mesh_batman_client