diff --git a/src/freedombone-app-tox b/src/freedombone-app-tox index 7cc9b3d8..36bd0a94 100755 --- a/src/freedombone-app-tox +++ b/src/freedombone-app-tox @@ -246,11 +246,6 @@ function tox_avahi { } function install_tox_node { - if [ $INSTALLING_MESH ]; then - mesh_tox_node - return - fi - if grep -Fxq "install_tox_node" $COMPLETION_FILE; then return fi @@ -321,17 +316,6 @@ function install_tox_client { echo 'install_tox_client' >> $COMPLETION_FILE } -function install_tox { - if grep -Fxq "install_tox" $COMPLETION_FILE; then - return - fi - configure_firewall_for_tox - install_tox_node - tox_avahi - install_tox_client - echo 'install_tox' >> $COMPLETION_FILE -} - function mesh_tox_node { # obtain commits from the main file TOXCORE_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') @@ -567,4 +551,24 @@ function enable_tox_repo { echo "Tox Repository Installed." } +function install_tox { + if grep -Fxq "install_tox" $COMPLETION_FILE; then + return + fi + + configure_firewall_for_tox + + if [ $INSTALLING_MESH ]; then + mesh_tox_node + mesh_tox_avahi + mesh_tox_client + else + install_tox_node + tox_avahi + install_tox_client + fi + + echo 'install_tox' >> $COMPLETION_FILE +} + # NOTE: deliberately no exit 0 diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index b6d8a6f5..36311d44 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -520,13 +520,11 @@ initialise_mesh() { INSTALLING_MESH=1 - mesh_firewall - mesh_avahi + configure_firewall + install_avahi install_batman install_tox_node - mesh_tox_avahi - mesh_tox_client - mesh_web_server + install_web_server install_zeronet MESH_SERVICE='mesh-setup.service' diff --git a/src/freedombone-utils-avahi b/src/freedombone-utils-avahi index 95ced47a..66b40f1d 100755 --- a/src/freedombone-utils-avahi +++ b/src/freedombone-utils-avahi @@ -94,8 +94,12 @@ function mesh_avahi { chmod +x $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME } -function configure_avahi { - if grep -Fxq "configure_avahi" $COMPLETION_FILE; then +function install_avahi { + if [ $INSTALLING_MESH ]; then + mesh_avahi + return + fi + if grep -Fxq "install_avahi" $COMPLETION_FILE; then return fi # only enable avahi if we're doing mesh networking @@ -119,7 +123,7 @@ function configure_avahi { sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf fi - echo 'configure_avahi' >> $COMPLETION_FILE + echo 'install_avahi' >> $COMPLETION_FILE } # NOTE: deliberately there is no "exit 0" diff --git a/src/freedombone-utils-firewall b/src/freedombone-utils-firewall index f7857378..1f994caf 100755 --- a/src/freedombone-utils-firewall +++ b/src/freedombone-utils-firewall @@ -47,6 +47,10 @@ function enable_ipv6 { } function configure_firewall { + if [ $INSTALLING_MESH ]; then + mesh_firewall + return + fi if grep -q "RELATED" /etc/firewall.conf; then # recreate the firewall to remove RELATED sed -i "/firewall/d" $COMPLETION_FILE diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup index 2eb098dc..86dd54a7 100755 --- a/src/freedombone-utils-setup +++ b/src/freedombone-utils-setup @@ -290,7 +290,7 @@ function setup_utils { create_upgrade_script letsencrypt_renewals install_watchdog_script - configure_avahi + install_avahi create_avahi_onion_domains #install_atheros_wifi route_outgoing_traffic_through_tor diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web index 98de56b6..925a14c8 100755 --- a/src/freedombone-utils-web +++ b/src/freedombone-utils-web @@ -392,7 +392,43 @@ function install_dynamicdns { echo 'install_dynamicdns' >> $COMPLETION_FILE } +function install_command_line_browser { + if grep -Fxq "install_command_line_browser" $COMPLETION_FILE; then + return + fi + apt-get -y install elinks + + # set the home page + if ! grep -q "WWW_HOME" /home/$MY_USERNAME/.bashrc; then + if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then + echo "export WWW_HOME=$DEFAULT_SEARCH" >> /home/$MY_USERNAME/.bashrc + else + sed -i "/control/i export WWW_HOME=$DEFAULT_SEARCH" /home/$MY_USERNAME/.bashrc + fi + fi + + echo 'install_command_line_browser' >> $COMPLETION_FILE +} + +function mesh_web_server { + if [ -d /etc/apache2 ]; then + chroot "$rootdir" apt-get -y remove --purge apache2 + chroot "$rootdir" rm -rf /etc/apache2 + fi + + chroot "$rootdir" apt-get -y install nginx + + if [ ! -d $rootdir/etc/nginx ]; then + echo $'Unable to install web server' + exit 346825 + fi +} + function install_web_server { + if [ $INSTALLING_MESH ]; then + mesh_web_server + return + fi if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" ]]; then return fi @@ -530,36 +566,4 @@ function install_web_server { echo 'install_web_server' >> $COMPLETION_FILE } -function install_command_line_browser { - if grep -Fxq "install_command_line_browser" $COMPLETION_FILE; then - return - fi - apt-get -y install elinks - - # set the home page - if ! grep -q "WWW_HOME" /home/$MY_USERNAME/.bashrc; then - if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then - echo "export WWW_HOME=$DEFAULT_SEARCH" >> /home/$MY_USERNAME/.bashrc - else - sed -i "/control/i export WWW_HOME=$DEFAULT_SEARCH" /home/$MY_USERNAME/.bashrc - fi - fi - - echo 'install_command_line_browser' >> $COMPLETION_FILE -} - -function mesh_web_server { - if [ -d /etc/apache2 ]; then - chroot "$rootdir" apt-get -y remove --purge apache2 - chroot "$rootdir" rm -rf /etc/apache2 - fi - - chroot "$rootdir" apt-get -y install nginx - - if [ ! -d $rootdir/etc/nginx ]; then - echo $'Unable to install web server' - exit 346825 - fi -} - # NOTE: deliberately no exit 0