mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
fix(install): install curl on machine init/add if missing (fixes #402)
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Avoid locale warnings (e.g. on apt install) from SSH-forwarded LANG/LC_* on minimal hosts. C.UTF-8 is built into
|
||||
# glibc and present on all supported distros, unlike locale-specific values like en_US.UTF-8 that may not be generated.
|
||||
export LC_ALL="${LC_ALL:-C.UTF-8}"
|
||||
|
||||
# If set to 'true', only install the packages and dependencies, without running, reloading, or
|
||||
# restarting services or systemd.
|
||||
INSTALL_ONLY=${INSTALL_ONLY:-false}
|
||||
@@ -64,6 +68,35 @@ Uncloud supports only systemd-based Linux systems for now."
|
||||
fi
|
||||
}
|
||||
|
||||
# install_prerequisites ensures curl is available, installing it with the system package manager if needed.
|
||||
install_prerequisites() {
|
||||
if command_exists curl; then
|
||||
return
|
||||
fi
|
||||
|
||||
log "⏳ curl is required but not installed, installing it using the system package manager..."
|
||||
|
||||
if command_exists apt-get; then
|
||||
apt-get update -qq >/dev/null
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq curl ca-certificates
|
||||
elif command_exists dnf; then
|
||||
dnf install -y curl ca-certificates
|
||||
elif command_exists yum; then
|
||||
yum install -y curl ca-certificates
|
||||
elif command_exists pacman; then
|
||||
pacman -Sy --noconfirm curl ca-certificates
|
||||
elif command_exists zypper; then
|
||||
zypper --non-interactive refresh >/dev/null
|
||||
zypper --non-interactive install curl ca-certificates
|
||||
else
|
||||
error "curl is required but not installed, and no supported package manager \
|
||||
(apt, dnf, yum, pacman, zypper) was found to install it automatically. \
|
||||
Please install curl manually and re-run the command."
|
||||
fi
|
||||
|
||||
log "✓ curl installed."
|
||||
}
|
||||
|
||||
install_docker() {
|
||||
if command_exists dockerd; then
|
||||
log "✓ Docker is already installed."
|
||||
@@ -298,6 +331,7 @@ if [ "$EUID" -ne 0 ]; then
|
||||
fi
|
||||
|
||||
verify_system
|
||||
install_prerequisites
|
||||
install_docker
|
||||
create_uncloud_user_and_group
|
||||
install_uncloud_binaries
|
||||
|
||||
Reference in New Issue
Block a user