Fixed root check and targeted POSIX shell instead of Bash.

main
Andrew Klapp 7 years ago
parent 8d579fed16
commit f3b57b0ac1
No known key found for this signature in database
GPG Key ID: D78ADB07F66B6AE4

@ -16,5 +16,5 @@ anonymous.
service.
## Usage
Just run `openvpn-rotate` and it will link a random configuration to the path that
Just run `openvpn-rotate` and it will link a random different configuration to the path that
`openvpn.service` reads. It does not currently accept any arguments.

@ -1,13 +1,11 @@
#!/usr/bin/env bash
#!/bin/sh
ovpn_directory="/etc/openvpn/client/ovpn-enabled"
current_ovpn_path="/etc/openvpn/client/current.ovpn"
# 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.
if [ "$(whoami)" != "root" ]; then
if [ "$(id -u)" -ne 0 ]; then
echo "This script needs root privileges to interact with the openvpn service."
exit
exit 1
fi
prior_ovpn_path="$(readlink "${current_ovpn_path}")"

Loading…
Cancel
Save