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>
89 lines
3.3 KiB
Bash
89 lines
3.3 KiB
Bash
#!/usr/bin/env bash
|
|
# Created by John A. Hoeven with the ethical assistance of Claude AI
|
|
# ---------------------------------------------------------------------------
|
|
# ce-minimal.sh
|
|
# ~/projects/ceos/alpine-installer/ce-minimal.sh
|
|
# Version: v0.0.1 | Status: DEVELOPMENT
|
|
# Target: Alpine Linux x86-64 (tinkerpad / ThinkPad T480)
|
|
# ---------------------------------------------------------------------------
|
|
# Tier 1 — Minimal. Full TUI workstation on top of Base.
|
|
# Standalone-runnable. Sources lib/ce-common.sh and lib/minimal/*.sh.
|
|
# ---------------------------------------------------------------------------
|
|
|
|
SCRIPT_NAME="ce-minimal"
|
|
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/minimal/*.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 1: 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 0 complete" 'command -v curl >/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 >= 1GB" '[[ $(df / --output=avail | tail -1) -ge 1048576 ]]' warn
|
|
log_info "Arch: ${ARCH}"
|
|
log_info "Pre-flight complete"
|
|
}
|
|
|
|
phase_install() {
|
|
log_info "=== TIER 1: 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 vim 2>/dev/null | grep -q "^vim"' fail
|
|
|
|
install_minimal_shell
|
|
install_minimal_terminal
|
|
install_minimal_files
|
|
install_minimal_vcs
|
|
install_minimal_systools
|
|
install_minimal_comms
|
|
install_minimal_journal
|
|
install_minimal_web
|
|
install_minimal_network
|
|
install_minimal_record
|
|
install_minimal_wiki
|
|
install_minimal_access
|
|
}
|
|
|
|
phase_verify() {
|
|
log_info "=== TIER 1: VERIFY ==="
|
|
local tools=(tmux vim git gpg python3 lynx)
|
|
for tool in "${tools[@]}"; do
|
|
run_test "${tool} present" "command -v ${tool} >/dev/null 2>&1" warn
|
|
done
|
|
run_test "pipx present" 'command -v pipx >/dev/null 2>&1' warn
|
|
run_test "espeak-ng present" 'command -v espeak-ng >/dev/null 2>&1' warn
|
|
log_info "Tier 1 verify complete"
|
|
}
|
|
|
|
log_info "=== CE OS INSTALLER — TIER 1: MINIMAL ==="
|
|
log_info "Arch: ${ARCH} | Log: ${LOG_FILE}"
|
|
|
|
phase_preflight
|
|
confirm_proceed
|
|
phase_install
|
|
phase_verify
|
|
print_summary
|
|
|
|
log_info "=== TIER 1 COMPLETE ==="
|