root check
This commit is contained in:
+11
-3
@@ -31,12 +31,20 @@ esac
|
|||||||
|
|
||||||
echo -e "Selected hex color: $PRIMARY_COLOR\n"
|
echo -e "Selected hex color: $PRIMARY_COLOR\n"
|
||||||
|
|
||||||
# --- 1. Update and install dependencies ---
|
|
||||||
echo -n "📦 Checking and installing 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."
|
echo "Done."
|
||||||
else
|
else
|
||||||
echo "Failed! Check your internet connection."
|
echo "Failed! Check your internet connection or package manager state."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user