浏览代码

functions to remove batman

Bob Mottram 8 年前
父节点
当前提交
64a64641d1
共有 2 个文件被更改,包括 24 次插入1 次删除
  1. 14
    0
      src/freedombone-app-batman
  2. 10
    1
      src/freedombone-mesh-install

+ 14
- 0
src/freedombone-app-batman 查看文件

@@ -45,6 +45,20 @@ function configure_firewall_for_batman {
45 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 62
 function mesh_batman {
49 63
 	if grep -Fxq "mesh_batman" $COMPLETION_FILE; then
50 64
 		return

+ 10
- 1
src/freedombone-mesh-install 查看文件

@@ -333,6 +333,11 @@ function mesh_babel_client {
333 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 342
 function mesh_batman {
338 343
 	$CHROOT_PREFIX apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
@@ -1068,7 +1073,11 @@ if [[ $FN == 'firewall' ]]; then
1068 1073
 	mesh_firewall
1069 1074
 fi
1070 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 1081
 fi
1073 1082
 if [[ $FN == 'batman_client' ]]; then
1074 1083
 	mesh_batman_client