diff options
Diffstat (limited to 'roles/bootstrap')
| -rw-r--r-- | roles/bootstrap/tasks/install-archlinux-mac.yml | 49 | ||||
| -rw-r--r-- | roles/bootstrap/tasks/install-archlinux.yml | 48 | ||||
| -rw-r--r-- | roles/bootstrap/tasks/install-ubuntu-mac.yml | 40 | ||||
| -rw-r--r-- | roles/bootstrap/tasks/install-ubuntu.yml | 53 | ||||
| -rw-r--r-- | roles/bootstrap/templates/refind.conf.j2 | 5 | ||||
| -rw-r--r-- | roles/bootstrap/templates/refind_arch.conf.j2 | 13 | ||||
| -rw-r--r-- | roles/bootstrap/templates/refind_linux.conf.j2 | 2 | ||||
| -rw-r--r-- | roles/bootstrap/templates/refind_ubuntu.conf.j2 | 13 |
8 files changed, 112 insertions, 111 deletions
diff --git a/roles/bootstrap/tasks/install-archlinux-mac.yml b/roles/bootstrap/tasks/install-archlinux-mac.yml index ebf8059..26ae9ee 100644 --- a/roles/bootstrap/tasks/install-archlinux-mac.yml +++ b/roles/bootstrap/tasks/install-archlinux-mac.yml @@ -1,53 +1,4 @@ --- -# Apple EFI 1.x does not expose ext4 volumes via SimpleFileSystem, so the -# kernel must live on the FAT32 EFI partition where rEFInd already scans \boot\. -- name: "Ensure boot directory exists on EFI partition" - ansible.builtin.file: - path: "{{ mnt_boot_path }}/boot" - state: directory - mode: "0755" - -- name: "Copy kernel to EFI partition" - ansible.builtin.copy: - src: "{{ mnt_root_path }}/boot/{{ item }}" - dest: "{{ mnt_boot_path }}/boot/{{ item }}" - remote_src: true - mode: "0644" - loop: - - "vmlinuz-linux" - - "initramfs-linux.img" - -- name: "Configure rEFInd boot options on EFI partition" - ansible.builtin.template: - src: "refind_linux.conf.j2" - dest: "{{ mnt_boot_path }}/boot/refind_linux.conf" - mode: "0644" - -- name: "Install kernel sync script for EFI partition" - ansible.builtin.copy: - dest: "{{ mnt_root_path }}/usr/local/bin/refind-sync-kernel" - mode: "0755" - content: | - #!/bin/sh - cp /boot/vmlinuz-linux /boot/efi/boot/ - cp /boot/initramfs-linux.img /boot/efi/boot/ - -- name: "Override pacman hook to sync kernel to EFI partition" - ansible.builtin.copy: - dest: "{{ mnt_root_path }}/etc/pacman.d/100-refind.hook" - mode: "0644" - content: | - [Trigger] - Type = Package - Operation = Install - Operation = Upgrade - Target = linux - - [Action] - Description = Syncing kernel to EFI partition after kernel update - When = PostTransaction - Exec = /usr/local/bin/refind-sync-kernel - - name: "Install broadcom-wl driver" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} pacman -S --noconfirm broadcom-wl" diff --git a/roles/bootstrap/tasks/install-archlinux.yml b/roles/bootstrap/tasks/install-archlinux.yml index f4ce711..f32aebc 100644 --- a/roles/bootstrap/tasks/install-archlinux.yml +++ b/roles/bootstrap/tasks/install-archlinux.yml @@ -35,30 +35,58 @@ - "pacman-key --populate" - "pacman -Syyu --noconfirm" -- name: "Ensure rEFInd bootloader installed" +- name: "Ensure rEFInd package installed" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} pacman -S --noconfirm refind" changed_when: true -- name: "Install rEFInd" +- name: "Install rEFInd to EFI partition" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} refind-install" changed_when: true -- name: "Configure rEFInd boot options" +- name: "Configure rEFInd base settings" ansible.builtin.template: - src: "refind_linux.conf.j2" - dest: "{{ mnt_root_path }}/boot/refind_linux.conf" + src: "refind.conf.j2" + dest: "{{ mnt_boot_path }}/EFI/refind/refind.conf" mode: "0644" + # NOTE: this is skipped because the docker test doesn't have proper EFI/refind directory created + tags: ["molecule-notest"] -- name: "Configure rEFInd settings" +- name: "Ensure arch EFI boot directory exists" + ansible.builtin.file: + path: "{{ mnt_boot_path }}/EFI/arch" + state: directory + mode: "0755" + +- name: "Copy kernel to EFI partition" + ansible.builtin.copy: + src: "{{ mnt_root_path }}/boot/{{ item }}" + dest: "{{ mnt_boot_path }}/EFI/arch/{{ item }}" + remote_src: true + mode: "0644" + loop: + - "vmlinuz-linux" + - "initramfs-linux.img" + +- name: "Configure Arch Linux boot entries" ansible.builtin.template: - src: "refind.conf.j2" - dest: "{{ mnt_boot_path }}/EFI/refind/refind.conf" + src: "refind_arch.conf.j2" + dest: "{{ mnt_boot_path }}/EFI/refind/arch.conf" mode: "0644" # NOTE: this is skipped because the docker test doesn't have proper EFI/refind directory created tags: ["molecule-notest"] +- name: "Install kernel sync script for EFI partition" + ansible.builtin.copy: + dest: "{{ mnt_root_path }}/usr/local/bin/refind-sync-kernel" + mode: "0755" + content: | + #!/bin/sh + mkdir -p /boot/efi/EFI/arch + cp /boot/vmlinuz-linux /boot/efi/EFI/arch/ + cp /boot/initramfs-linux.img /boot/efi/EFI/arch/ + - name: "Configure pacman hook for rEFInd kernel updates" ansible.builtin.copy: dest: "{{ mnt_root_path }}/etc/pacman.d/100-refind.hook" @@ -71,9 +99,9 @@ Target = linux [Action] - Description = Updating rEFInd after kernel update + Description = Syncing kernel to EFI partition after kernel update When = PostTransaction - Exec = /usr/bin/refind-install + Exec = /usr/local/bin/refind-sync-kernel - name: "Ensure ansible dependencies are installed in chroot" ansible.builtin.command: diff --git a/roles/bootstrap/tasks/install-ubuntu-mac.yml b/roles/bootstrap/tasks/install-ubuntu-mac.yml index 005c403..2cdbd7d 100644 --- a/roles/bootstrap/tasks/install-ubuntu-mac.yml +++ b/roles/bootstrap/tasks/install-ubuntu-mac.yml @@ -1,44 +1,4 @@ --- -# Apple EFI 1.x does not expose ext4 volumes via SimpleFileSystem, so the -# kernel must live on the FAT32 EFI partition where rEFInd already scans \boot\. -- name: "Ensure boot directory exists on EFI partition" - ansible.builtin.file: - path: "{{ mnt_boot_path }}/boot" - state: directory - mode: "0755" - -- name: "Copy kernel to EFI partition" - ansible.builtin.copy: - src: "{{ mnt_root_path }}/boot/{{ item }}" - dest: "{{ mnt_boot_path }}/boot/{{ item }}" - remote_src: true - follow: true - mode: "0644" - loop: - - "vmlinuz" - - "initrd.img" - -- name: "Configure rEFInd boot options on EFI partition" - ansible.builtin.template: - src: "refind_linux.conf.j2" - dest: "{{ mnt_boot_path }}/boot/refind_linux.conf" - mode: "0644" - -- name: "Ensure kernel post-install hook directory exists" - ansible.builtin.file: - path: "{{ mnt_root_path }}/etc/kernel/postinst.d" - state: directory - mode: "0755" - -- name: "Install kernel sync script for EFI partition" - ansible.builtin.copy: - dest: "{{ mnt_root_path }}/etc/kernel/postinst.d/refind-sync-kernel" - mode: "0755" - content: | - #!/bin/sh - cp /boot/vmlinuz /boot/efi/boot/ - cp /boot/initrd.img /boot/efi/boot/ - - name: "Install bcmwl-kernel-source in chroot" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} apt-get install -y bcmwl-kernel-source" diff --git a/roles/bootstrap/tasks/install-ubuntu.yml b/roles/bootstrap/tasks/install-ubuntu.yml index 3c18b0e..cb4add5 100644 --- a/roles/bootstrap/tasks/install-ubuntu.yml +++ b/roles/bootstrap/tasks/install-ubuntu.yml @@ -44,28 +44,61 @@ - "apt-get update" - "apt-get install -y {{ bootstrap_distro.packages | join(' ') }}" -- name: "Ensure rEFInd bootloader installed" +- name: "Ensure rEFInd package installed" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} apt-get install -y refind" changed_when: true -- name: "Install rEFInd" +- name: "Install rEFInd to EFI partition" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} refind-install" changed_when: true -- name: "Configure rEFInd boot options" +- name: "Configure rEFInd base settings" ansible.builtin.template: - src: "refind_linux.conf.j2" - dest: "{{ mnt_root_path }}/boot/refind_linux.conf" + src: "refind.conf.j2" + dest: "{{ mnt_boot_path }}/EFI/refind/refind.conf" mode: "0644" + # NOTE: this is skipped because the docker test doesn't have proper EFI/refind directory created + tags: ["molecule-notest"] + +- name: "Ensure ubuntu EFI boot directory exists" + ansible.builtin.file: + path: "{{ mnt_boot_path }}/EFI/ubuntu" + state: directory + mode: "0755" -- name: "Configure rEFInd settings" +- name: "Copy kernel to EFI partition" ansible.builtin.copy: - dest: "{{ mnt_boot_path }}/EFI/refind/refind.conf" + src: "{{ mnt_root_path }}/boot/{{ item }}" + dest: "{{ mnt_boot_path }}/EFI/ubuntu/{{ item }}" + remote_src: true + follow: true + mode: "0644" + loop: + - "vmlinuz" + - "initrd.img" + +- name: "Configure Ubuntu boot entries" + ansible.builtin.template: + src: "refind_ubuntu.conf.j2" + dest: "{{ mnt_boot_path }}/EFI/refind/ubuntu.conf" mode: "0644" - content: | - timeout 5 - textonly true # NOTE: this is skipped because the docker test doesn't have proper EFI/refind directory created tags: ["molecule-notest"] + +- name: "Ensure kernel post-install hook directory exists" + ansible.builtin.file: + path: "{{ mnt_root_path }}/etc/kernel/postinst.d" + state: directory + mode: "0755" + +- name: "Install kernel sync script for EFI partition" + ansible.builtin.copy: + dest: "{{ mnt_root_path }}/etc/kernel/postinst.d/refind-sync-kernel" + mode: "0755" + content: | + #!/bin/sh + mkdir -p /boot/efi/EFI/ubuntu + cp /boot/vmlinuz /boot/efi/EFI/ubuntu/ + cp /boot/initrd.img /boot/efi/EFI/ubuntu/ diff --git a/roles/bootstrap/templates/refind.conf.j2 b/roles/bootstrap/templates/refind.conf.j2 index 995ae1e..3b15a3d 100644 --- a/roles/bootstrap/templates/refind.conf.j2 +++ b/roles/bootstrap/templates/refind.conf.j2 @@ -1,5 +1,10 @@ timeout 5 textonly true +scan_all_linux_kernels false +dont_scan_files vmlinuz,vmlinuz-linux,initrd.img,initramfs-linux.img +hideui hints {% if bootstrap_mac %} spoof_osx_version 12.7 {% endif %} +include ubuntu.conf +include arch.conf diff --git a/roles/bootstrap/templates/refind_arch.conf.j2 b/roles/bootstrap/templates/refind_arch.conf.j2 new file mode 100644 index 0000000..0551cb3 --- /dev/null +++ b/roles/bootstrap/templates/refind_arch.conf.j2 @@ -0,0 +1,13 @@ +menuentry "Arch Linux" { + volume "boot" + loader \EFI\arch\vmlinuz-linux + initrd \EFI\arch\initramfs-linux.img + options "root=PARTLABEL={{ partition_root.name }} rw console=tty1{% if bootstrap_mac %} {{ bootstrap_mac_boot_args }}{% endif %}" +} + +menuentry "Arch Linux (terminal)" { + volume "boot" + loader \EFI\arch\vmlinuz-linux + initrd \EFI\arch\initramfs-linux.img + options "root=PARTLABEL={{ partition_root.name }} rw console=tty1 systemd.unit=multi-user.target{% if bootstrap_mac %} {{ bootstrap_mac_boot_args }}{% endif %}" +} diff --git a/roles/bootstrap/templates/refind_linux.conf.j2 b/roles/bootstrap/templates/refind_linux.conf.j2 deleted file mode 100644 index 9b5868b..0000000 --- a/roles/bootstrap/templates/refind_linux.conf.j2 +++ /dev/null @@ -1,2 +0,0 @@ -"{{ ansible_facts['distribution'] }}" "root=PARTLABEL={{ partition_root.name }} rw console=tty1{% if bootstrap_mac %} {{ bootstrap_mac_boot_args }}{% endif %}" -"{{ ansible_facts['distribution'] }} (terminal)" "root=PARTLABEL={{ partition_root.name }} rw console=tty1 systemd.unit=multi-user.target{% if bootstrap_mac %} {{ bootstrap_mac_boot_args }}{% endif %}" diff --git a/roles/bootstrap/templates/refind_ubuntu.conf.j2 b/roles/bootstrap/templates/refind_ubuntu.conf.j2 new file mode 100644 index 0000000..20d5586 --- /dev/null +++ b/roles/bootstrap/templates/refind_ubuntu.conf.j2 @@ -0,0 +1,13 @@ +menuentry "Ubuntu" { + volume "boot" + loader \EFI\ubuntu\vmlinuz + initrd \EFI\ubuntu\initrd.img + options "root=PARTLABEL={{ partition_root.name }} rw console=tty1{% if bootstrap_mac %} {{ bootstrap_mac_boot_args }}{% endif %}" +} + +menuentry "Ubuntu (terminal)" { + volume "boot" + loader \EFI\ubuntu\vmlinuz + initrd \EFI\ubuntu\initrd.img + options "root=PARTLABEL={{ partition_root.name }} rw console=tty1 systemd.unit=multi-user.target{% if bootstrap_mac %} {{ bootstrap_mac_boot_args }}{% endif %}" +} |
