openvpn_add_instance "$s" "/var/etc" "openvpn-$s.conf" "$script_security" "$up" "$down"
}
+start_path_instances() {
+ local path name up down
+
+ for path in /etc/openvpn/*.conf; do
+ if [ -f "$path" ]; then
+ name="${path##*/}"; name="${name%.conf}"
+
+ # don't start configs again that are already started by uci
+ if echo "$UCI_STARTED" | grep -qxF "$path"; then
+ continue
+ # don't start configs which are set to disabled in uci
+ elif echo "$UCI_DISABLED" | grep -qxF "$path"; then
+ logger -t openvpn "$name.conf is disabled in /etc/config/openvpn"
+ continue
+ fi
+
+ get_openvpn_option "$path" up up || up=""
+ get_openvpn_option "$path" down down || down=""
+ openvpn_add_instance "$name" "${path%/*}" "$path" "" "$up" "$down"
+ fi
+ done
+}
+
start_service() {
local instance="$1"
local instance_found=0
else
config_foreach start_uci_instance 'openvpn'
- local path name up down
- for path in /etc/openvpn/*.conf; do
- if [ -f "$path" ]; then
- name="${path##*/}"; name="${name%.conf}"
-
- # don't start configs again that are already started by uci
- if echo "$UCI_STARTED" | grep -qxF "$path"; then
- continue
-
- # don't start configs which are set to disabled in uci
- elif echo "$UCI_DISABLED" | grep -qxF "$path"; then
- logger -t openvpn "$name.conf is disabled in /etc/config/openvpn"
- continue
- fi
-
- get_openvpn_option "$path" up up || up=""
- get_openvpn_option "$path" down down || down=""
- openvpn_add_instance "$name" "${path%/*}" "$path" "" "$up" "$down"
- fi
- done
+ start_path_instances
fi
}