From 1fb4f551194f42dd749cfa4ada4662caac122479 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 12 Mar 2023 17:27:45 +0100 Subject: [PATCH] Add the actual task to test if chrooting works (bootloaders) --- configs/crystal/create-partitions/up.nu | 2 +- configs/crystal/install-base/up.nu | 5 ++++ configs/crystal/install-bootloader/up.nu | 38 +++++++++++++++++++++++- configs/crystal/install-kernels/up.nu | 1 + 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/configs/crystal/create-partitions/up.nu b/configs/crystal/create-partitions/up.nu index c2884aa..7913296 100644 --- a/configs/crystal/create-partitions/up.nu +++ b/configs/crystal/create-partitions/up.nu @@ -82,5 +82,5 @@ def main [cfg] { info "Creating partitions manually" } - info "Partitions created" + info "Partitions created!" } diff --git a/configs/crystal/install-base/up.nu b/configs/crystal/install-base/up.nu index c15b72b..0612e42 100644 --- a/configs/crystal/install-base/up.nu +++ b/configs/crystal/install-base/up.nu @@ -24,6 +24,10 @@ def install_base_packages [] { which base-devel + # chaotic aur + chaotic-keyring + chaotic-mirrorlist + # fonts noto-fonts noto-fonts-emoji @@ -61,4 +65,5 @@ def main [cfg] { install_base_packages cp /etc/pacman.conf /mnt/etc/pacman.conf run bash -c 'genfstab -U /mnt >> /mnt/etc/fstab' + info "Base packages installed!" } diff --git a/configs/crystal/install-bootloader/up.nu b/configs/crystal/install-bootloader/up.nu index e38bdf8..64ce9c2 100644 --- a/configs/crystal/install-bootloader/up.nu +++ b/configs/crystal/install-bootloader/up.nu @@ -1,5 +1,41 @@ let RUN_IN_CHROOT = true; + +def install_grub_pkgs [] { + (run pacman -S --noconfirm + grub + efibootmgr + crystal-grub-theme + os-prober + crystal-branding + ) +} + +def install_grub_efi [location: string] { + debug $"Installing grub to ($location)" + install_grub_pkgs + + (run grub-install + --target=x86_64-efi + --efi-directory $location + --bootloader-id=crystal + --removable + ) + (run grub-install + --target=x86_64-efi + --efi-directory $location + --bootloader-id=crystal + ) + "\nGRUB_THEME=\"/usr/share/grub/themes/crystal/theme.txt\"" | save --append /etc/default/grub + run grub-mkconfig -o /boot/grub/grub.cfg +} + # Applies all system changes of `install-bootloader` def main [cfg] { - echo "Executing up task `install-bootloader` with config" $cfg + debug "Installing bootloader with config ($cfg)" + + if $cfg.preset == "GrubEfi" { + install_grub_efi $cfg.location + } else { + error make {msg: "Not implemented"} + } } diff --git a/configs/crystal/install-kernels/up.nu b/configs/crystal/install-kernels/up.nu index 7512f18..f58fdf3 100644 --- a/configs/crystal/install-kernels/up.nu +++ b/configs/crystal/install-kernels/up.nu @@ -23,4 +23,5 @@ def main [cfg] { warn $"Unsupported kernel ($k)" } } + info "Kernels installed!" }