functions to remove babel
This commit is contained in:
parent
01e84bfc76
commit
879ab883fb
|
@ -32,38 +32,57 @@
|
||||||
ENABLE_BABEL="no"
|
ENABLE_BABEL="no"
|
||||||
BABEL_PORT=6696
|
BABEL_PORT=6696
|
||||||
|
|
||||||
function configure_firewall_for_babel {
|
function remove_babel {
|
||||||
if grep -Fxq "configure_firewall_for_babel" $COMPLETION_FILE; then
|
if ! grep -Fxq "mesh_babel" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ $ENABLE_BABEL != "yes" ]]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport $BABEL_PORT -j ACCEPT
|
|
||||||
function_check save_firewall_settings
|
|
||||||
save_firewall_settings
|
|
||||||
|
|
||||||
OPEN_PORTS+=("Babel $BABEL_PORT")
|
${PROJECT_NAME}-mesh-install -f babel --remove yes
|
||||||
echo 'configure_firewall_for_babel' >> $COMPLETION_FILE
|
if [ ! "$?" = "0" ]; then
|
||||||
|
echo $'Failed to remove babel'
|
||||||
|
exit 83658
|
||||||
|
fi
|
||||||
|
|
||||||
|
iptables -D INPUT -i $WIFI_INTERFACE -p udp --dport $BABEL_PORT -j ACCEPT
|
||||||
|
function_check save_firewall_settings
|
||||||
|
save_firewall_settings
|
||||||
|
|
||||||
|
sed -i '/mesh_babel/d' $COMPLETION_FILE
|
||||||
|
sed -i '/configure_firewall_for_babel/d' $COMPLETION_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
function configure_firewall_for_babel {
|
||||||
|
if grep -Fxq "configure_firewall_for_babel" $COMPLETION_FILE; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ $ENABLE_BABEL != "yes" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport $BABEL_PORT -j ACCEPT
|
||||||
|
function_check save_firewall_settings
|
||||||
|
save_firewall_settings
|
||||||
|
|
||||||
|
OPEN_PORTS+=("Babel $BABEL_PORT")
|
||||||
|
echo 'configure_firewall_for_babel' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function mesh_babel {
|
function mesh_babel {
|
||||||
if grep -Fxq "mesh_babel" $COMPLETION_FILE; then
|
if grep -Fxq "mesh_babel" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ $ENABLE_BABEL != "yes" ]]; then
|
if [[ $ENABLE_BABEL != "yes" ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${PROJECT_NAME}-mesh-install -f babel
|
${PROJECT_NAME}-mesh-install -f babel
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
echo $'Failed to install babel'
|
echo $'Failed to install babel'
|
||||||
exit 67242
|
exit 67242
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function_check configure_firewall_for_babel
|
function_check configure_firewall_for_babel
|
||||||
configure_firewall_for_babel
|
configure_firewall_for_babel
|
||||||
echo 'mesh_babel' >> $COMPLETION_FILE
|
echo 'mesh_babel' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
# NOTE: deliberately there is no "exit 0"
|
# NOTE: deliberately there is no "exit 0"
|
||||||
|
|
|
@ -77,6 +77,8 @@ INSTALL_DIR=$HOME/build
|
||||||
|
|
||||||
MESH_INSTALL_DIR=/var/lib
|
MESH_INSTALL_DIR=/var/lib
|
||||||
|
|
||||||
|
REMOVE='no'
|
||||||
|
|
||||||
source /usr/local/bin/${PROJECT_NAME}-utils-git
|
source /usr/local/bin/${PROJECT_NAME}-utils-git
|
||||||
if [ -f /usr/bin/${PROJECT_NAME}-utils-git ]; then
|
if [ -f /usr/bin/${PROJECT_NAME}-utils-git ]; then
|
||||||
source /usr/bin/${PROJECT_NAME}-utils-git
|
source /usr/bin/${PROJECT_NAME}-utils-git
|
||||||
|
@ -178,6 +180,13 @@ function mesh_babel {
|
||||||
$CHROOT_PREFIX systemctl enable babel
|
$CHROOT_PREFIX systemctl enable babel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mesh_babel_remove {
|
||||||
|
$CHROOT_PREFIX systemctl stop babel
|
||||||
|
$CHROOT_PREFIX apt-get -y remove --purge babeld
|
||||||
|
rm ${rootdir}/var/lib/babel
|
||||||
|
rm ${rootdir}/etc/systemd/system/babel.service
|
||||||
|
}
|
||||||
|
|
||||||
function mesh_avahi {
|
function mesh_avahi {
|
||||||
$CHROOT_PREFIX apt-get -y install avahi-utils avahi-autoipd avahi-dnsconfd
|
$CHROOT_PREFIX apt-get -y install avahi-utils avahi-autoipd avahi-dnsconfd
|
||||||
|
|
||||||
|
@ -1030,6 +1039,10 @@ do
|
||||||
shift
|
shift
|
||||||
FRIENDS_MIRRORS_SERVER="$1"
|
FRIENDS_MIRRORS_SERVER="$1"
|
||||||
;;
|
;;
|
||||||
|
--remove)
|
||||||
|
shift
|
||||||
|
REMOVE="$1"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
|
@ -1039,7 +1052,11 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $FN == 'babel' ]]; then
|
if [[ $FN == 'babel' ]]; then
|
||||||
mesh_babel
|
if [[ $REMOVE != 'yes' ]]; then
|
||||||
|
mesh_babel
|
||||||
|
else
|
||||||
|
mesh_babel_remove
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ $FN == 'babel_client' ]]; then
|
if [[ $FN == 'babel_client' ]]; then
|
||||||
mesh_babel_client
|
mesh_babel_client
|
||||||
|
|
Loading…
Reference in New Issue