1
0
forked from finn/tinyboard

add multi-distro package manager support to setup-spoke.sh

This commit is contained in:
Justin Oros
2026-04-16 10:34:06 -07:00
parent 50fb313f9a
commit e5ecdca3ff

View File

@@ -49,16 +49,76 @@ HUB_USER="${HUB_USER:-armbian}"
header "TinyBoard Spoke Setup"
info "Installing packages..."
apt-get update -q
apt-get install -y -q vim autossh docker.io docker-compose-plugin git openssh-server
header "Detecting Package Manager"
if command -v apt-get >/dev/null 2>&1; then
PKG_MANAGER="apt"
PKG_INSTALL="apt-get install -y -q"
OPENSSH_PKG="openssh-server"
AUTOSSH_PKG="autossh"
info "Detected: apt (Debian/Ubuntu)"
apt-get update -q
elif command -v dnf >/dev/null 2>&1; then
PKG_MANAGER="dnf"
PKG_INSTALL="dnf install -y -q"
OPENSSH_PKG="openssh-server"
AUTOSSH_PKG="autossh"
info "Detected: dnf (Fedora/RHEL/Alma/Rocky)"
dnf check-update -q || true
elif command -v yum >/dev/null 2>&1; then
PKG_MANAGER="yum"
PKG_INSTALL="yum install -y -q"
OPENSSH_PKG="openssh-server"
AUTOSSH_PKG="autossh"
info "Detected: yum (older RHEL/CentOS)"
yum check-update -q || true
elif command -v pacman >/dev/null 2>&1; then
PKG_MANAGER="pacman"
PKG_INSTALL="pacman -S --noconfirm --quiet"
OPENSSH_PKG="openssh"
AUTOSSH_PKG="autossh"
info "Detected: pacman (Arch)"
pacman -Sy --quiet
else
die "No supported package manager found (apt, dnf, yum, pacman)"
fi
header "Installing Packages"
if ! command -v curl >/dev/null 2>&1; then
$PKG_INSTALL curl
fi
$PKG_INSTALL vim "$AUTOSSH_PKG" "$OPENSSH_PKG" git
info "Installing Docker..."
if ! command -v docker >/dev/null 2>&1; then
if [ "$PKG_MANAGER" = "apt" ]; then
$PKG_INSTALL docker.io docker-compose-plugin
else
curl -fsSL https://get.docker.com | bash
fi
else
warn "Docker already installed, skipping."
fi
if ! docker compose version >/dev/null 2>&1; then
if [ "$PKG_MANAGER" = "apt" ]; then
$PKG_INSTALL docker-compose-plugin
else
warn "docker compose not available — Docker install script should have included it."
fi
fi
info "Adding armbian to docker group..."
usermod -aG docker armbian 2>/dev/null || true
info "Enabling SSH server..."
systemctl enable ssh
systemctl start ssh
if systemctl enable ssh 2>/dev/null; then
systemctl start ssh
elif systemctl enable sshd 2>/dev/null; then
systemctl start sshd
else
warn "Could not enable SSH service — please start it manually."
fi
header "Hostname Setup"
CURRENT_HOSTNAME=$(hostname)