Merge branch 'initramfs-fixup' into testing

This commit is contained in:
Kyle Gospodnetich 2024-04-09 21:57:42 -07:00
commit 65b141c632
3 changed files with 13 additions and 35 deletions

View File

@ -1,22 +0,0 @@
# Anything commented out with # on a new line will be ignored
# These files follow the "rpm-ostree initramfs" syntax, please consult
# "rpm-ostree initramfs --help" for more information
#
# You can do 1 initramfs argument per line or do them all in 1 line.
# If you need to just add drivers to dracut, you should instead just add
# config files for dracut into /etc/dracut.conf.d/ and trigger an initramfs
# rebuild using "sudo touch /etc/bazzite/initramfs/rebuild" which
# will rebuild the initramfs on next boot using bazzite-hardware-setup.
# Documentation: https://universal-blue.discourse.group/docs?topic=399
#
# NOTE: If you need to add files to initramfs (like modprobe files),
# please add them to a .conf file in /etc/dracut.conf.d/
# with the line (spaces before and after paths are important!)
# install_items+=" /path/to/file1 /path/to/file2 "
#
# Multiline Example:
#--arg="--add-drivers"
#--arg="vfio vfio_iommu_type1 vfio-pci"
#
# Single Line Example:
#--arg="--add-drivers" --arg="vfio vfio_iommu_type1 vfio-pci

View File

@ -0,0 +1,8 @@
Creating the file `rebuild` in this folder will cause
bazzite-hardware-setup to rebuild initramfs on the next boot.
This will include any dracut.conf files from: `/etc/dracut.conf.d/`
If you used any custom arguments through the `args.d` folder,
they have been deprecated in favor of `dracut` config files.
This was because `rpm-ostree` was very picky with it's initramfs args.

View File

@ -26,14 +26,6 @@ INITRAMFS_DIR="/etc/bazzite/initramfs"
INITRAMFS_REBUILD_TRIGGER="$INITRAMFS_DIR/rebuild"
INITRAMFS_BAZZITE_ARG_FILE="$INITRAMFS_DIR/hardware-setup.args"
INITRAMFS_BAZZITE_ARGS=$(cat $INITRAMFS_BAZZITE_ARG_FILE)
INITRAMFS_CUSTOM_ARGS_DIR="$INITRAMFS_DIR/args.d"
INITRAMFS_CUSTOM_ARGS=""
# If the /etc/bazzite/initramfs/args.d dir exists
if [[ -d "$INITRAMFS_CUSTOM_ARGS_DIR" ]]; then
# Grab all the content of the files (minus comments) and join them together with spaces
INITRAMFS_CUSTOM_ARGS=$(grep -RvP "^(#|$)" $INITRAMFS_CUSTOM_ARGS_DIR/ | sort | perl -pe 's/(^$INITRAMFS_CUSTOM_ARGS_DIR\/.+:|\\\n$)//g' | tr '\n' ' ')
fi
# If no rebuild is requested
if [[ ! -f $INITRAMFS_REBUILD_TRIGGER ]]; then
@ -51,9 +43,9 @@ else
# REMOVE REBUILD TRIGGER TO AVOID INFINITE BOOT LOOP!
rm $INITRAMFS_REBUILD_TRIGGER
# Rebuild current initramfs (this will add any new configs added to /etc/dracut.conf.d/) then reboot
echo "Initramfs rebuild triggered, using: $INITRAMFS_BAZZITE_ARGS $INITRAMFS_CUSTOM_ARGS"
echo "Initramfs rebuild triggered, adding dracut configs and these args: $INITRAMFS_BAZZITE_ARGS"
plymouth display-message --text="Updating initramfs - Please wait, this may take a while" || true
rpm-ostree initramfs --enable "${INITRAMFS_BAZZITE_ARGS} ${INITRAMFS_CUSTOM_ARGS}" --reboot
rpm-ostree initramfs --enable ${INITRAMFS_BAZZITE_ARGS} --reboot
exit 0
fi
@ -98,9 +90,9 @@ if $NEEDS_INITRAMFS_APPLICATION; then
echo "Found needed initramfs changes, applying the following: ${NEEDED_INITRAMFS[*]}"
echo "--arg=\"-I ${NEEDED_INITRAMFS[*]}\"" > $INITRAMFS_BAZZITE_ARG_FILE
INITRAMFS_BAZZITE_ARGS=$(cat $INITRAMFS_BAZZITE_ARG_FILE)
echo "Building initramfs with following custom args: $INITRAMFS_CUSTOM_ARGS"
echo "Building initramfs with dracut configs and the following args: ${INITRAMFS_BAZZITE_ARGS}"
plymouth display-message --text="Updating initramfs - Please wait, this may take a while" || true
rpm-ostree initramfs --enable "${INITRAMFS_BAZZITE_ARGS} ${INITRAMFS_CUSTOM_ARGS}"
rpm-ostree initramfs --enable ${INITRAMFS_BAZZITE_ARGS}
else
echo "No initramfs changes needed"
fi
@ -277,4 +269,4 @@ echo $IMAGE_BRANCH > $KNOWN_IMAGE_BRANCH_FILE
if [[ $IMAGE_FLAVOR =~ "nvidia" ]]; then
echo "Nvidia image detected, rebooting to avoid screen freeze issue in 550."
systemctl reboot
fi
fi