ceos-alpine-installer/lib/base/02_doas.sh
John A. Hoeven a194c14077 Add CE OS Alpine installer v0.0.1 — Tier 0/1/2 dev scaffold
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>
2026-06-10 02:25:38 +02:00

46 lines
1.8 KiB
Bash

#!/usr/bin/env bash
# Created by John A. Hoeven with the ethical assistance of Claude AI
# ---------------------------------------------------------------------------
# 02_doas.sh
# ~/projects/ceos/alpine-installer/lib/base/02_doas.sh
# Version: v0.0.1 | Status: DEVELOPMENT
# Target: Alpine Linux x86-64 (tinkerpad / ThinkPad T480)
# ---------------------------------------------------------------------------
# Base Tier subscript: install doas and write /etc/doas.d/wheel.conf.
# Defines install_base_doas().
# ---------------------------------------------------------------------------
install_base_doas() {
log_info "--- base/02_doas: installing doas ---"
install_pkg "doas"
run_test "doas binary present" 'command -v doas >/dev/null 2>&1' warn
log_info "--- base/02_doas: configuring /etc/doas.d/wheel.conf ---"
if ! doas test -d /etc/doas.d 2>/dev/null; then
doas mkdir -p /etc/doas.d >> "${LOG_FILE}" 2>&1 \
|| { log_warn "Could not create /etc/doas.d — skipping wheel.conf"; return 1; }
fi
if doas test -f /etc/doas.d/wheel.conf 2>/dev/null; then
log_info "/etc/doas.d/wheel.conf already present — skipping write"
else
printf 'permit persist :wheel\n' \
| doas tee /etc/doas.d/wheel.conf > /dev/null 2>&1 \
|| log_warn "Failed to write wheel.conf — configure manually: permit persist :wheel"
run_test "wheel.conf written" '[[ -s /etc/doas.d/wheel.conf ]]' warn
fi
log_info "doas configuration complete"
}
# Standalone entry point
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
SCRIPT_NAME="02_doas"
source "${SCRIPT_DIR}/lib/ce-common.sh" || { echo "ERROR: ce-common.sh not found"; exit 1; }
check_not_root
install_base_doas
print_summary
fi