added manual boot entry for refind

This commit is contained in:
WeeXnes 2024-12-19 02:34:01 +01:00
parent 931ae53283
commit c1de235c1f

View file

@ -29,6 +29,41 @@ install_theme(){
} }
# Function to auto-detect the partition where the OS is installed
detect_partition() {
# Replace this logic with a specific method to detect your desired partition
# Example: using `lsblk` and assuming the root filesystem is mounted
ROOT_PART=$(findmnt -n -o SOURCE /)
echo "$ROOT_PART"
}
# Function to create the rEFInd menuentry
create_menuentry() {
read -p "Enter the name of the OS (e.g., EndeavourOS): " OS_NAME
PARTITION=$(detect_partition)
# Ask the user if they want to include the i915.enable_dpcd_backlight=3 option
read -p "Do you want to include i915.enable_dpcd_backlight=3 (needed for screen brightness on some OLED screens) in boot options? (Y/n): " BACKLIGHT_RESPONSE
BACKLIGHT_RESPONSE=${BACKLIGHT_RESPONSE,,} # Convert to lowercase
BACKLIGHT_OPTION=""
if [[ "$BACKLIGHT_RESPONSE" == "y" || -z "$BACKLIGHT_RESPONSE" ]]; then
BACKLIGHT_OPTION="i915.enable_dpcd_backlight=3"
fi
MENUENTRY="menuentry \"$OS_NAME\" {\n"
MENUENTRY+="\ticon\t/EFI/refind/themes/catppuccin/assets/mocha/icons/os_arch.png\n"
MENUENTRY+="\tvolume\t$(basename $PARTITION)\n"
MENUENTRY+="\tloader\t/boot/vmlinuz-linux\n"
MENUENTRY+="\tinitrd\t/boot/initramfs-linux.img\n"
MENUENTRY+="\toptions\t\"root=$PARTITION rw quiet splash nowatchdog nvme_load=YES loglevel=3 intel_iommu=on iommu=pt $BACKLIGHT_OPTION ibt=off\"\n"
MENUENTRY+="}"
echo -e "$MENUENTRY"
}
install_snapd(){ install_snapd(){
@ -111,6 +146,13 @@ else
echo "refind not installed, installing now" echo "refind not installed, installing now"
install_secureboot install_secureboot
install_theme install_theme
read -p "Do you want to create a Boot entry for rEFInd? (Y/n): " RESPONSE
RESPONSE=${RESPONSE,,}
if [[ "$RESPONSE" == "y" || -z "$RESPONSE" ]]; then
create_menuentry
else
echo "Aborted."
fi
fi fi