Check if script is running as root

This commit is contained in:
Alex
2023-02-21 21:56:34 -06:00
parent 9c9196de83
commit 2679bebde4

View File

@@ -9,7 +9,11 @@ RED='\033[31m'
NO_COLOR='\033[0m'
ZIP_FILENAME=pnetlabv6_offline.zip
URL_ZIP_FILE=https://unetlab.cloud/api/raw/?path=/UNETLAB%20I/upgrades_pnetlab/extras/upgrade_to_ubuntu_20.04/pnetlabv6_offline.zip
# Check if user is root
if [ "$(id -u)" != "0" ]; then
echo -e "${RED}Upgrade has been rejected. You must run this script as root${NO_COLOR}"
exit 0
fi
lsb_release -r -s | grep -q 20.04
if [ $? -ne 0 ]; then