feat: initial commit — void-installer multi-profile (stable-cinnamon + mainline-niri)
This commit is contained in:
118
installer/install.sh
Executable file
118
installer/install.sh
Executable file
@@ -0,0 +1,118 @@
|
||||
#!/bin/bash
|
||||
# Void Linux unattended-friendly installer for the XPS 17 (xps9700).
|
||||
# Runs inside the Void live ISO. Reads /etc/installer-secrets.env for passwords
|
||||
# and /usr/local/share/installer/install.conf for everything else.
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Resolve the real script path so this works whether invoked directly or via
|
||||
# the /usr/local/sbin/install-void symlink.
|
||||
INSTALLER_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
|
||||
SHARE_DIR="${INSTALLER_SHARE_DIR:-/usr/local/share/installer}"
|
||||
|
||||
# shellcheck source=lib/common.sh
|
||||
source "$INSTALLER_DIR/lib/common.sh"
|
||||
|
||||
# ---------- load config ----------
|
||||
CONFIG_FILE="${CONFIG_FILE:-$SHARE_DIR/install.conf}"
|
||||
[[ -r "$CONFIG_FILE" ]] || die "config file $CONFIG_FILE missing"
|
||||
# shellcheck disable=SC1090
|
||||
source "$CONFIG_FILE"
|
||||
log "loaded config from $CONFIG_FILE"
|
||||
|
||||
# Drop-in overrides (used by the QEMU test harness).
|
||||
if [[ -d "${CONFIG_FILE}.d" ]]; then
|
||||
for f in "${CONFIG_FILE}.d"/*.conf; do
|
||||
[[ -r "$f" ]] || continue
|
||||
# shellcheck disable=SC1090
|
||||
source "$f"
|
||||
log "loaded override $f"
|
||||
done
|
||||
fi
|
||||
|
||||
PKG_LIST_FILE="${PKG_LIST_FILE:-$SHARE_DIR/packages.list}"
|
||||
export PKG_LIST_FILE
|
||||
[[ -r "$PKG_LIST_FILE" ]] || die "packages.list $PKG_LIST_FILE missing"
|
||||
|
||||
# ---------- profile ----------
|
||||
PROJECT_DIR="${PROJECT_DIR:-$SHARE_DIR}"
|
||||
PROFILES_DIR="${PROFILES_DIR:-$SHARE_DIR/profiles}"
|
||||
export PROJECT_DIR PROFILES_DIR
|
||||
# shellcheck source=lib/profiles.sh
|
||||
source "$INSTALLER_DIR/lib/profiles.sh"
|
||||
load_profile || die "could not load profile '${PROFILE:-stable-cinnamon}'"
|
||||
# Profile may override the package list.
|
||||
[[ -r "$PROFILE_PACKAGES_FILE" ]] && PKG_LIST_FILE="$PROFILE_PACKAGES_FILE"
|
||||
log "using packages list: $PKG_LIST_FILE"
|
||||
|
||||
load_secrets
|
||||
|
||||
# ---------- pre-flight ----------
|
||||
require_root
|
||||
|
||||
# Default DEFAULT_ROOT_PART/EFI from config; will be confirmed/overridden by TUI.
|
||||
ROOT_PART="${ROOT_PART:-$DEFAULT_ROOT_PART}"
|
||||
EFI_PART="${EFI_PART:-$DEFAULT_EFI_PART}"
|
||||
TARGET="${TARGET:-/mnt}"
|
||||
export TARGET
|
||||
|
||||
# ---------- modules ----------
|
||||
# shellcheck source=lib/tui.sh
|
||||
source "$INSTALLER_DIR/lib/tui.sh"
|
||||
# shellcheck source=lib/partition.sh
|
||||
source "$INSTALLER_DIR/lib/partition.sh"
|
||||
# shellcheck source=lib/bootstrap.sh
|
||||
source "$INSTALLER_DIR/lib/bootstrap.sh"
|
||||
# shellcheck source=lib/grub.sh
|
||||
source "$INSTALLER_DIR/lib/grub.sh"
|
||||
# shellcheck source=lib/postinstall.sh
|
||||
source "$INSTALLER_DIR/lib/postinstall.sh"
|
||||
# shellcheck source=lib/customizations.sh
|
||||
source "$INSTALLER_DIR/lib/customizations.sh"
|
||||
|
||||
# ---------- run ----------
|
||||
banner() {
|
||||
cat <<'EOF'
|
||||
|
||||
╔══════════════════════════════════════════════════════════════╗
|
||||
║ Void Linux Installer (xps9700) ║
|
||||
║ target: btrfs on a single partition, dual-boot Windows ║
|
||||
║ desktop: cinnamon | docker | vscode | nvidia PRIME ║
|
||||
╚══════════════════════════════════════════════════════════════╝
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
banner
|
||||
log "starting installer (UNATTENDED=${UNATTENDED:-0}, TEST_MODE=${TEST_MODE:-0})"
|
||||
|
||||
tui_select_install_target
|
||||
setup_filesystems
|
||||
bootstrap_base
|
||||
generate_fstab
|
||||
mount_pseudo_fs
|
||||
|
||||
configure_system
|
||||
configure_users
|
||||
configure_ssh_config
|
||||
configure_nvidia_prime
|
||||
configure_zram
|
||||
configure_nix
|
||||
install_vscode_real
|
||||
install_customizations
|
||||
enable_services
|
||||
install_grub
|
||||
reconfigure_all
|
||||
|
||||
unmount_target
|
||||
|
||||
ok "Installation complete."
|
||||
log "Log file: $LOG_FILE"
|
||||
if [[ "${TEST_MODE:-0}" != "1" && "${UNATTENDED:-0}" != "1" ]]; then
|
||||
if confirm "Reboot now?"; then
|
||||
systemctl reboot 2>/dev/null || reboot
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user