diff options
author | Stan Grishin <stangri@melmac.net> | 2021-01-24 01:37:44 +0000 |
---|---|---|
committer | Stan Grishin <stangri@melmac.net> | 2021-02-08 16:50:43 +0000 |
commit | 9c16d63a42c8d33857823937de3667d7fbf2f696 (patch) | |
tree | 8a994fa7d07f6980606e4f5dfe4f6da5724fc150 /net/nebula/files | |
parent | 64c917b702c70d1c5193c8cb85ebfe3b3485082c (diff) |
nebula: initial commit
Signed-off-by: Stan Grishin <stangri@melmac.net>
initial commit
Diffstat (limited to 'net/nebula/files')
-rwxr-xr-x | net/nebula/files/nebula.init | 53 | ||||
-rw-r--r-- | net/nebula/files/nebula.upgrade | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/net/nebula/files/nebula.init b/net/nebula/files/nebula.init new file mode 100755 index 000000000..d594a4edb --- /dev/null +++ b/net/nebula/files/nebula.init @@ -0,0 +1,53 @@ +#!/bin/sh /etc/rc.common +# Copyright 2021 Stan Grishin (stangri@melmac.net) +# shellcheck disable=SC2039 +PKG_VERSION='dev-test' + +# shellcheck disable=SC2034 +START=80 +# shellcheck disable=SC2034 +USE_PROCD=1 + +if type extra_command 1>/dev/null 2>&1; then + extra_command 'version' 'Show version information' +else +# shellcheck disable=SC2034 + EXTRA_COMMANDS='version' +fi + +readonly PROG=/usr/sbin/nebula + +version() { echo "Version: $PKG_VERSION"; } + +start_instance() { + local cfg="$1" port name="${1##*/}" + port="$(grep -A2 "^listen:" "$cfg" | grep "port: " | awk '{print $2}')" + procd_open_instance + procd_set_param command ${PROG} -config "${cfg}" + procd_set_param stderr 1 + procd_set_param stdout 1 + procd_set_param respawn + procd_open_data + json_add_array firewall + json_add_object '' + json_add_string type 'rule' + json_add_string name "Allow-$name" + json_add_string src 'wan' + json_add_string dest_port "$port" + json_add_string proto 'udp' + json_add_string target 'ACCEPT' + json_close_object + json_close_array + procd_close_data + procd_close_instance +} + +start_service() { + local f + for f in /etc/nebula/*.yml; do + [ -s "$f" ] && start_instance "$f" + done +} + +service_started() { procd_set_config_changed firewall; } +service_stopped() { procd_set_config_changed firewall; } diff --git a/net/nebula/files/nebula.upgrade b/net/nebula/files/nebula.upgrade new file mode 100644 index 000000000..0614c3c37 --- /dev/null +++ b/net/nebula/files/nebula.upgrade @@ -0,0 +1 @@ +/etc/nebula/ |