add docker install anim
This commit is contained in:
parent
2d36f66087
commit
c8ccdbaf3b
1 changed files with 36 additions and 2 deletions
|
|
@ -12,7 +12,6 @@ set -euo pipefail
|
||||||
TTY="/dev/tty"
|
TTY="/dev/tty"
|
||||||
|
|
||||||
BOLD="\033[1m"
|
BOLD="\033[1m"
|
||||||
DIM="\033[2m"
|
|
||||||
GREEN="\033[32m"
|
GREEN="\033[32m"
|
||||||
YELLOW="\033[33m"
|
YELLOW="\033[33m"
|
||||||
RED="\033[31m"
|
RED="\033[31m"
|
||||||
|
|
@ -66,6 +65,40 @@ apt_install() {
|
||||||
$SUDO apt-get install -y "$@" >/dev/null 2>&1
|
$SUDO apt-get install -y "$@" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Spinner (writes to /dev/tty so curl|bash stays safe)
|
||||||
|
########################################
|
||||||
|
run_with_spinner() {
|
||||||
|
local label="$1"; shift
|
||||||
|
|
||||||
|
# Run the provided command in the background
|
||||||
|
("$@") &
|
||||||
|
local pid=$!
|
||||||
|
|
||||||
|
local spin='|/-\'
|
||||||
|
local i=0
|
||||||
|
|
||||||
|
# Hide cursor
|
||||||
|
printf "\033[?25l" >"$TTY" || true
|
||||||
|
|
||||||
|
# Spinner loop
|
||||||
|
while kill -0 "$pid" 2>/dev/null; do
|
||||||
|
i=$(( (i + 1) % 4 ))
|
||||||
|
printf "\r${BLUE}${BOLD}..${RESET} %s %s" "${spin:$i:1}" "$label" >"$TTY"
|
||||||
|
sleep 0.12
|
||||||
|
done
|
||||||
|
|
||||||
|
# Wait for completion + capture exit status
|
||||||
|
wait "$pid"
|
||||||
|
local rc=$?
|
||||||
|
|
||||||
|
# Clear spinner line + show cursor
|
||||||
|
printf "\r\033[K" >"$TTY"
|
||||||
|
printf "\033[?25h" >"$TTY" || true
|
||||||
|
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# SSL config updater
|
# SSL config updater
|
||||||
########################################
|
########################################
|
||||||
|
|
@ -143,7 +176,8 @@ else
|
||||||
section "Installing Docker (quiet mode)"
|
section "Installing Docker (quiet mode)"
|
||||||
apt_install ca-certificates curl
|
apt_install ca-certificates curl
|
||||||
|
|
||||||
if curl -fsSL https://get.docker.com/ | CHANNEL=stable $SUDO bash >/dev/null 2>&1; then
|
# Quiet install + spinner so users know it's working
|
||||||
|
if run_with_spinner "Installing Docker..." bash -c "curl -fsSL https://get.docker.com/ | CHANNEL=stable ${SUDO:-} bash >/dev/null 2>&1"; then
|
||||||
say "Docker installed successfully"
|
say "Docker installed successfully"
|
||||||
say "$(docker --version)"
|
say "$(docker --version)"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue