From 125f8df353feaa56b8d6f5eadbff71ffee0f8b58 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Sat, 24 Dec 2022 16:18:50 -0500 Subject: [PATCH] fix sudo/root issue --- octoprint_deploy.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/octoprint_deploy.sh b/octoprint_deploy.sh index f76c438..cfb8c56 100755 --- a/octoprint_deploy.sh +++ b/octoprint_deploy.sh @@ -7,7 +7,13 @@ if (( $EUID != 0 )); then fi #this is a weak check, but will catch most cases -if [ $SUDO_USER ]; then user=$SUDO_USER; fi +if [ $SUDO_USER ]; then + user=$SUDO_USER +else + echo "You should not run this script as root. Use sudo as a normal user" + exit +fi + if [ "$user" == root ]; then echo "You should not run this script as root. Use sudo as a normal user" exit