瀏覽代碼

Allow local ip addresses for scuttlebot

Bob Mottram 7 年之前
父節點
當前提交
588c58799f
共有 2 個文件被更改,包括 11 次插入0 次删除
  1. 1
    0
      src/freedombone-image-mesh
  2. 10
    0
      src/freedombone-mesh-batman

+ 1
- 0
src/freedombone-image-mesh 查看文件

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

+ 10
- 0
src/freedombone-mesh-batman 查看文件

@@ -96,6 +96,10 @@ if [ -e /etc/default/batctl ]; then
96 96
     . /etc/default/batctl
97 97
 fi
98 98
 
99
+function get_ipv6_bat0 {
100
+    echo $(ip -o -f inet6 addr show dev "bat0" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
101
+}
102
+
99 103
 function mesh_hotspot_ip_address {
100 104
     echo $(ip -o -f inet addr show dev "$BRIDGE" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
101 105
 }
@@ -402,6 +406,12 @@ function start {
402 406
 
403 407
     systemctl restart avahi-daemon
404 408
 
409
+    if [ -f /etc/scuttlebot/.ssb/config ]; then
410
+        ipv6addr=$(get_ipv6_bat0)
411
+        sed -i "s|\"host\": .*|\"host\": \"${ipv6addr}\",|g" /etc/scuttlebot/.ssb/config
412
+        systemctl restart scuttlebot
413
+    fi
414
+
405 415
     verify
406 416
 }
407 417