agent: Arch support
This commit is contained in:
@@ -2,13 +2,36 @@
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Description:
|
# Description:
|
||||||
# Print operating system information.
|
# Print operating system information and hint which installer path will run.
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
# macOS info
|
||||||
sw_vers
|
sw_vers
|
||||||
|
log_info "Detected macOS (OSTYPE=$OSTYPE)"
|
||||||
|
log_info "Package manager: Homebrew (brew)"
|
||||||
|
log_info "Code path: macOS-only brew scripts will run; Linux package scripts are skipped."
|
||||||
|
|
||||||
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
# Linux info
|
||||||
|
if [[ -r /etc/os-release ]]; then
|
||||||
cat /etc/os-release
|
cat /etc/os-release
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. /etc/os-release
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_info "Detected Linux (OSTYPE=$OSTYPE, ID=${ID:-unknown}, ID_LIKE=${ID_LIKE:-n/a}, NAME=${NAME:-n/a}, VERSION_ID=${VERSION_ID:-n/a})"
|
||||||
|
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
|
log_info "Package manager detected: apt-get"
|
||||||
|
export DOTS_PKG_MGR=apt
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
log_info "Package manager detected: pacman"
|
||||||
|
export DOTS_PKG_MGR=pacman
|
||||||
|
else
|
||||||
|
log_warn "No known package manager (apt-get/pacman) found on Linux."
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
log_error "Unknown OS: $OSTYPE"
|
log_error "Unknown OS: $OSTYPE"
|
||||||
fi
|
fi
|
||||||
|
|||||||
25
script/install.d/03-pacman.sh
Normal file
25
script/install.d/03-pacman.sh
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Description:
|
||||||
|
# (distros with pacman only) Install core pacman packages.
|
||||||
|
#
|
||||||
|
|
||||||
|
if command -v pacman &> /dev/null; then
|
||||||
|
pacman_packages=(
|
||||||
|
ca-certificates
|
||||||
|
curl
|
||||||
|
gnupg
|
||||||
|
wget
|
||||||
|
base-devel
|
||||||
|
)
|
||||||
|
|
||||||
|
sudo pacman -Sy --noconfirm
|
||||||
|
sudo pacman -S --noconfirm --needed "${pacman_packages[@]}"
|
||||||
|
|
||||||
|
unset pacman_packages
|
||||||
|
|
||||||
|
pacman --version
|
||||||
|
else
|
||||||
|
log_warn "Skipping: pacman not found"
|
||||||
|
fi
|
||||||
@@ -7,7 +7,13 @@
|
|||||||
|
|
||||||
if ! command -v git &> /dev/null; then
|
if ! command -v git &> /dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo apt-get install -qq git
|
sudo apt-get install -qq git
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm git
|
||||||
|
else
|
||||||
|
log_warn "Skipping git install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install git
|
brew install git
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -8,7 +8,13 @@
|
|||||||
# install zsh
|
# install zsh
|
||||||
if ! command -v zsh &> /dev/null; then
|
if ! command -v zsh &> /dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo apt-get install -qq zsh
|
sudo apt-get install -qq zsh
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm zsh
|
||||||
|
else
|
||||||
|
log_warn "Skipping zsh install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install zsh
|
brew install zsh
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,7 +7,13 @@
|
|||||||
|
|
||||||
if ! command -v stow &> /dev/null; then
|
if ! command -v stow &> /dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo apt-get install -qq stow
|
sudo apt-get install -qq stow
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm stow
|
||||||
|
else
|
||||||
|
log_warn "Skipping stow install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install stow
|
brew install stow
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ if ! echo "$PATH" | grep -q "$PYENV_ROOT"; then
|
|||||||
fi
|
fi
|
||||||
if ! command -v pyenv &>/dev/null; then
|
if ! command -v pyenv &>/dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
|
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
|
||||||
sudo apt-get install -qq build-essential libssl-dev zlib1g-dev \
|
sudo apt-get install -qq build-essential libssl-dev zlib1g-dev \
|
||||||
libbz2-dev libreadline-dev libsqlite3-dev curl \
|
libbz2-dev libreadline-dev libsqlite3-dev curl \
|
||||||
@@ -18,8 +19,17 @@ if ! command -v pyenv &>/dev/null; then
|
|||||||
|
|
||||||
# see https://github.com/pyenv/pyenv-installer
|
# see https://github.com/pyenv/pyenv-installer
|
||||||
bash -c "$(curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer)"
|
bash -c "$(curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer)"
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
unset pyenv_packages
|
# Prefer native packages if available; otherwise install build deps then use installer
|
||||||
|
if ! sudo pacman -Qi pyenv >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm --needed base-devel openssl zlib bzip2 readline sqlite xz tk libffi curl
|
||||||
|
bash -c "$(curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer)"
|
||||||
|
else
|
||||||
|
sudo pacman -S --noconfirm --needed pyenv pyenv-virtualenv
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_warn "Skipping pyenv install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install pyenv
|
brew install pyenv
|
||||||
brew install pyenv-virtualenv
|
brew install pyenv-virtualenv
|
||||||
|
|||||||
@@ -40,7 +40,13 @@ unset local_bin_path
|
|||||||
|
|
||||||
if ! command -v pipx &>/dev/null; then
|
if ! command -v pipx &>/dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo apt-get install -qq pipx
|
sudo apt-get install -qq pipx
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm python-pipx
|
||||||
|
else
|
||||||
|
log_warn "Skipping pipx install: no apt-get or pacman found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install pipx
|
brew install pipx
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ fi
|
|||||||
if [[ -z "$SKIP_DOCKER_CONFIG" ]]; then
|
if [[ -z "$SKIP_DOCKER_CONFIG" ]]; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
if ! command -v docker &> /dev/null; then
|
if ! command -v docker &> /dev/null; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo install -m 0755 -d /etc/apt/keyrings
|
sudo install -m 0755 -d /etc/apt/keyrings
|
||||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||||
@@ -38,6 +39,11 @@ if [[ -z "$SKIP_DOCKER_CONFIG" ]]; then
|
|||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm --needed docker docker-buildx docker-compose
|
||||||
|
else
|
||||||
|
log_warn "Skipping Docker install: no supported package manager found"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly docker_group="docker"
|
readonly docker_group="docker"
|
||||||
|
|||||||
@@ -7,12 +7,18 @@
|
|||||||
|
|
||||||
if ! command -v gh &>/dev/null; then
|
if ! command -v gh &>/dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
|
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
|
||||||
sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null &&
|
sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null &&
|
||||||
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg &&
|
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg &&
|
||||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null &&
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null &&
|
||||||
sudo apt-get update -qq &&
|
sudo apt-get update -qq &&
|
||||||
sudo apt-get install -qq gh
|
sudo apt-get install -qq gh
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm github-cli
|
||||||
|
else
|
||||||
|
log_warn "Skipping GitHub CLI install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install gh
|
brew install gh
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,8 +7,18 @@
|
|||||||
|
|
||||||
if ! command -v az &>/dev/null; then
|
if ! command -v az &>/dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
|
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
|
||||||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
if command -v yay >/dev/null 2>&1; then
|
||||||
|
yay -S --noconfirm azure-cli-bin || log_warn "AUR install failed for azure-cli-bin"
|
||||||
|
else
|
||||||
|
log_warn "Skipping Azure CLI: no AUR helper found"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_warn "Skipping Azure CLI install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install azure-cli
|
brew install azure-cli
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
if ! command -v terraform &>/dev/null; then
|
if ! command -v terraform &>/dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
terraform_keyring_path="/usr/share/keyrings/hashicorp-archive-keyring.gpg"
|
terraform_keyring_path="/usr/share/keyrings/hashicorp-archive-keyring.gpg"
|
||||||
if [[ ! -f "$terraform_keyring_path" ]]; then
|
if [[ ! -f "$terraform_keyring_path" ]]; then
|
||||||
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o "$terraform_keyring_path"
|
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o "$terraform_keyring_path"
|
||||||
@@ -16,6 +17,11 @@ if ! command -v terraform &>/dev/null; then
|
|||||||
sudo tee /etc/apt/sources.list.d/hashicorp.list
|
sudo tee /etc/apt/sources.list.d/hashicorp.list
|
||||||
sudo apt-get update -qq &&
|
sudo apt-get update -qq &&
|
||||||
sudo apt-get install -qq terraform
|
sudo apt-get install -qq terraform
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm terraform
|
||||||
|
else
|
||||||
|
log_warn "Skipping Terraform install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew tap hashicorp/tap
|
brew tap hashicorp/tap
|
||||||
brew install hashicorp/tap/terraform
|
brew install hashicorp/tap/terraform
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
if ! command -v redis-cli &>/dev/null; then
|
if ! command -v redis-cli &>/dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
redis_keyring_path="/usr/share/keyrings/redis-archive-keyring.gpg"
|
redis_keyring_path="/usr/share/keyrings/redis-archive-keyring.gpg"
|
||||||
if [[ ! -f "$redis_keyring_path" ]]; then
|
if [[ ! -f "$redis_keyring_path" ]]; then
|
||||||
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o "$redis_keyring_path"
|
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o "$redis_keyring_path"
|
||||||
@@ -14,6 +15,11 @@ if ! command -v redis-cli &>/dev/null; then
|
|||||||
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" \
|
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" \
|
||||||
| sudo tee /etc/apt/sources.list.d/redis.list > /dev/null
|
| sudo tee /etc/apt/sources.list.d/redis.list > /dev/null
|
||||||
sudo apt-get install -qq redis
|
sudo apt-get install -qq redis
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm redis
|
||||||
|
else
|
||||||
|
log_warn "Skipping Redis install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install redis
|
brew install redis
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,7 +7,13 @@
|
|||||||
|
|
||||||
if ! command -v neofetch &>/dev/null; then
|
if ! command -v neofetch &>/dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo apt-get install -qq neofetch &>/dev/null
|
sudo apt-get install -qq neofetch &>/dev/null
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm neofetch &>/dev/null
|
||||||
|
else
|
||||||
|
log_warn "Skipping neofetch install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install neofetch
|
brew install neofetch
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -14,7 +14,13 @@ fi
|
|||||||
if [[ -z "$SKIP_CMATRIX_CONFIG" ]]; then
|
if [[ -z "$SKIP_CMATRIX_CONFIG" ]]; then
|
||||||
if ! command -v cmatrix &> /dev/null; then
|
if ! command -v cmatrix &> /dev/null; then
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo apt-get install -qq cmatrix &>/dev/null
|
sudo apt-get install -qq cmatrix &>/dev/null
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm cmatrix &>/dev/null
|
||||||
|
else
|
||||||
|
log_warn "Skipping cmatrix install: no supported package manager found"
|
||||||
|
fi
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install cmatrix
|
brew install cmatrix
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -8,8 +8,19 @@
|
|||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew cleanup
|
brew cleanup
|
||||||
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo apt-get autoremove -qq
|
sudo apt-get autoremove -qq
|
||||||
sudo apt-get clean -qq
|
sudo apt-get clean -qq
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
# Remove orphans if any (ignore error if none)
|
||||||
|
if pacman -Qtdq >/dev/null 2>&1; then
|
||||||
|
sudo pacman -Rns --noconfirm $(pacman -Qtdq) || true
|
||||||
|
fi
|
||||||
|
# Clear package cache without interactive prompt
|
||||||
|
yes | sudo pacman -Scc >/dev/null 2>&1 || true
|
||||||
|
else
|
||||||
|
log_warn "Skipping cleanup: no supported package manager found"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_pass "Cleanup completed successfully!"
|
log_pass "Cleanup completed successfully!"
|
||||||
|
|||||||
Reference in New Issue
Block a user