Browse Source

yggdrasil: fix startup and generate nodeInfo info

- init: fix no start
- defaults: apply ubus system board info to nodeInfo
- defaults: fix missing yggdrasil interface
- defaults: call uci commit

Signed-off-by: William Fleurant <william@netblazr.com>
lilik-openwrt-22.03
William Fleurant 6 years ago
parent
commit
29c341684f
No known key found for this signature in database GPG Key ID: DB50ACA1DB6202A9
3 changed files with 37 additions and 3 deletions
  1. +1
    -1
      net/yggdrasil/Makefile
  2. +36
    -1
      net/yggdrasil/files/yggdrasil.defaults
  3. +0
    -1
      net/yggdrasil/files/yggdrasil.init

+ 1
- 1
net/yggdrasil/Makefile View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=yggdrasil PKG_NAME:=yggdrasil
PKG_VERSION:=0.3.5 PKG_VERSION:=0.3.5
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE_URL:=https://codeload.github.com/yggdrasil-network/yggdrasil-go/tar.gz/v$(PKG_VERSION)? PKG_SOURCE_URL:=https://codeload.github.com/yggdrasil-network/yggdrasil-go/tar.gz/v$(PKG_VERSION)?
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz


+ 36
- 1
net/yggdrasil/files/yggdrasil.defaults View File

@ -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
: :


+ 0
- 1
net/yggdrasil/files/yggdrasil.init View File

@ -11,7 +11,6 @@ start_service()
procd_open_instance procd_open_instance
procd_set_param respawn procd_set_param respawn
procd_set_param command /usr/sbin/yggdrasil -useconffile /etc/yggdrasil.conf
procd_set_param command /bin/ash -c "/usr/sbin/yggdrasil -useconffile /etc/yggdrasil.conf | logger -t yggdrasil" procd_set_param command /bin/ash -c "/usr/sbin/yggdrasil -useconffile /etc/yggdrasil.conf | logger -t yggdrasil"
procd_close_instance procd_close_instance


Loading…
Cancel
Save