File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -88,16 +88,22 @@ command_exists() {
8888install_linux_deps () {
8989 info " Installing required dependencies..."
9090
91+ # Use sudo if available and not root
92+ SUDO=" "
93+ if [ " $( id -u) " -ne 0 ] && command_exists sudo; then
94+ SUDO=" sudo"
95+ fi
96+
9197 if command_exists apt-get; then
9298 # Debian/Ubuntu
93- apt-get update -qq
94- apt-get install -y -qq build-essential procps curl file git > /dev/null
99+ $SUDO apt-get update -qq
100+ $SUDO apt-get install -y -qq build-essential procps curl file git > /dev/null
95101 elif command_exists dnf; then
96102 # Fedora/RHEL
97- dnf install -y -q procps-ng curl file git gcc make > /dev/null
103+ $SUDO dnf install -y -q procps-ng curl file git gcc make > /dev/null
98104 elif command_exists pacman; then
99105 # Arch
100- pacman -Sy --noconfirm --quiet base-devel procps-ng curl file git > /dev/null
106+ $SUDO pacman -Sy --noconfirm --quiet base-devel procps-ng curl file git > /dev/null
101107 else
102108 warn " Could not detect package manager. Please install: git, curl, build-essential"
103109 fi
You can’t perform that action at this time.
0 commit comments