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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only allow script to run as
|
# Only allow script to run as root
|
||||||
if [ "$(whoami)" != "root" ]; then
|
if (( EUID != 0 )); then
|
||||||
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -53,8 +53,8 @@ if test -t 1; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only allow script to run as
|
# Only allow script to run as root
|
||||||
if [ "$(whoami)" != "root" ]; then
|
if (( EUID != 0 )); then
|
||||||
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -37,8 +37,8 @@ fi
|
||||||
intCheck='^[0-9]+$'
|
intCheck='^[0-9]+$'
|
||||||
floatCheck='^[0-9]+([.][0-9]+)?$'
|
floatCheck='^[0-9]+([.][0-9]+)?$'
|
||||||
|
|
||||||
# Only allow script to run as
|
# Only allow script to run as root
|
||||||
if [ "$(whoami)" != "root" ]; then
|
if (( EUID != 0 )); then
|
||||||
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
echo -e "${RED}This script needs to be run as root. Try again with 'sudo $0'${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user