diff options
Diffstat (limited to 'dist/procd')
-rwxr-xr-x | dist/procd/wgconfd | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/dist/procd/wgconfd b/dist/procd/wgconfd deleted file mode 100755 index 91e0e55..0000000 --- a/dist/procd/wgconfd +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh /etc/rc.common -# SPDX-License-Identifier: LGPL-3.0-or-later -# -# Copyright 2019 Hristo Venev - -START=50 -STOP=50 -USE_PROCD=1 - -handle_interface() { - local iface="$1" - local val - - mkdir -p "/tmp/wgconfd/$1" "/tmp/wgconfd/$1/cache" - procd_open_instance - procd_set_param env RUNTIME_DIRECTORY="/tmp/wgconfd/$1" CACHE_DIRECTORY="/tmp/wgconfd/$1/cache" - procd_set_param command /usr/bin/wgconfd "$1" --cmdline - - config_get val "$1" refresh_sec - [ -n "$val" ] && procd_append_param command refresh_sec "$val" - - config_get val "$1" min_keepalive - [ -n "$val" ] && procd_append_param command min_keepalive "$val" - - config_get val "$1" max_keepalive - [ -n "$val" ] && procd_append_param command max_keepalive "$val" - - config_list_foreach "$1" source handle_source - - config_list_foreach "$1" peer handle_peer - - procd_set_param respawn 30 5 5 - procd_set_param stderr 1 - procd_close_instance -} - -handle_source() { - local val - config_get val "$1" url - procd_append_param command source "$1" "$val" - - config_get val "$1" psk - [ -n "$val" ] && procd_append_param command psk "$val" - - config_get_bool val "$1" required 0 - [ "$val" -eq 1 ] && procd_append_param command required - - config_list_foreach "$1" ipv4 handle_source_arg ipv4 - - config_list_foreach "$1" ipv6 handle_source_arg ipv6 -} - -handle_source_arg() { - procd_append_param command "$2" "$1" -} - -handle_peer() { - local val - procd_append_param command peer "$1" - - config_get val "$1" psk - [ -n "$val" ] && procd_append_param command psk "$val" - - config_get val "$1" source - [ -n "$val" ] && procd_append_param command source "$val" -} - -start_service() { - config_load wgconfd - config_foreach handle_interface interface -} |