mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 21:15:02 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
615cbe9f3a | ||
|
|
2e58a2b74d | ||
|
|
4f725a8431 | ||
|
|
d598529001 | ||
|
|
b925f639cd | ||
|
|
31a0baa2b1 | ||
|
|
3a7c6abece | ||
|
|
5e0951d8cb | ||
|
|
c9f5938e04 | ||
|
|
128cbe28f3 | ||
|
|
aae6892218 | ||
|
|
84ecc2a5a7 | ||
|
|
7c1178b17c | ||
|
|
7d07503f07 | ||
|
|
f646dfd900 | ||
|
|
b4d4bc0aac | ||
|
|
6f7fb178fb | ||
|
|
d561206775 | ||
|
|
563151507d |
@@ -90,7 +90,6 @@ boot_dir()
|
||||
boot_dir="$gbgmp/$snap_dir_name/boot"
|
||||
[[ "$root_uuid" != "$boot_uuid" ]] && boot_dir="/boot"
|
||||
echo "$boot_dir"
|
||||
if [ -d ${boot_dir} ]; then boot_dir_real_path="$(make_system_path_relative_to_its_root "$boot_dir")"; fi
|
||||
}
|
||||
|
||||
|
||||
@@ -107,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)
|
||||
@@ -120,18 +120,19 @@ snapshots_entry()
|
||||
else
|
||||
search --no-floppy --fs-uuid --set=root ${boot_uuid}
|
||||
fi
|
||||
echo 'Loading Snapshot: "${snap_dir_name}" "${snap_date_time}"'
|
||||
echo 'Loading Snapshot: "${2}" "${3}"'
|
||||
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_real_path}/"${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 " }"
|
||||
@@ -145,7 +146,7 @@ snapshot_list()
|
||||
snap=($snap)
|
||||
local snap_path_name=${snap[@]:13:${#snap[@]}}
|
||||
# Discard deleted snapshots
|
||||
if [ $snap_path_name = "DELETED" ]; then continue; fi
|
||||
if [ "$snap_path_name" = "DELETED" ]; then continue; fi
|
||||
[[ ${snap_path_name%%"/"*} == "<FS_TREE>" ]] && snap_path_name=${snap_path_name#*"/"}
|
||||
echo ${snap[@]:10:2} ${snap_path_name}
|
||||
done
|
||||
@@ -154,14 +155,14 @@ snapshot_list()
|
||||
detect_kernel()
|
||||
{
|
||||
## Arch original kernel (auto-detect)
|
||||
for akernel in $(boot_dir)/vmlinuz-* ; do
|
||||
for akernel in "$(boot_dir)"/vmlinuz-* ; do
|
||||
list_kernel+=("$akernel")
|
||||
done
|
||||
|
||||
## Custom name kernel in GRUB_BTRFS_NKERNEL
|
||||
if [ ! -z ${nkernel} ] ; then
|
||||
if [ ! -z "${nkernel}" ] ; then
|
||||
for ckernel in "${nkernel[@]}" ; do
|
||||
[[ ! -f /$(boot_dir)/${ckernel} ]] && continue;
|
||||
[[ ! -f /"$(boot_dir)"/"${ckernel}" ]] && continue;
|
||||
list_kernel+=("$ckernel")
|
||||
done
|
||||
fi
|
||||
@@ -170,20 +171,35 @@ detect_kernel()
|
||||
detect_initramfs()
|
||||
{
|
||||
## Arch original initramfs (auto-detect)
|
||||
for ainitramfs in $(boot_dir)/initramfs-* ; do
|
||||
for ainitramfs in "$(boot_dir)"/initramfs-* ; do
|
||||
list_initramfs+=("$ainitramfs")
|
||||
done
|
||||
|
||||
## Custom name initramfs in GRUB_BTRFS_NINIT
|
||||
if [ ! -z ${ninit} ] ; then
|
||||
if [ ! -z "$ninit" ] ; then
|
||||
for cinitramfs in "${ninit[@]}" ; do
|
||||
[[ ! -f /$(boot_dir)/${ninit} ]] && continue;
|
||||
list_initramfs+=("$ninit")
|
||||
[[ ! -f /"$(boot_dir)"/"${cinitramfs}" ]] && continue;
|
||||
list_initramfs+=("$cinitramfs")
|
||||
done
|
||||
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'
|
||||
@@ -202,6 +218,11 @@ 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}"
|
||||
done
|
||||
@@ -220,4 +241,4 @@ if [ ${choise_of_method} = "1" ] ; then
|
||||
umount $gbgmp
|
||||
gettext_printf "###### - Grub-btrfs: Auto-detect - ######\n" >&2 ;
|
||||
fi
|
||||
### End choice of method ###
|
||||
### End choice of method ###
|
||||
|
||||
Reference in New Issue
Block a user