X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=packages%2Fxwrt%2Fwebif-vpn%2Ffiles%2Fusr%2Flib%2Fwebif%2Fl2tpns_apply.sh;fp=packages%2Fxwrt%2Fwebif-vpn%2Ffiles%2Fusr%2Flib%2Fwebif%2Fl2tpns_apply.sh;h=96049d6cdebfbd0c64d16ba6504d68a17242c0fb;hb=292a96bb207a38475873c28a39fc2e72c277ae94;hp=0000000000000000000000000000000000000000;hpb=61edc99f724a295c2fc93eb85fb2d0e57b0b283d;p=librewrt%2F.git diff --git a/packages/xwrt/webif-vpn/files/usr/lib/webif/l2tpns_apply.sh b/packages/xwrt/webif-vpn/files/usr/lib/webif/l2tpns_apply.sh new file mode 100755 index 0000000..96049d6 --- /dev/null +++ b/packages/xwrt/webif-vpn/files/usr/lib/webif/l2tpns_apply.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# +# L2TPns apply script +# Applies the uci configuration to l2tpns' configuration file /etc/l2tpns/startup-config +# +# Author: Liran Tal +# +# +# Last edited: 27 Nov 2007 - added support for proper restart of l2tpns service +# + +#============================================================================== +# Exporting the uci configuration settings to the startup-config file +#============================================================================== + +. /etc/functions.sh + +config_cb() { + local cfg_type="$1" + local cfg_name="$2" + [ "$cfg_type" = "server" ] && server_cfg="$cfg_name" || unset server_cfg +} + +option_cb() { + local var_name="$1"; shift + local var_value="$*" + local tvalue + [ -n "$server_cfg" ] && [ -n "$var_value" ] && { + case "$var_name" in + mode) ;; + debug) + let tvalue=var_value+1 + [ "$tvalue" -gt 1 ] && l2tpns_options="${l2tpns_options}set ${var_name} ${var_value}${_lf}" + ;; + *) [ -n "$var_value" ] && l2tpns_options="${l2tpns_options}set ${var_name} ${var_value}${_lf}" ;; + esac + } +} + +_lf=" +" +l2tpns_config_dir="/etc/l2tpns" +l2tpns_config="$l2tpns_config_dir/startup-config" +l2tpns_options="# The L2TPns config file${_lf}# this file is automatically generated by webif^2${_lf}" +[ -d "$l2tpns_config_dir" ] && { + config_load l2tpns + echo "$l2tpns_options" > "$l2tpns_config" +}