diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 20b398a..4caf9df 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -106,6 +106,7 @@ snapshots_entry() echo " submenu '${1} ${2} ${3}' {" for k in "${name_kernel[@]}"; do for i in "${name_initramfs[@]}"; do + for u in "${name_microcode[@]}"; do echo "\ menuentry '${2} with "${k}" & "${i}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{ $(save_default_entry) @@ -123,14 +124,15 @@ snapshots_entry() echo 'Loading Kernel: "${k}" ...' linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters} echo 'Loading Initramfs: "${i}" ...'" - if [ -f "$(boot_dir)/${microcode}" ] ; then + if [ -f "$(boot_dir)"/"${u}" ] ; then echo "\ - initrd \"${boot_dir_real_path}/"${microcode}"\" initrd \"/"${snap_dir_name}"/boot/"${i}"\"" + initrd \"${boot_dir_real_path}/"${u}"\" initrd \"/"${snap_dir_name}"/boot/"${i}"\"" else echo "\ initrd \"${boot_dir_real_path}/"${i}"\"" fi echo " }" + done done done echo " }" @@ -182,7 +184,22 @@ detect_initramfs() fi } -## List of kernels and initramfs in snapshots +detect_microcode() +{ + ## Arch original intel microcode + for aucode in "$(boot_dir)"/intel-ucode.img ; do + list_ucode+=("$aucode") + done + + ## Custom name microcode in GRUB_BTRFS_INTEL_UCODE + if [ ! -z "$microcode" ] ; then + for cucode in "${microcode[@]}" ; do + [[ ! -f /"$(boot_dir)"/"${cucode}" ]] && continue + list_ucode+=("$cucode") + done + fi +} +## List of kernels, initramfs and microcode in snapshots list_kernels_initramfs() { IFS=$'\n' @@ -201,6 +218,10 @@ list_kernels_initramfs() detect_initramfs name_initramfs=("${list_initramfs[@]##*"/"}") # echo "initramfs = ${name_initramfs[*]}" + unset list_ucode + detect_microcode + name_microcode=("${list_ucode[@]##*"/"}") + # echo "ucode = ${name_microcode[*]}" boot_dir_real_path="$(make_system_path_relative_to_its_root "$(boot_dir)")" # Create menu entries snapshots_entry "${prefixentry}" "${snap_dir_name}" "${snap_date_time}"