Staged installer set for Alpine Linux x86-64 (tinkerpad/ThinkPad T480). Covers Base (Tier 0), Minimal (Tier 1), and Basic (Tier 2) tiers with full phased structure, per-package error capture, and re-runnable test suites. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
83 lines
3.1 KiB
Bash
83 lines
3.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Created by John A. Hoeven with the ethical assistance of Claude AI
|
|
# ---------------------------------------------------------------------------
|
|
# ce-basic.sh
|
|
# ~/projects/ceos/alpine-installer/ce-basic.sh
|
|
# Version: v0.0.1 | Status: DEVELOPMENT
|
|
# Target: Alpine Linux x86-64 (tinkerpad / ThinkPad T480)
|
|
# ---------------------------------------------------------------------------
|
|
# Tier 2 — Basic. Daily-use additions on top of Minimal.
|
|
# Standalone-runnable. Sources lib/ce-common.sh and lib/basic/*.sh.
|
|
# ---------------------------------------------------------------------------
|
|
|
|
SCRIPT_NAME="ce-basic"
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
source "${SCRIPT_DIR}/lib/ce-common.sh" \
|
|
|| { echo "ERROR: lib/ce-common.sh not found"; exit 1; }
|
|
|
|
for _sub in "${SCRIPT_DIR}"/lib/basic/*.sh; do
|
|
source "${_sub}" || { log_error "Failed to source: ${_sub}"; exit 1; }
|
|
done
|
|
unset _sub
|
|
|
|
cleanup() {
|
|
local exit_code="${?}"
|
|
log_info "Running cleanup..."
|
|
doas apk cache clean >> "${LOG_FILE}" 2>&1 || true
|
|
doas rm -rf /var/cache/apk/* >> "${LOG_FILE}" 2>&1 || true
|
|
log_info "Cleanup complete (exit code: ${exit_code})"
|
|
}
|
|
trap cleanup EXIT INT TERM HUP
|
|
|
|
phase_preflight() {
|
|
log_info "=== TIER 2: PRE-FLIGHT ==="
|
|
check_not_root
|
|
run_test "bash >= 4" '[[ "${BASH_VERSINFO[0]}" -ge 4 ]]' fail
|
|
run_test "arch detected" '[[ -n "${ARCH}" ]]' fail
|
|
run_test "doas present" 'command -v doas >/dev/null 2>&1' fail
|
|
run_test "Tier 1 complete" 'command -v tmux >/dev/null 2>&1' fail
|
|
run_test "community repo enabled" 'grep -q "^[^#].*community" /etc/apk/repositories' fail
|
|
run_test "internet reachable" \
|
|
'curl --silent --max-time 10 --output /dev/null https://dl-cdn.alpinelinux.org' warn
|
|
run_test "disk >= 2GB" '[[ $(df / --output=avail | tail -1) -ge 2097152 ]]' warn
|
|
log_info "Arch: ${ARCH}"
|
|
log_info "Pre-flight complete"
|
|
}
|
|
|
|
phase_install() {
|
|
log_info "=== TIER 2: INSTALL ==="
|
|
doas apk update >> "${LOG_FILE}" 2>&1 \
|
|
&& doas apk upgrade >> "${LOG_FILE}" 2>&1 \
|
|
|| { log_error "apk update/upgrade failed"; exit 1; }
|
|
run_test "apk functional" 'apk search jq 2>/dev/null | grep -q "^jq"' fail
|
|
|
|
install_basic_comms
|
|
install_basic_monitor
|
|
install_basic_gui
|
|
install_basic_media
|
|
install_basic_fonts
|
|
install_basic_utils
|
|
}
|
|
|
|
phase_verify() {
|
|
log_info "=== TIER 2: VERIFY ==="
|
|
local tools=(jq bc zip unzip ffmpeg mpv cmus figlet)
|
|
for tool in "${tools[@]}"; do
|
|
run_test "${tool} present" "command -v ${tool} >/dev/null 2>&1" warn
|
|
done
|
|
run_test "cagebreak present" 'command -v cagebreak >/dev/null 2>&1' warn
|
|
run_test "firefox present" 'command -v firefox >/dev/null 2>&1' warn
|
|
log_info "Tier 2 verify complete"
|
|
}
|
|
|
|
log_info "=== CE OS INSTALLER — TIER 2: BASIC ==="
|
|
log_info "Arch: ${ARCH} | Log: ${LOG_FILE}"
|
|
|
|
phase_preflight
|
|
confirm_proceed
|
|
phase_install
|
|
phase_verify
|
|
print_summary
|
|
|
|
log_info "=== TIER 2 COMPLETE ==="
|