From 2dc73f260c44058e69e7a954fc36b256d56697e8 Mon Sep 17 00:00:00 2001 From: bioxz Date: Sat, 5 Apr 2014 05:23:26 +0200 Subject: [PATCH] Support for custom fastd config files in /etc/fastd/ Enabled all options for fastd to support any config file --- net/fastd/Config.in | 8 ++++---- net/fastd/files/fastd.init | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/net/fastd/Config.in b/net/fastd/Config.in index 7d7c80c..adf9c0e 100644 --- a/net/fastd/Config.in +++ b/net/fastd/Config.in @@ -62,21 +62,21 @@ config FASTD_ENABLE_MAC_GHASH config FASTD_WITH_CMDLINE_USER bool "Include support for setting user/group related options on the command line" depends on PACKAGE_fastd - default n + default y config FASTD_WITH_CMDLINE_LOGGING bool "Include support for setting logging related options on the command line" depends on PACKAGE_fastd - default n + default y config FASTD_WITH_CMDLINE_OPERATION bool "Include support for setting options related to the VPN operation (like mode, interface, encryption method) on the command line" depends on PACKAGE_fastd - default n + default y config FASTD_WITH_CMDLINE_COMMANDS bool "Include support for setting handler scripts (e.g. --on-up) on the command line" depends on PACKAGE_fastd - default n + default y endmenu diff --git a/net/fastd/files/fastd.init b/net/fastd/files/fastd.init index d55e6ff..8bbf1eb 100644 --- a/net/fastd/files/fastd.init +++ b/net/fastd/files/fastd.init @@ -110,6 +110,13 @@ append_options() { done } +append_custom_configs() { + local fastd_configs=/etc/fastd/ + for f in $(ls $fastd_configs) + do + eval echo 'include \"$fastd_configs$f\"\;' + done +} generate_config_secret() { echo "secret $(escape_string "$1");" @@ -305,7 +312,7 @@ start_instance() { chown "$user" "$SERVICE_PID_FILE" fi - (generate_config_secret "$secret"; generate_config "$s") | service_start "$FASTD_COMMAND" --config - --daemon --pid-file "$SERVICE_PID_FILE" + (generate_config_secret "$secret"; generate_config "$s"; append_custom_configs) | service_start "$FASTD_COMMAND" --config - --daemon --pid-file "$SERVICE_PID_FILE" if ! ifconfig "$interface" >/dev/null 2>&1; then error "$s: startup failed"