From 7fabfa4bca8b33eda4dc9d6f699734baa56c66bb Mon Sep 17 00:00:00 2001 From: ashtom50 Date: Fri, 1 May 2026 15:05:47 +0100 Subject: [PATCH] root check --- install-debian.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/install-debian.sh b/install-debian.sh index 3b9718e..db97568 100644 --- a/install-debian.sh +++ b/install-debian.sh @@ -31,12 +31,20 @@ esac echo -e "Selected hex color: $PRIMARY_COLOR\n" -# --- 1. Update and install dependencies --- echo -n "📦 Checking and installing dependencies... " -if sudo apt install -y git curl lsd micro zoxide fzf > /dev/null 2>&1; then + +# Define the command: Use sudo only if NOT root +if [ "$EUID" -ne 0 ]; then + CMD="sudo apt install -y" +else + CMD="apt install -y" +fi + +# Execute the command +if $CMD git curl lsd micro zoxide fzf > /dev/null 2>&1; then echo "Done." else - echo "Failed! Check your internet connection." + echo "Failed! Check your internet connection or package manager state." exit 1 fi