Updated TODOs and variable names.

main
Andrew Klapp 8 years ago
parent 38c57fb385
commit cfacda7760
No known key found for this signature in database
GPG Key ID: D78ADB07F66B6AE4

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
OVPN_DIRECTORY="/etc/openvpn/client/ovpn" ovpn_directory="/etc/openvpn/client/ovpn-enabled"
CURRENT_OVPN_PATH="/etc/openvpn/client/current.ovpn" current_ovpn_path="/etc/openvpn/client/current.ovpn"
# TODO: Investigate better ways to check for rootness. This is just a courtesy message, though. # TODO: Investigate better ways to check for rootness. This is just a courtesy message, though.
# Non-root users will not be able to do anything with this anyway. # Non-root users will not be able to do anything with this anyway.
@ -11,15 +11,14 @@ if [ "$(whoami)" != "root" ]; then
fi fi
# TODO: Add the ability to pass arbitrary ovpn files. # TODO: Add the ability to pass arbitrary ovpn files.
# TODO: Remove the current config from the list of choices.
# Choose a random VPN configuration inside /etc/openvpn/ovpn-enabled
ovpn_file=$(shuf -n1 -e ${ovpn_directory}/*)
# Choose a random VPN configuration inside /etc/openvpn/ovpn # TODO: Also echo previous configuration's name.
ovpn_file=$(shuf -n1 -e ${OVPN_DIRECTORY}/*)
# TODO: Check that ovpn_file exists.
echo "Using OpenVPN configuration $(basename "${ovpn_file}" .ovpn)" echo "Using OpenVPN configuration $(basename "${ovpn_file}" .ovpn)"
rm "${CURRENT_OVPN_PATH}" ln -fs "${ovpn_file}" "${current_ovpn_path}"
ln -s "${ovpn_file}" "${CURRENT_OVPN_PATH}"
echo "Restarting OpenVPN service." echo "Restarting OpenVPN service."
systemctl restart openvpn systemctl restart openvpn

Loading…
Cancel
Save