More consolidation of mesh functions
This commit is contained in:
parent
2a3c1bb429
commit
423fdcad5e
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue