From 09bc79922617ac60a6fecf46ec6543310a21fa9e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 5 Jul 2016 08:22:33 +0100 Subject: [PATCH] Install functions --- src/freedombone-app-babel | 10 +++++----- src/freedombone-app-batman | 10 +++++----- src/freedombone-app-cjdns | 18 +++++++++--------- src/freedombone-image-customise | 4 ++-- src/freedombone-mesh-install | 24 ++++++++++++------------ src/freedombone-utils-setup | 8 ++++---- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/freedombone-app-babel b/src/freedombone-app-babel index 63bdf86b..46a9494c 100755 --- a/src/freedombone-app-babel +++ b/src/freedombone-app-babel @@ -37,7 +37,7 @@ function backup_babel { } function remove_babel { - if ! grep -Fxq "mesh_babel" $COMPLETION_FILE; then + if ! grep -Fxq "install_babel" $COMPLETION_FILE; then return fi @@ -51,7 +51,7 @@ function remove_babel { function_check save_firewall_settings save_firewall_settings - sed -i '/mesh_babel/d' $COMPLETION_FILE + sed -i '/install_babel/d' $COMPLETION_FILE sed -i '/configure_firewall_for_babel/d' $COMPLETION_FILE } @@ -70,8 +70,8 @@ function configure_firewall_for_babel { echo 'configure_firewall_for_babel' >> $COMPLETION_FILE } -function mesh_babel { - if grep -Fxq "mesh_babel" $COMPLETION_FILE; then +function install_babel { + if grep -Fxq "install_babel" $COMPLETION_FILE; then return fi if [[ $ENABLE_BABEL != "yes" ]]; then @@ -86,7 +86,7 @@ function mesh_babel { function_check configure_firewall_for_babel configure_firewall_for_babel - echo 'mesh_babel' >> $COMPLETION_FILE + echo 'install_babel' >> $COMPLETION_FILE } # NOTE: deliberately there is no "exit 0" diff --git a/src/freedombone-app-batman b/src/freedombone-app-batman index 84eef455..1fad96fd 100755 --- a/src/freedombone-app-batman +++ b/src/freedombone-app-batman @@ -50,7 +50,7 @@ function backup_batman { } function remove_batman { - if ! grep -Fxq "mesh_batman" $COMPLETION_FILE; then + if ! grep -Fxq "install_batman" $COMPLETION_FILE; then return fi @@ -59,12 +59,12 @@ function remove_batman { echo $'Failed to remove batman' exit 79353 fi - sed -i '/mesh_batman/d' $COMPLETION_FILE + sed -i '/install_batman/d' $COMPLETION_FILE sed -i '/configure_firewall_for_batman/d' $COMPLETION_FILE } -function mesh_batman { - if grep -Fxq "mesh_batman" $COMPLETION_FILE; then +function install_batman { + if grep -Fxq "install_batman" $COMPLETION_FILE; then return fi if [[ $ENABLE_BATMAN != "yes" ]]; then @@ -91,7 +91,7 @@ function mesh_batman { function_check configure_firewall_for_batman configure_firewall_for_batman - echo 'mesh_batman' >> $COMPLETION_FILE + echo 'install_batman' >> $COMPLETION_FILE } # NOTE: deliberately no exit 0 diff --git a/src/freedombone-app-cjdns b/src/freedombone-app-cjdns index 3ba35d07..663e15e7 100755 --- a/src/freedombone-app-cjdns +++ b/src/freedombone-app-cjdns @@ -112,7 +112,7 @@ function backup_cjdns { } function remove_cjdns { - if ! grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then + if ! grep -Fxq "install_cjdns" $COMPLETION_FILE; then return fi service cjdns stop @@ -124,12 +124,12 @@ function remove_cjdns { save_firewall_settings rm -rf /etc/cjdns - sed -i '/mesh_cjdns/d' $COMPLETION_FILE + sed -i '/install_cjdns/d' $COMPLETION_FILE sed -i '/cjdns /d' $COMPLETION_FILE sed -i '/configure_firewall_for_cjdns/d' $COMPLETION_FILE } -function mesh_cjdns { +function install_cjdns { if [[ $ENABLE_CJDNS != "yes" ]]; then return fi @@ -138,7 +138,7 @@ function mesh_cjdns { function_check set_repo_commit set_repo_commit /etc/cjdns "cjdns commit" "$CJDNS_COMMIT" $CJDNS_REPO - if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then + if grep -Fxq "install_cjdns" $COMPLETION_FILE; then return fi @@ -418,18 +418,18 @@ function mesh_cjdns { function_check configure_firewall_for_cjdns configure_firewall_for_cjdns - echo 'mesh_cjdns' >> $COMPLETION_FILE + echo 'install_cjdns' >> $COMPLETION_FILE } -function mesh_cjdns_tools { - if grep -Fxq "mesh_cjdns_tools" $COMPLETION_FILE; then +function install_cjdns_tools { + if grep -Fxq "install_cjdns_tools" $COMPLETION_FILE; then return fi if [[ $ENABLE_CJDNS != "yes" ]]; then return fi if [ ! -d /etc/cjdns ]; then - mesh_cjdns + install_cjdns fi function_check select_go_version @@ -477,7 +477,7 @@ function mesh_cjdns_tools { # initialise from the cjdns config /usr/bin/cjdcmd cjdnsadmin -file /etc/cjdns/cjdroute.conf - echo 'mesh_cjdns_tools' >> $COMPLETION_FILE + echo 'install_cjdns_tools' >> $COMPLETION_FILE } # NOTE: deliberately no exit 0 diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index c9446288..3a8aec87 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -531,7 +531,7 @@ function mesh_avahi { chmod +x $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME } -function mesh_batman { +function install_batman { chroot "$rootdir" apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl chroot "$rootdir" apt-get -y install python-dev libevent-dev ebtables python-pip git chroot "$rootdir" apt-get -y install wireless-tools rfkill @@ -1111,7 +1111,7 @@ initialise_mesh() { mesh_firewall mesh_avahi - mesh_batman + install_batman mesh_tox_node mesh_tox_avahi mesh_tox_client diff --git a/src/freedombone-mesh-install b/src/freedombone-mesh-install index 7f46caab..57db2938 100755 --- a/src/freedombone-mesh-install +++ b/src/freedombone-mesh-install @@ -99,7 +99,7 @@ function show_help { } -function mesh_babel { +function install_babel { $CHROOT_PREFIX apt-get -y install babeld babel_script=${rootdir}/var/lib/babel @@ -180,7 +180,7 @@ function mesh_babel { $CHROOT_PREFIX systemctl enable babel } -function mesh_babel_remove { +function install_babel_remove { $CHROOT_PREFIX systemctl stop babel $CHROOT_PREFIX apt-get -y remove --purge babeld rm ${rootdir}/var/lib/babel @@ -227,7 +227,7 @@ function mesh_avahi { chmod +x $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME } -function mesh_babel_client { +function install_babel_client { # TODO to be fixed if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}') @@ -333,13 +333,13 @@ function mesh_babel_client { sudo mv $babel_script ${rootdir}/usr/bin/babel } -function mesh_batman_remove { +function install_batman_remove { systemctl stop batman rm $rootdir/var/lib/batman rm $rootdir/etc/systemd/system/batman.service } -function mesh_batman { +function install_batman { $CHROOT_PREFIX apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl $CHROOT_PREFIX apt-get -y install python-dev libevent-dev ebtables python-pip git $CHROOT_PREFIX apt-get -y install wireless-tools rfkill @@ -799,7 +799,7 @@ function mesh_zeronet { $CHROOT_PREFIX systemctl enable zeronet.service } -function mesh_batman_client { +function install_batman_client { if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}') else @@ -1101,13 +1101,13 @@ done if [[ $FN == 'babel' ]]; then if [[ $REMOVE != 'yes' ]]; then - mesh_babel + install_babel else - mesh_babel_remove + install_babel_remove fi fi if [[ $FN == 'babel_client' ]]; then - mesh_babel_client + install_babel_client fi if [[ $FN == 'avahi' ]]; then mesh_avahi @@ -1117,13 +1117,13 @@ if [[ $FN == 'firewall' ]]; then fi if [[ $FN == 'batman' ]]; then if [[ $REMOVE != 'yes' ]]; then - mesh_batman + install_batman else - mesh_batman_remove + install_batman_remove fi fi if [[ $FN == 'batman_client' ]]; then - mesh_batman_client + install_batman_client fi if [[ $FN == 'tox_node' ]]; then if [[ $REMOVE != 'yes' ]]; then diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup index 3b85bb62..0a9c50b0 100755 --- a/src/freedombone-utils-setup +++ b/src/freedombone-utils-setup @@ -291,10 +291,10 @@ function setup_utils { } function setup_mesh { - mesh_cjdns - mesh_cjdns_tools - mesh_batman - mesh_babel + install_cjdns + install_cjdns_tools + install_batman + install_babel } function setup_email {