Build booster initramfs if it does not exist

Working from a chroot we need to manually look for the existing kernels
and build an initramfs from them. We can not just use the auto detection
functionality since it will detect the _HOST_ system's running kernel.

Instead we get the kernel module dir(s) and manually build a booster
initramfs for each one found.
This commit is contained in:
Marty Oehme 2025-02-21 12:43:14 +01:00
parent 8a77b201bd
commit 68e1cf4098
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -37,18 +37,31 @@
community.general.xbps:
name: booster
state: present
changed_when: True
notify: installed-booster
handlers:
- name: List installed linux kernels
find:
- name: List kernel module dirs
ansible.builtin.find:
paths: "/usr/lib/modules"
register: found_kernel
file_type: directory
register: found_kernels
listen: installed-booster
- name: Find kernel
debug:
msg: "{{ found_kernel['files'] | map(attribute='path') | map('regex_replace', '^.*/(.*)$', '\\1') | list }}"
- name: Find kernels
ansible.builtin.set_fact:
kernel_list: "{{ found_kernels['files'] | map(attribute='path') | map('regex_replace', '^.*/(.*)$', '\\1') | list }}"
listen: installed-booster
- name: Create booster initramfs
vars:
fname: /boot/booster-void
ansible.builtin.command:
argv:
- booster
- --verbose
- build
- --kernel-version={{ item }}
- "{{ fname }}-{{ item }}.img"
creates: "{{ fname }}-{{ item }}.img"
loop: "{{ kernel_list }}"
listen: installed-booster