suse-professional-package-i.../main.sh

60 lines
2.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Created by John A. Hoeven with the ethical assistance of Claude AI
# ---------------------------------------------------------------------------
# main.sh
# /home/john/projects/suse-professional-package-installer/main.sh
# Version: v0.1.0 | Status: DEVELOPMENT
# ---------------------------------------------------------------------------
# Purpose: Orchestrator — installs zypper packages from an external,
# hand-edited package list instead of a one-off script per
# project. Add new package-list-driven subscripts under lib/ as
# new package managers are needed (kept fully separate per
# subscript — never combined, see spec/main_spec.md).
# Target: SUSE family (zypper). Common orchestrator, distro-specific
# subscripts.
# Entry: ./main.sh [package-list-file]
# Depends: lib/ce-common.sh, lib/00_preflight.sh, lib/10_zypper-packages.sh
# ---------------------------------------------------------------------------
# Orchestrator: exempt from the 100-line subscript boundary (argument
# parsing and subscript dispatch legitimately require it) — see
# ceos_script_architecture.md.
# ---------------------------------------------------------------------------
set -euo pipefail
_SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
usage() {
cat <<EOF
Usage: $(basename "${0}") [package-list-file]
Installs zypper packages listed in package-list-file (default:
local/zypper.list — gitignored, machine-specific; copy
packages/zypper.list.example there to start one) — one package name
per line, '#' comments and blank lines ignored.
Each package manager gets its own dedicated subscript under lib/,
invoked separately; this orchestrator never mixes zypper and pip/pipx
installs in the same run.
EOF
}
case "${1:-}" in
-h|--help) usage; exit 0 ;;
esac
_LIST_FILE="${1:-${_SCRIPT_DIR}/local/zypper.list}"
# shellcheck source=lib/ce-common.sh
source "${_SCRIPT_DIR}/lib/ce-common.sh"
log_info "=== suse-professional-package-installer starting ==="
log_info "Orchestrator holds no elevation; ${_SCRIPT_DIR}/lib/10_zypper-packages.sh escalates on its own"
"${_SCRIPT_DIR}/lib/00_preflight.sh"
"${_SCRIPT_DIR}/lib/10_zypper-packages.sh" "${_LIST_FILE}"
_STATUS=$?
log_info "=== suse-professional-package-installer finished (exit ${_STATUS}) ==="
exit "${_STATUS}"