mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 21:15:02 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb4040cd24 | ||
|
|
55d5a4c5c2 | ||
|
|
bfa42253e0 | ||
|
|
13f263ca0c | ||
|
|
18e36190f4 | ||
|
|
f4c02dac09 |
@@ -38,7 +38,7 @@
|
||||
# (Use only if you have custom initramfs name or auto-detect failed.) #
|
||||
# * GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img") #
|
||||
# (Use only if you have custom intel-ucode or auto-detect failed.) #
|
||||
# * GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("var/lib/docker" "nosapshot") #
|
||||
# * GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("var/lib/docker" "nosnapshot") #
|
||||
# (Ignore specific path during run "grub-mkconfig") #
|
||||
# * GRUB_BTRFS_CREATE_ONLY_HARMONIZED_ENTRIES="false" #
|
||||
# (Create entries with matching version number instead of all possible combinations of kernel and initramfs) #
|
||||
@@ -51,7 +51,7 @@
|
||||
# #
|
||||
# To do: #
|
||||
# #
|
||||
# * Display name of microcode in menuentry when available #
|
||||
# * Snapper support .... #
|
||||
# #
|
||||
#################################################################################################################################################
|
||||
|
||||
@@ -148,8 +148,14 @@ snapshots_entry()
|
||||
for k in "${name_kernel[@]}"; do
|
||||
for i in "${name_initramfs[@]}"; do
|
||||
for u in "${name_microcode[@]}"; do
|
||||
if [ -f "$(boot_dir)"/"${u}" ] ; then
|
||||
echo "\
|
||||
menuentry '"${k}" & "${i}" & "${u}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{"
|
||||
else
|
||||
echo "\
|
||||
menuentry '"${k}" & "${i}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{"
|
||||
fi
|
||||
echo "\
|
||||
menuentry '"${k}" & "${i}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{
|
||||
$(save_default_entry)
|
||||
if [ x\$feature_all_video_module = xy ]; then
|
||||
insmod all_video
|
||||
@@ -163,8 +169,7 @@ snapshots_entry()
|
||||
fi
|
||||
echo 'Loading Snapshot: "${snap_date_time}" "${snap_dir_name}"'
|
||||
echo 'Loading Kernel: "${k}" ...'
|
||||
linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters}\
|
||||
"
|
||||
linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters}"
|
||||
if [ -f "$(boot_dir)"/"${u}" ] ; then
|
||||
echo "\
|
||||
echo 'Loading Microcode & Initramfs: "${u}" "${i}" ...'
|
||||
@@ -189,24 +194,23 @@ harmonized_snapshots_entry()
|
||||
"
|
||||
for k in "${name_kernel[@]}"; do
|
||||
version=${k#vmlinuz-}
|
||||
|
||||
i=""
|
||||
if [[ -e "$(boot_dir)"/initramfs-${version} ]]; then
|
||||
i=initramfs-${version}
|
||||
if [ -f "$(boot_dir)"/initramfs-"${version}".img ]; then
|
||||
i=initramfs-${version}.img
|
||||
else
|
||||
if [[ -e "$(boot_dir)"/initrd.img-${version} ]]; then
|
||||
if [ -f "$(boot_dir)"/initrd.img-"${version}" ]; then
|
||||
i=initrd.img-${version}
|
||||
fi
|
||||
fi
|
||||
|
||||
u=""
|
||||
if [ -f "$(boot_dir)"/intel-ucode.img ]; then
|
||||
u=intel-ucode.img
|
||||
fi
|
||||
|
||||
|
||||
echo "\
|
||||
menuentry '"${k}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{
|
||||
for u in "${name_microcode[@]}"; do
|
||||
if [ -f "$(boot_dir)"/"${u}" ] ; then
|
||||
echo "\
|
||||
menuentry '"${k}" & "${i}" & "${u}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{"
|
||||
else
|
||||
echo "\
|
||||
menuentry '"${k}" & "${i}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{"
|
||||
fi
|
||||
echo "\
|
||||
$(save_default_entry)
|
||||
if [ x\$feature_all_video_module = xy ]; then
|
||||
insmod all_video
|
||||
@@ -220,10 +224,9 @@ harmonized_snapshots_entry()
|
||||
fi
|
||||
echo 'Loading Snapshot: "${snap_date_time}" "${snap_dir_name}"'
|
||||
echo 'Loading Kernel: "${k}" ...'
|
||||
linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters}\
|
||||
"
|
||||
if [[ ! -z ${i} ]]; then
|
||||
if [ ! -z ${u} ] ; then
|
||||
linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters}"
|
||||
if [ -f "$(boot_dir)"/"${i}" ] ; then
|
||||
if [ -f "$(boot_dir)"/"${u}" ] ; then
|
||||
echo "\
|
||||
echo 'Loading Microcode & Initramfs: "${u}" "${i}" ...'
|
||||
initrd \"${boot_dir_real_path}/"${u}"\" \"${boot_dir_real_path}/"${i}"\""
|
||||
@@ -233,7 +236,8 @@ harmonized_snapshots_entry()
|
||||
initrd \"${boot_dir_real_path}/"${i}"\""
|
||||
fi
|
||||
fi
|
||||
echo " }"
|
||||
echo " }"
|
||||
done
|
||||
done
|
||||
echo " }"
|
||||
}
|
||||
@@ -346,7 +350,7 @@ list_kernels_initramfs()
|
||||
[[ "${gbgmp}"/"${snap_dir_name}" == "${gbgmp}"/"${isp}"/* ]] && continue 2;
|
||||
done
|
||||
fi
|
||||
### detect if /boot directory exist
|
||||
### detect if /boot directory exists
|
||||
[[ ! -d "$gbgmp/$snap_dir_name/boot" ]] && continue;
|
||||
### show snapshot found during run "grub-mkconfig"
|
||||
snap_date_time=${item[@]:0:2}
|
||||
@@ -358,23 +362,22 @@ list_kernels_initramfs()
|
||||
detect_kernel
|
||||
name_kernel=("${list_kernel[@]##*"/"}")
|
||||
# echo "kernel = ${name_kernel[*]}"
|
||||
|
||||
if [[ "${harmonized_entries}" = "false" ]]; then
|
||||
if [[ "${harmonized_entries}" != "true" ]]; then
|
||||
### Initramfs (autodetect + custom initramfs)
|
||||
unset list_initramfs
|
||||
detect_initramfs
|
||||
name_initramfs=("${list_initramfs[@]##*"/"}")
|
||||
# echo "initramfs = ${name_initramfs[*]}"
|
||||
### microcode (auto-detect + custom microcode)
|
||||
unset list_ucode
|
||||
detect_microcode
|
||||
name_microcode=("${list_ucode[@]##*"/"}")
|
||||
# echo "ucode = ${name_microcode[*]}"
|
||||
fi
|
||||
### microcode (auto-detect + custom microcode)
|
||||
unset list_ucode
|
||||
detect_microcode
|
||||
name_microcode=("${list_ucode[@]##*"/"}")
|
||||
# echo "ucode = ${name_microcode[*]}"
|
||||
### real path to boot
|
||||
boot_dir_real_path="$(make_system_path_relative_to_its_root "$(boot_dir)")"
|
||||
### Create menu entries
|
||||
## name snpashot
|
||||
## name snapshot
|
||||
path_snapshot
|
||||
## title menu custom
|
||||
title_format
|
||||
@@ -396,7 +399,7 @@ list_kernels_initramfs()
|
||||
gettext_printf "###### - Grub-btrfs: Auto-detect Start - ######\n" >&2 ;
|
||||
### create mount point and mounts
|
||||
[[ ! -d $gbgmp ]] && mkdir -p $gbgmp
|
||||
mount -o subvolid=0 /dev/disk/by-uuid/$root_uuid $gbgmp/
|
||||
mount -o subvolid=5 /dev/disk/by-uuid/$root_uuid $gbgmp/
|
||||
### Create a menu in grub
|
||||
echo "submenu '${submenuname}' {"
|
||||
list_kernels_initramfs ;
|
||||
@@ -413,4 +416,4 @@ list_kernels_initramfs()
|
||||
## unmount mount point
|
||||
umount $gbgmp
|
||||
gettext_printf "###### - Grub-btrfs: Auto-detect End - ######\n" >&2 ;
|
||||
### End ###
|
||||
### End ###
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
### grub-btrfs
|
||||
|
||||
|
||||
This is a version 1.xx of grub-btrfs
|
||||
|
||||
#### Description
|
||||
@@ -76,6 +75,9 @@ Add this lines to /etc/default/grub:
|
||||
|
||||
(Ignore specific path during run "grub-mkconfig")
|
||||
|
||||
* GRUB_BTRFS_CREATE_ONLY_HARMONIZED_ENTRIES="false"
|
||||
|
||||
(Create entries with matching version number instead of all possible combinations of kernel and initramfs)
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +90,7 @@ You will see it appear differents entries (e.g : Snapshot: [2014-02-12 11:24:37]
|
||||
|
||||
#### TO DO
|
||||
|
||||
* Display name of microcode in menuentry when available
|
||||
* Snapper support
|
||||
|
||||
|
||||
## discussion
|
||||
|
||||
Reference in New Issue
Block a user