Browse Source

Update build.func

Please run these scripts as root (not with sudo).
tteckster 1 year ago
parent
commit
e0e81a022d
1 changed files with 9 additions and 0 deletions
  1. 9 0
      misc/build.func

+ 9 - 0
misc/build.func

@@ -52,6 +52,15 @@ msg_error() {
   echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
   echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
 }
 }
 
 
+# Run as root only
+if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
+  clear
+  msg_error "Please run this script as root."
+  echo -e "\nExiting..."
+  sleep 2
+  exit
+fi
+
 # This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
 # This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
 pve_check() {
 pve_check() {
   if [ $(pveversion | grep "pve-manager/8" | wc -l) -ne 1 ]; then
   if [ $(pveversion | grep "pve-manager/8" | wc -l) -ne 1 ]; then