diff --git a/refind-menu-generator b/refind-menu-generator index 3d72dd9..2bb2973 100755 --- a/refind-menu-generator +++ b/refind-menu-generator @@ -8,21 +8,6 @@ function check_root { check_root -echo "Searching rEFInd installation in EFI partition..." -if ! __has_esp__; then - echo "EFI partition not found" >&2 - exit 1 -fi - -# Copied from https://raw.githubusercontent.com/jaltuna/refind-theme-nord/main/setup.sh -# Verify EFI System Partition -__has_esp__() { - __find_esp__ - - mount "${ESP}" &>/dev/null - [[ -d "${ESP}/EFI" ]] && return 0 || return 1 -} - __find_esp__() { local parttype local fstype @@ -54,6 +39,21 @@ __find_esp__() { readonly ESP } +# Copied from https://raw.githubusercontent.com/jaltuna/refind-theme-nord/main/setup.sh +# Verify EFI System Partition +__has_esp__() { + __find_esp__ + + mount "${ESP}" &>/dev/null + [[ -d "${ESP}/EFI" ]] && return 0 || return 1 +} + +echo "Searching rEFInd installation in EFI partition..." +if ! __has_esp__; then + echo "EFI partition not found" >&2 + exit 1 +fi + REFIND_DIR=$(find "${ESP}" -type d -iname refind) if ! [[ -d "${REFIND_DIR}" ]]; then @@ -111,7 +111,8 @@ if [ -d $KERNEL_DIR ]; then initramfs=$(echo "$initramfs_tpl.img") initramfs_fallback=$(echo "$initramfs_tpl-fallback.img") - sed -e "s/{OSNAME}/$osname/g" -e "s/{THEME}/$theme/g" -e "s/{ICON}/$icon/g" -e "s/{KERNEL}/$kernel/g" -e "s/{KERNEL_EFI}/$kernel_efi/g" -e "s/{KERNEL_VMLINUZ}/$kernel_vmlinuz/g" -e "s/{INITRAMFS}/$initramfs/g" -e "s/{INITRAMFS_FALLBACK}/$initramfs_fallback/g" -e "s/{CMDLINE}/$CMDLINE/g" $template >> $manual_conf + echo "OSNAME: $osname; THEME: $theme; ICON: $icon; KERNEL: $kernel; KERNEL_EFI: $kernel_efi; KERNEL_VMLINUZ: $kernel_vmlinuz; INITRAMFS: $initramfs; INITRAMFS_FALLBACK: $initramfs_fallback; CMDLINE: $CMDLINE" + sed -e "s|{OSNAME}|$osname|g" -e "s|{THEME}|$theme|g" -e "s|{ICON}|$icon|g" -e "s|{KERNEL}|$kernel|g" -e "s|{KERNEL_EFI}|$kernel_efi|g" -e "s|{KERNEL_VMLINUZ}|$kernel_vmlinuz|g" -e "s|{INITRAMFS}|$initramfs|g" -e "s|{INITRAMFS_FALLBACK}|$initramfs_fallback|g" -e "s|{CMDLINE}|$CMDLINE|g" $template >> $manual_conf done manual_end_conf=$(mktemp)