Up/down scripts are managed by options to openvpn, also no longer need specific device name
This commit is contained in:
@@ -29,8 +29,10 @@ provider=$1
|
|||||||
|
|
||||||
for configFile in $provider/*.ovpn;
|
for configFile in $provider/*.ovpn;
|
||||||
do
|
do
|
||||||
# Set fixed tun device number
|
if [ -h ${configFile} ];
|
||||||
sed -i "s/dev tun.*/dev tun0/g" "$configFile"
|
then
|
||||||
|
continue # Don't edit symbolic links (default.ovpn)
|
||||||
|
fi
|
||||||
|
|
||||||
# Absolute reference to ca cert
|
# Absolute reference to ca cert
|
||||||
sed -i "s/ca .*\.crt/ca \/etc\/openvpn\/$provider\/ca.crt/g" "$configFile"
|
sed -i "s/ca .*\.crt/ca \/etc\/openvpn\/$provider\/ca.crt/g" "$configFile"
|
||||||
@@ -41,16 +43,6 @@ for configFile in $provider/*.ovpn;
|
|||||||
# Set user-pass file location
|
# Set user-pass file location
|
||||||
sed -i "s/auth-user-pass.*/auth-user-pass \/config\/openvpn-credentials.txt/g" "$configFile"
|
sed -i "s/auth-user-pass.*/auth-user-pass \/config\/openvpn-credentials.txt/g" "$configFile"
|
||||||
|
|
||||||
# Insert transmission control script triggers
|
|
||||||
cat <<EOT >> $configFile
|
|
||||||
|
|
||||||
|
|
||||||
# OpenVPN controls startup and shut down of transmission
|
|
||||||
script-security 2
|
|
||||||
up /etc/transmission/start.sh
|
|
||||||
down /etc/transmission/stop.sh
|
|
||||||
EOT
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Updated all .ovpn files in folder $provider"
|
echo "Updated all .ovpn files in folder $provider"
|
||||||
|
Reference in New Issue
Block a user