diff --git a/README.md b/README.md index 77445ab..a7ed876 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/openvpn-rotate b/openvpn-rotate index 81158fd..985fdc0 100755 --- a/openvpn-rotate +++ b/openvpn-rotate @@ -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}")"