summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-04-03 18:47:01 +0200
committerAhmed Abdelhalim <[email protected]>2026-04-03 18:47:01 +0200
commitc02d9b5def07bf487d9f0d3230fff2df8c210016 (patch)
treecfc32e4cc48451ba5d423b143c2e00b72a3fa0dc
parent73a2e01416dfcf48d6f75cc2ad303707907563f9 (diff)
Split archlinux setup on mac from others and fix EFI on mac
-rw-r--r--roles/bootstrap/tasks/install-archlinux-mac.yml72
-rw-r--r--roles/bootstrap/tasks/install-archlinux.yml26
-rw-r--r--roles/bootstrap/tasks/main.yml7
3 files changed, 78 insertions, 27 deletions
diff --git a/roles/bootstrap/tasks/install-archlinux-mac.yml b/roles/bootstrap/tasks/install-archlinux-mac.yml
new file mode 100644
index 0000000..ebf8059
--- /dev/null
+++ b/roles/bootstrap/tasks/install-archlinux-mac.yml
@@ -0,0 +1,72 @@
+---
+# 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"
+ changed_when: true
+
+- name: "Blacklist modules conflicting with broadcom-wl"
+ ansible.builtin.copy:
+ dest: "{{ mnt_root_path }}/etc/modprobe.d/broadcom-wl.conf"
+ mode: "0644"
+ content: |
+ blacklist brcmfmac
+ blacklist brcmutil
+ blacklist b43
+ blacklist ssb
+ blacklist bcma
+
+- name: "Load wl module at boot"
+ ansible.builtin.copy:
+ dest: "{{ mnt_root_path }}/etc/modules-load.d/broadcom-wl.conf"
+ mode: "0644"
+ content: |
+ wl
diff --git a/roles/bootstrap/tasks/install-archlinux.yml b/roles/bootstrap/tasks/install-archlinux.yml
index 02ba1f3..f4ce711 100644
--- a/roles/bootstrap/tasks/install-archlinux.yml
+++ b/roles/bootstrap/tasks/install-archlinux.yml
@@ -79,29 +79,3 @@
ansible.builtin.command:
cmd: "arch-chroot {{ mnt_root_path }} pacman -S --noconfirm python3"
changed_when: true
-
-- name: "Install broadcom-wl driver"
- ansible.builtin.command:
- cmd: "arch-chroot {{ mnt_root_path }} pacman -S --noconfirm broadcom-wl"
- changed_when: true
- when: bootstrap_mac
-
-- name: "Blacklist modules conflicting with broadcom-wl"
- ansible.builtin.copy:
- dest: "{{ mnt_root_path }}/etc/modprobe.d/broadcom-wl.conf"
- mode: "0644"
- content: |
- blacklist brcmfmac
- blacklist brcmutil
- blacklist b43
- blacklist ssb
- blacklist bcma
- when: bootstrap_mac
-
-- name: "Load wl module at boot"
- ansible.builtin.copy:
- dest: "{{ mnt_root_path }}/etc/modules-load.d/broadcom-wl.conf"
- mode: "0644"
- content: |
- wl
- when: bootstrap_mac
diff --git a/roles/bootstrap/tasks/main.yml b/roles/bootstrap/tasks/main.yml
index cc35056..cb92f99 100644
--- a/roles/bootstrap/tasks/main.yml
+++ b/roles/bootstrap/tasks/main.yml
@@ -6,8 +6,13 @@
mnt_root_path: "{{ partition_root.mount_path }}"
- name: "Install archlinux"
- ansible.builtin.include_tasks: "install-archlinux.yml"
when: ansible_facts['os_family'] == "Archlinux"
+ block:
+ - name: "Install archlinux"
+ ansible.builtin.include_tasks: "install-archlinux.yml"
+ - name: "Install archlinux on Mac"
+ ansible.builtin.include_tasks: "install-archlinux-mac.yml"
+ when: bootstrap_mac
- name: "Install debian"
when: ansible_facts['os_family'] == "Debian"