[OpenWrt-Devel] [RFC PATCH 05/10] openvpn: generate config in /tmp/etc

Stijn Tintel stijn at linux-ipv6.be
Mon Mar 28 13:51:44 EDT 2016


Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>
---
 package/network/services/openvpn/files/openvpn.init | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/package/network/services/openvpn/files/openvpn.init b/package/network/services/openvpn/files/openvpn.init
index 5396d0b..7ee756d 100644
--- a/package/network/services/openvpn/files/openvpn.init
+++ b/package/network/services/openvpn/files/openvpn.init
@@ -24,7 +24,7 @@ append_param() {
 		*_*_*)   v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;;
 		*_*)     v=${v%%_*}-${v#*_} ;;
 	esac
-	echo -n "$v" >> "/var/etc/openvpn-$s.conf"
+	echo -n "$v" >> "/tmp/etc/openvpn-$s.conf"
 	return 0
 }
 
@@ -32,7 +32,7 @@ append_bools() {
 	local p; local v; local s="$1"; shift
 	for p in $*; do
 		config_get_bool v "$s" "$p"
-		[ "$v" = 1 ] && append_param "$s" "$p" && echo >> "/var/etc/openvpn-$s.conf"
+		[ "$v" = 1 ] && append_param "$s" "$p" && echo >> "/tmp/etc/openvpn-$s.conf"
 	done
 }
 
@@ -42,7 +42,7 @@ append_params() {
 		config_get v "$s" "$p"
 		IFS="$LIST_SEP"
 		for v in $v; do
-			[ -n "$v" ] && append_param "$s" "$p" && echo " $v" >> "/var/etc/openvpn-$s.conf"
+			[ -n "$v" ] && append_param "$s" "$p" && echo " $v" >> "/tmp/etc/openvpn-$s.conf"
 		done
 		unset IFS
 	done
@@ -89,8 +89,8 @@ start_instance() {
 		return
 	fi
 
-	[ ! -d "/var/etc" ] && mkdir -p "/var/etc"
-	[ -f "/var/etc/openvpn-$s.conf" ] && rm "/var/etc/openvpn-$s.conf"
+	[ ! -d "/tmp/etc" ] && mkdir -p "/tmp/etc"
+	[ -f "/tmp/etc/openvpn-$s.conf" ] && rm "/tmp/etc/openvpn-$s.conf"
 
 	# append flags
 	append_bools "$s" \
@@ -127,7 +127,7 @@ start_instance() {
 		verify_x509_name x509_username_field \
 		ifconfig_ipv6 route_ipv6 server_ipv6 ifconfig_ipv6_pool ifconfig_ipv6_push iroute_ipv6
 
-	openvpn_add_instance "$s" "/var/etc" "openvpn-$s.conf"
+	openvpn_add_instance "$s" "/tmp/etc" "openvpn-$s.conf"
 }
 
 start_service() {
-- 
2.7.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list