|
@ -2,9 +2,42 @@ |
|
|
|
|
|
|
|
|
yggConfig="/etc/yggdrasil.conf" |
|
|
yggConfig="/etc/yggdrasil.conf" |
|
|
|
|
|
|
|
|
|
|
|
first_boot_genConfig() |
|
|
|
|
|
{ |
|
|
|
|
|
. /usr/share/libubox/jshn.sh |
|
|
|
|
|
boardcfg=$(ubus call system board) |
|
|
|
|
|
yggcfg=$(yggdrasil -genconf -json | grep NodeInfo -v) |
|
|
|
|
|
|
|
|
|
|
|
json_load "$boardcfg" |
|
|
|
|
|
json_get_var kernel kernel |
|
|
|
|
|
json_get_var hostname hostname |
|
|
|
|
|
json_get_var system system |
|
|
|
|
|
json_get_var model model |
|
|
|
|
|
json_get_var board_name board_name |
|
|
|
|
|
|
|
|
|
|
|
json_load "$yggcfg" |
|
|
|
|
|
json_add_string "IfName" "ygg0" |
|
|
|
|
|
json_add_object "NodeInfo" |
|
|
|
|
|
json_add_string "kernel" "$kernel" |
|
|
|
|
|
json_add_string "hostname" "$hostname" |
|
|
|
|
|
json_add_string "system" "$system" |
|
|
|
|
|
json_add_string "model" "$model" |
|
|
|
|
|
json_add_string "board_name" "$board_name" |
|
|
|
|
|
json_close_object |
|
|
|
|
|
json_dump |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if [ ! -e ${yggConfig} ]; then |
|
|
if [ ! -e ${yggConfig} ]; then |
|
|
|
|
|
echo "first_boot: adding system board details to NodeInfo[] in NEW config: ${yggConfig}" | logger -t yggdrasil |
|
|
|
|
|
|
|
|
yggdrasil -genconf -json > ${yggConfig} |
|
|
|
|
|
|
|
|
first_boot_genConfig > ${yggConfig} |
|
|
|
|
|
|
|
|
|
|
|
# create the network interface |
|
|
|
|
|
uci -q batch <<-EOF >/dev/null |
|
|
|
|
|
set network.yggdrasil=interface |
|
|
|
|
|
set network.yggdrasil.ifname=ygg0 |
|
|
|
|
|
set network.yggdrasil.proto=none |
|
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
# create the firewall zone |
|
|
# create the firewall zone |
|
|
uci -q batch <<-EOF >/dev/null |
|
|
uci -q batch <<-EOF >/dev/null |
|
@ -58,6 +91,8 @@ EOF |
|
|
set firewall.@rule[-1].target=ACCEPT |
|
|
set firewall.@rule[-1].target=ACCEPT |
|
|
EOF |
|
|
EOF |
|
|
|
|
|
|
|
|
|
|
|
uci commit firewall |
|
|
|
|
|
uci commit network |
|
|
|
|
|
|
|
|
else |
|
|
else |
|
|
: |
|
|
: |
|
|