| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 | 
							- #!/bin/bash
 - #
 - # .---.                  .              .
 - # |                      |              |
 - # |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
 - # |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
 - # '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
 - #
 - #                    Freedom in the Cloud
 - #
 - # Babel mesh functions
 - #
 - # License
 - # =======
 - #
 - # Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
 - #
 - # This program is free software: you can redistribute it and/or modify
 - # it under the terms of the GNU Affero General Public License as published by
 - # the Free Software Foundation, either version 3 of the License, or
 - # (at your option) any later version.
 - #
 - # This program is distributed in the hope that it will be useful,
 - # but WITHOUT ANY WARRANTY; without even the implied warranty of
 - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - # GNU Affero General Public License for more details.
 - #
 - # You should have received a copy of the GNU Affero General Public License
 - # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 - 
 - VARIANTS=''
 - 
 - ENABLE_BABEL="no"
 - BABEL_PORT=6696
 - 
 - function upgrade_babel {
 -     echo ''
 - }
 - 
 - function backup_local_babel {
 -     echo ''
 - }
 - 
 - function backup_remote_babel {
 -     echo ''
 - }
 - 
 - function remove_babel {
 -     if ! grep -Fxq "install_babel" $COMPLETION_FILE; then
 -         return
 -     fi
 - 
 -     ${PROJECT_NAME}-mesh-install -f babel --remove yes
 -     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 '/install_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 install_babel {
 -     if grep -Fxq "install_babel" $COMPLETION_FILE; then
 -         return
 -     fi
 -     if [[ $ENABLE_BABEL != "yes" ]]; then
 -         return
 -     fi
 - 
 -     ${PROJECT_NAME}-mesh-install -f babel
 -     if [ ! "$?" = "0" ]; then
 -         echo $'Failed to install babel'
 -         exit 67242
 -     fi
 - 
 -     function_check configure_firewall_for_babel
 -     configure_firewall_for_babel
 -     echo 'install_babel' >> $COMPLETION_FILE
 - }
 - 
 - # NOTE: deliberately there is no "exit 0"
 
 
  |