mirror of
https://github.com/pia-foss/manual-connections.git
synced 2025-02-05 14:08:29 +00:00
use proper check for root privileges
The root user is not guaranteed to be named 'root'
This commit is contained in:
parent
b04be889f0
commit
e2b9b733af
|
@ -77,8 +77,8 @@ if test -t 1; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Only allow script to run as
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
# Only allow script to run as root
|
||||
if (( EUID != 0 )); then
|
||||
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -53,8 +53,8 @@ if test -t 1; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Only allow script to run as
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
# Only allow script to run as root
|
||||
if (( EUID != 0 )); then
|
||||
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -37,8 +37,8 @@ fi
|
|||
intCheck='^[0-9]+$'
|
||||
floatCheck='^[0-9]+([.][0-9]+)?$'
|
||||
|
||||
# Only allow script to run as
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
# Only allow script to run as root
|
||||
if (( EUID != 0 )); then
|
||||
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user