From 36f77a171dcab72f5f7d7b8512138a84e1d95875 Mon Sep 17 00:00:00 2001 From: Aaron Goodman Date: Wed, 27 May 2020 13:26:47 -0400 Subject: [PATCH] openfortivpn: avoid flash writes on pppd script Signed-off-by: Aaron Goodman --- net/openfortivpn/files/openfortivpn.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/net/openfortivpn/files/openfortivpn.sh b/net/openfortivpn/files/openfortivpn.sh index d69575230..292ffd4b2 100755 --- a/net/openfortivpn/files/openfortivpn.sh +++ b/net/openfortivpn/files/openfortivpn.sh @@ -92,13 +92,18 @@ proto_openfortivpn_setup() { [ -n "$password" ] && { umask 077 mkdir -p /var/etc - pwfile="/var/etc/openfortivpn-$config.passwd" + pwfile="/var/etc/openfortivpn/$config.passwd" echo "$password" > "$pwfile" } [ -n "$local_ip" ] || local_ip=192.0.2.1 - mkdir -p '/etc/ppp/peers' - callfile="/etc/ppp/peers/$config" + [ -e '/etc/ppp/peers' ] || mkdir -p '/etc/ppp/peers' + [ -e '/etc/ppp/peers/openfortivpn' ] || { + ln -s -T '/var/etc/openfortivpn/peers' '/etc/ppp/peers/openfortivpn' + mkdir -p '/var/etc/openfortivpn/peers' + } + + callfile="/var/etc/openfortivpn/peers/$config" echo "115200 :$local_ip noipdefault @@ -114,7 +119,7 @@ lcp-max-configure 40 ip-up-script /lib/netifd/ppp-up ip-down-script /lib/netifd/ppp-down mru 1354" > $callfile - append_args "--pppd-call=$config" + append_args "--pppd-call=openfortivpn/$config" proto_export INTERFACE="$ifname" logger -t openfortivpn "$config: executing 'openfortivpn $cmdline'" @@ -127,8 +132,8 @@ mru 1354" > $callfile proto_openfortivpn_teardown() { local config="$1" - pwfile="/var/etc/openfortivpn-$config.passwd" - callfile="/etc/ppp/peers/$config" + pwfile="/var/etc/openfortivpn/$config.passwd" + callfile="/var/etc/openfortivpn/peers/$config" rm -f $pwfile rm -f $callfile