mirror of
https://github.com/Valkyrie00/bold-brew.git
synced 2026-03-14 14:25:53 +01:00
fix(install): use sudo for apt-get when not running as root
GitHub Actions runners are not root, so apt-get needs sudo. Detect if running as non-root and use sudo when available.
This commit is contained in:
parent
4be99a16b5
commit
75ad954791
1 changed files with 10 additions and 4 deletions
14
install.sh
14
install.sh
|
|
@ -88,16 +88,22 @@ command_exists() {
|
|||
install_linux_deps() {
|
||||
info "Installing required dependencies..."
|
||||
|
||||
# Use sudo if available and not root
|
||||
SUDO=""
|
||||
if [ "$(id -u)" -ne 0 ] && command_exists sudo; then
|
||||
SUDO="sudo"
|
||||
fi
|
||||
|
||||
if command_exists apt-get; then
|
||||
# Debian/Ubuntu
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq build-essential procps curl file git > /dev/null
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq build-essential procps curl file git > /dev/null
|
||||
elif command_exists dnf; then
|
||||
# Fedora/RHEL
|
||||
dnf install -y -q procps-ng curl file git gcc make > /dev/null
|
||||
$SUDO dnf install -y -q procps-ng curl file git gcc make > /dev/null
|
||||
elif command_exists pacman; then
|
||||
# Arch
|
||||
pacman -Sy --noconfirm --quiet base-devel procps-ng curl file git > /dev/null
|
||||
$SUDO pacman -Sy --noconfirm --quiet base-devel procps-ng curl file git > /dev/null
|
||||
else
|
||||
warn "Could not detect package manager. Please install: git, curl, build-essential"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue