Install a web server on mesh clients for the zeronet tracker

This commit is contained in:
Bob Mottram 2015-08-31 13:01:09 +01:00
parent bb7af17742
commit 87d5c2ac57
2 changed files with 24 additions and 4 deletions

View File

@ -6043,6 +6043,7 @@ function configure_firewall_for_zeronet {
iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport $ZERONET_PORT -j ACCEPT
iptables -A INPUT -i $WIFI_INTERFACE -p tcp --dport $ZERONET_PORT -j ACCEPT
iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport $TRACKER_PORT -j ACCEPT
iptables -A INPUT -i $WIFI_INTERFACE -p tcp --dport $TRACKER_PORT -j ACCEPT
iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport 1900 -j ACCEPT
save_firewall_settings
echo 'configure_firewall_for_zeronet' >> $COMPLETION_FILE
@ -7391,7 +7392,7 @@ function import_email {
}
function install_web_server {
if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" ]]; then
return
fi
if grep -Fxq "install_web_server" $COMPLETION_FILE; then

View File

@ -13,6 +13,24 @@ ZERONET_DIR=~/zeronet
ZERONET_URL=http://127.0.0.1:43110
TRACKER_PORT=6969
function install_web_server {
if [ -d /etc/nginx ]; then
return
fi
sudo apt-get -y remove --purge apache2
if [ -d /etc/apache2 ]; then
sudo rm -rf /etc/apache2
fi
# install nginx
sudo apt-get -y install nginx
if [ ! -d /etc/nginx ]; then
echo 'Unable to install web server'
exit 51
fi
}
function install_zeronet {
if [ -d $ZERONET_DIR ]; then
return
@ -42,6 +60,7 @@ fi
if [[ $SERVER_INSTALLATION == "no" ]]; then
if [ ! -f /tmp/meshtype ]; then
install_web_server
install_zeronet
sudo batman start
if [ ! "$?" = "0" ]; then
@ -78,9 +97,9 @@ cd $ZERONET_DIR
existing_bttrack=$(ps aux | grep bttrack | wc -l)
if [ $existing_bttrack -lt "2" ]; then
if [ ! -d ~/.bttrack ]; then
mkdir ~/.bttrack
fi
if [ ! -d ~/.bttrack ]; then
mkdir ~/.bttrack
fi
bttrack --port ${TRACKER_PORT} --dfile ~/.bttrack/dstate --logfile ~/.bttrack/tracker.log --nat_check 0 --scrape_allowed full --ipv6_enabled 0 &
fi