Skip to content

Commit

Permalink
refactor initramfs regeneration to be at the end of each build
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyalOughtness authored Oct 29, 2024
1 parent 2c53aec commit 57bb4e4
Show file tree
Hide file tree
Showing 30 changed files with 44 additions and 13 deletions.
11 changes: 11 additions & 0 deletions files/scripts/regenerateinitramfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# Tell build process to exit if there are any errors.
set -oue pipefail


rpm-ostree cliwrap install-to-root /

QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(\d+\.\d+\.\d+)' | sed -E 's/kernel-//')"
/usr/libexec/rpm-ostree/wrapped/dracut --no-hostonly --kver "$QUALIFIED_KERNEL" --reproducible -v --add ostree -f "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"
chmod 0600 "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"
6 changes: 0 additions & 6 deletions files/scripts/setearlyloading.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,3 @@ set -oue pipefail

sed -i 's@omit_drivers@force_drivers@g' /usr/lib/dracut/dracut.conf.d/99-nvidia.conf
sed -i 's@ nvidia @ i915 amdgpu nvidia @g' /usr/lib/dracut/dracut.conf.d/99-nvidia.conf

rpm-ostree cliwrap install-to-root /

QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(\d+\.\d+\.\d+)' | sed -E 's/kernel-//')"
/usr/libexec/rpm-ostree/wrapped/dracut --no-hostonly --kver "$QUALIFIED_KERNEL" --reproducible -v --add ostree -f "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"
chmod 0600 "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"
1 change: 0 additions & 1 deletion recipes/common/common-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ modules:
- type: script
scripts:
- installsignedkernel.sh
- removeunusedrepos.sh

- type: containerfile
snippets:
Expand Down
5 changes: 5 additions & 0 deletions recipes/common/final-modules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
modules:
- type: script
scripts:
- removeunusedrepos.sh
- regenerateinitramfs.sh
1 change: 0 additions & 1 deletion recipes/common/nvidia-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ modules:
- type: script
scripts:
- installnvidiatoolkitpolicy.sh
- removeunusedrepos.sh
- setearlyloading.sh
- setdrmvariables.sh
1 change: 0 additions & 1 deletion recipes/common/nvidia-open-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ modules:
- type: script
scripts:
- installnvidiatoolkitpolicy.sh
- removeunusedrepos.sh
- setearlyloading.sh
- setdrmvariables.sh
1 change: 1 addition & 0 deletions recipes/recipe-hyprland-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/hyprland-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-hyprland-nvidia-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/nvidia-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/hyprland-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-hyprland-nvidia-open-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/nvidia-open-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/hyprland-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-hyprland-nvidia-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/nvidia-open-modules.yml
- from-file: common/hyprland-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-hyprland-nvidia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/nvidia-modules.yml
- from-file: common/hyprland-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-hyprland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ modules:
- from-file: common/sddm-modules.yml
- from-file: common/common-modules.yml
- from-file: common/hyprland-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-river-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/river-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-river-nvidia-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/nvidia-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/river-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-river-nvidia-open-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/nvidia-open-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/river-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-river-nvidia-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/nvidia-open-modules.yml
- from-file: common/river-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-river-nvidia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/nvidia-modules.yml
- from-file: common/river-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-river.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ modules:
- from-file: common/sddm-modules.yml
- from-file: common/common-modules.yml
- from-file: common/river-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-sway-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/sway-modules.yml
- from-file: common/final-modules.yml
3 changes: 2 additions & 1 deletion recipes/recipe-sway-nvidia-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ modules:
- from-file: common/sway-modules.yml
- type: script
scripts:
- setswaynvidiaenvironment.sh
- setswaynvidiaenvironment.sh
- from-file: common/final-modules.yml
3 changes: 2 additions & 1 deletion recipes/recipe-sway-nvidia-open-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ modules:
- from-file: common/sway-modules.yml
- type: script
scripts:
- setswaynvidiaenvironment.sh
- setswaynvidiaenvironment.sh
- from-file: common/final-modules.yml
3 changes: 2 additions & 1 deletion recipes/recipe-sway-nvidia-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ modules:
- from-file: common/sway-modules.yml
- type: script
scripts:
- setswaynvidiaenvironment.sh
- setswaynvidiaenvironment.sh
- from-file: common/final-modules.yml
3 changes: 2 additions & 1 deletion recipes/recipe-sway-nvidia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ modules:
- from-file: common/sway-modules.yml
- type: script
scripts:
- setswaynvidiaenvironment.sh
- setswaynvidiaenvironment.sh
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-sway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ modules:
- from-file: common/sddm-modules.yml
- from-file: common/common-modules.yml
- from-file: common/sway-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-wayfire-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/wayfire-modules.yml
- from-file: common/final-modules.yml

1 change: 1 addition & 0 deletions recipes/recipe-wayfire-nvidia-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/nvidia-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/wayfire-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-wayfire-nvidia-open-gdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/nvidia-open-modules.yml
- from-file: common/gdm-modules.yml
- from-file: common/wayfire-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-wayfire-nvidia-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/nvidia-open-modules.yml
- from-file: common/wayfire-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-wayfire-nvidia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ modules:
- from-file: common/common-modules.yml
- from-file: common/nvidia-modules.yml
- from-file: common/wayfire-modules.yml
- from-file: common/final-modules.yml
1 change: 1 addition & 0 deletions recipes/recipe-wayfire.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ modules:
- from-file: common/sddm-modules.yml
- from-file: common/common-modules.yml
- from-file: common/wayfire-modules.yml
- from-file: common/final-modules.yml

0 comments on commit 57bb4e4

Please sign in to comment.