Allow local ip addresses for scuttlebot

This commit is contained in:
Bob Mottram 2017-10-05 17:43:10 +01:00
parent 20a89b7a33
commit 588c58799f
2 changed files with 11 additions and 0 deletions

View File

@ -795,6 +795,7 @@ function initialise_scuttlebot_pub {
echo '{' > /etc/scuttlebot/.ssb/config
echo " \"host\": \"${HOSTNAME}\"," >> /etc/scuttlebot/.ssb/config
echo " \"port\": ${SCUTTLEBOT_PORT}," >> /etc/scuttlebot/.ssb/config
echo ' "allowPrivate": true,' >> /etc/scuttlebot/.ssb/config
echo ' "timeout": 30000,' >> /etc/scuttlebot/.ssb/config
echo ' "pub": true,' >> /etc/scuttlebot/.ssb/config
echo ' "local": true,' >> /etc/scuttlebot/.ssb/config

View File

@ -96,6 +96,10 @@ if [ -e /etc/default/batctl ]; then
. /etc/default/batctl
fi
function get_ipv6_bat0 {
echo $(ip -o -f inet6 addr show dev "bat0" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
}
function mesh_hotspot_ip_address {
echo $(ip -o -f inet addr show dev "$BRIDGE" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
}
@ -402,6 +406,12 @@ function start {
systemctl restart avahi-daemon
if [ -f /etc/scuttlebot/.ssb/config ]; then
ipv6addr=$(get_ipv6_bat0)
sed -i "s|\"host\": .*|\"host\": \"${ipv6addr}\",|g" /etc/scuttlebot/.ssb/config
systemctl restart scuttlebot
fi
verify
}