feat: drop bootstrap.sh into the installed home

This commit is contained in:
Filip Suchy 2026-10-11 03:08:27 +02:00
parent a45f2eacd4
commit 7716ba810f
Signed by: nevim42
GPG Key ID: DA63EE05A1AB736C

View File

@ -16,7 +16,7 @@
# bash install.sh
#
# Flow: checks -> questions -> partition -> LUKS -> BTRFS -> pacstrap ->
# fstab -> chroot setup -> GRUB -> reboot
# fstab -> chroot setup -> GRUB -> bootstrap.sh -> reboot
#
set -euo pipefail
@ -77,6 +77,7 @@ readonly PACSTRAP_PACKAGES=(
wpa_supplicant wget neovim tmux
)
readonly HOOKS_ENCRYPTED="base systemd autodetect microcode modconf kms keyboard sd-vconsole block sd-encrypt filesystems fsck"
readonly RAW_BASE="https://gitea.nevim42.cz/nevim42/engram-boot/raw/branch/main"
# Filled in by ask_questions.
TARGET_DISK=""
@ -354,6 +355,30 @@ CHROOT
rm -f /mnt/root/engram-setup.sh
}
# ---------------------------------------------------------------------------
# bootstrap.sh - drop it into the new home, so the next step is one command.
# ---------------------------------------------------------------------------
fetch() {
if command -v curl >/dev/null; then
curl -fsSL "$1"
else
wget -qO- "$1"
fi
}
place_bootstrap() {
step "Dropping bootstrap.sh into /home/${USER_NAME}"
fetch "$RAW_BASE/bootstrap.sh" > "/mnt/home/${USER_NAME}/bootstrap.sh" \
|| die "Could not fetch bootstrap.sh from $RAW_BASE"
# A fresh system has exactly one user, so uid/gid 1000 is safe.
chown 1000:1000 "/mnt/home/${USER_NAME}/bootstrap.sh"
chmod +x "/mnt/home/${USER_NAME}/bootstrap.sh"
info "Waiting in the new home - no download needed after reboot."
}
# ---------------------------------------------------------------------------
# The exit - summary and reboot.
# ---------------------------------------------------------------------------
@ -368,7 +393,7 @@ finish() {
encrypted : ${ENCRYPTED}
SUMMARY
info "Reboot, log in as ${USER_NAME} and run the bootstrap - your engram is waiting."
info "Reboot and log in as ${USER_NAME} - run ~/bootstrap.sh, your engram is waiting."
local answer
read -rp " Reboot now? [y/N]: " answer
@ -405,6 +430,7 @@ main() {
pacstrap_base
generate_fstab
configure_system
place_bootstrap
finish
}