mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 21:15:02 +08:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fcfbe9676 | ||
|
|
9e171282da | ||
|
|
b509fcaf61 | ||
|
|
f682e17b30 | ||
|
|
72a3dc092b | ||
|
|
6cb200a50b | ||
|
|
ece8d87151 | ||
|
|
346a9868b8 | ||
|
|
b8465d14db | ||
|
|
0bc09317d8 | ||
|
|
94d742d1d4 | ||
|
|
363d7da3a7 | ||
|
|
585268dad7 | ||
|
|
34b54de71c | ||
|
|
a8713bbd0b | ||
|
|
ac45f09af3 | ||
|
|
d41991979e | ||
|
|
99fc835e9c | ||
|
|
5e608f8d96 | ||
|
|
465b56107f | ||
|
|
7aa227b378 | ||
|
|
4ff82352bb | ||
|
|
98a5bbe8c5 | ||
|
|
abd2889464 | ||
|
|
25a9876ad4 | ||
|
|
d82ee289c3 | ||
|
|
ef150c17bb | ||
|
|
490720a13c |
6
.codespellrc
Normal file
6
.codespellrc
Normal file
@@ -0,0 +1,6 @@
|
||||
[codespell]
|
||||
skip = .git,*.pdf,*.svg,go.sum,.codespellrc
|
||||
check-hidden = true
|
||||
# ignore-regex =
|
||||
# ist -- unfortunate variable
|
||||
ignore-words-list = ist
|
||||
22
.github/workflows/codespell.yml
vendored
Normal file
22
.github/workflows/codespell.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Codespell
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
codespell:
|
||||
name: Check for spelling errors
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Codespell
|
||||
uses: codespell-project/actions-codespell@v2
|
||||
@@ -41,8 +41,8 @@ set -e
|
||||
sysconfdir="/etc"
|
||||
grub_btrfs_config="${sysconfdir}/default/grub-btrfs/config"
|
||||
|
||||
[[ -f "$grub_btrfs_config" ]] && . "$grub_btrfs_config"
|
||||
[[ -f "${sysconfdir}/default/grub" ]] && . "${sysconfdir}/default/grub"
|
||||
[ -f "$grub_btrfs_config" ] && . "$grub_btrfs_config"
|
||||
[ -f "${sysconfdir}/default/grub" ] && . "${sysconfdir}/default/grub"
|
||||
|
||||
## Error Handling
|
||||
print_error()
|
||||
@@ -75,15 +75,15 @@ while getopts :V-: opt; do
|
||||
done
|
||||
|
||||
## Exit the script, if:
|
||||
[[ "${GRUB_BTRFS_DISABLE,,}" == "true" ]] && print_error "GRUB_BTRFS_DISABLE is set to true (default=false)"
|
||||
[ "$(echo "$GRUB_BTRFS_DISABLE" | tr '[:upper:]' '[:lower:]')" = 'true' ] && print_error "GRUB_BTRFS_DISABLE is set to true (default=false)"
|
||||
if ! type btrfs >/dev/null 2>&1; then print_error "btrfs-progs isn't installed"; fi
|
||||
[[ -f "${GRUB_BTRFS_MKCONFIG_LIB:-/usr/share/grub/grub-mkconfig_lib}" ]] && . "${GRUB_BTRFS_MKCONFIG_LIB:-/usr/share/grub/grub-mkconfig_lib}" || print_error "grub-mkconfig_lib couldn't be found"
|
||||
[ -f "${GRUB_BTRFS_MKCONFIG_LIB:-/usr/share/grub/grub-mkconfig_lib}" ] && . "${GRUB_BTRFS_MKCONFIG_LIB:-/usr/share/grub/grub-mkconfig_lib}" || print_error "grub-mkconfig_lib couldn't be found"
|
||||
[[ "$(btrfs filesystem df / 2>&1)" == *"not a btrfs filesystem"* ]] && print_error "Root filesystem isn't btrfs"
|
||||
|
||||
printf "Detecting snapshots ...\n" >&2 ;
|
||||
|
||||
## Submenu name
|
||||
distro=$(awk -F "=" '/^NAME=/ {gsub(/"/, "", $2); print $2}' /etc/os-release)
|
||||
distro=$(awk -F "=" '/^NAME=/ {gsub(/"/, "", $2); print $2}' /etc/os-release) # escape '
|
||||
submenuname=${GRUB_BTRFS_SUBMENUNAME:-"${distro:-Linux} snapshots"}
|
||||
## Limit snapshots to show in the Grub menu (default=50)
|
||||
limit_snap_show="${GRUB_BTRFS_LIMIT:-50}"
|
||||
@@ -99,7 +99,7 @@ grub_btrfs_directory=${GRUB_BTRFS_GBTRFS_DIRNAME:-${grub_directory}}
|
||||
grub_btrfs_search_directory=${GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME:-"\${prefix}"}
|
||||
## Password protection management for submenu
|
||||
# Protection support for submenu (--unrestricted)
|
||||
case "${GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU,,}" in
|
||||
case "$(echo "$GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU" | tr '[:upper:]' '[:lower:]')" in
|
||||
true) unrestricted_access_submenu="--unrestricted ";;
|
||||
*) unrestricted_access_submenu=""
|
||||
esac
|
||||
@@ -108,20 +108,39 @@ if [ -n "${GRUB_BTRFS_PROTECTION_AUTHORIZED_USERS}" ] ; then
|
||||
protection_authorized_users="--users ${GRUB_BTRFS_PROTECTION_AUTHORIZED_USERS} "
|
||||
fi
|
||||
|
||||
## Probe informations of Root and Boot devices
|
||||
## Probe information of Root and Boot devices
|
||||
# Probe info "Root partition"
|
||||
root_device=$(${grub_probe} --target=device /) # Root device
|
||||
root_uuid=$(${grub_probe} --device ${root_device} --target="fs_uuid" 2>/dev/null) # UUID of the root device
|
||||
root_uuid_subvolume=$(btrfs subvolume show / 2>/dev/null) || print_error "UUID of the root subvolume is not available"; # If UUID of root subvolume is not available, then exit
|
||||
root_uuid_subvolume=$(awk -F":" 'match($1, /(^[ \t]+UUID)/) {sub(/^[ \t]+/, "", $2); print $2}' <<< "$root_uuid_subvolume") # UUID of the root subvolume
|
||||
root_uuid_subvolume=$(awk -F":" 'match($1, /(^[ \t]+UUID)/) {sub(/^[ \t]+/, "", $2); print $2}' <<< "$root_uuid_subvolume") # UUID of the root subvolume '
|
||||
# Probe info "Boot partition"
|
||||
boot_device=$(${grub_probe} --target=device ${boot_directory}) # Boot device
|
||||
boot_uuid=$(${grub_probe} --device ${boot_device} --target="fs_uuid" 2>/dev/null) # UUID of the boot device
|
||||
boot_uuid_subvolume=$(btrfs subvolume show "$boot_directory" 2>/dev/null) || boot_uuid_subvolume=" UUID: $root_uuid_subvolume"; # If boot folder isn't a subvolume, then UUID=root_uuid_subvolume
|
||||
boot_uuid_subvolume=$(awk -F":" 'match($1, /(^[ \t]+UUID)/) {sub(/^[ \t]+/, "", $2); print $2}' <<< "$boot_uuid_subvolume") # UUID of the boot subvolume
|
||||
boot_uuid_subvolume=$(awk -F":" 'match($1, /(^[ \t]+UUID)/) {sub(/^[ \t]+/, "", $2); print $2}' <<< "$boot_uuid_subvolume") # UUID of the boot subvolume '
|
||||
boot_hs=$(${grub_probe} --device ${boot_device} --target="hints_string" 2>/dev/null) # hints string
|
||||
boot_fs=$(${grub_probe} --device ${boot_device} --target="fs" 2>/dev/null) # Type filesystem of boot device
|
||||
|
||||
# Enable LUKS encrypted devices support
|
||||
case "$(echo "$GRUB_BTRFS_ENABLE_CRYPTODISK" | tr '[:upper:]' '[:lower:]')" in
|
||||
true)
|
||||
list_insmods=()
|
||||
list_insmods+=("insmod gzio")
|
||||
list_insmods+=("insmod part_gpt")
|
||||
list_insmods+=("insmod cryptodisk")
|
||||
list_insmods+=("insmod luks")
|
||||
list_insmods+=("insmod gcry_rijndael")
|
||||
list_insmods+=("insmod gcry_rijndael")
|
||||
list_insmods+=("insmod gcry_sha256")
|
||||
list_insmods+=("insmod ${boot_fs}")
|
||||
list_insmods+=("cryptomount -u $(echo $GRUB_CMDLINE_LINUX_DEFAULT | grep -o -P '(?<=cryptdevice=UUID=).*(?=:cryptdev)')")
|
||||
;;
|
||||
*)
|
||||
list_insmods=("insmod ${boot_fs}")
|
||||
;;
|
||||
esac
|
||||
|
||||
## Parameters passed to the kernel
|
||||
kernel_parameters="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT $GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS"
|
||||
## Mount point location
|
||||
@@ -150,7 +169,7 @@ detect_rootflags()
|
||||
|
||||
unmount_grub_btrfs_mount_point()
|
||||
{
|
||||
if [[ -d "$grub_btrfs_mount_point" ]]; then
|
||||
if [ -d "$grub_btrfs_mount_point" ]; then
|
||||
local wait=true
|
||||
local wait_max=0
|
||||
printf "Unmount %s .." "$grub_btrfs_mount_point" >&2;
|
||||
@@ -160,7 +179,7 @@ if [[ -d "$grub_btrfs_mount_point" ]]; then
|
||||
if umount "$grub_btrfs_mount_point" >/dev/null 2>&1; then
|
||||
wait=false # umount successful
|
||||
printf " Success\n" >&2;
|
||||
elif [[ $wait_max = 10 ]]; then
|
||||
elif [ $wait_max -eq 10 ]; then
|
||||
printf "\nWarning: Unable to unmount %s in %s\n" "$root_device" "$grub_btrfs_mount_point" >&2;
|
||||
break;
|
||||
else
|
||||
@@ -172,9 +191,9 @@ if [[ -d "$grub_btrfs_mount_point" ]]; then
|
||||
printf " Success\n" >&2;
|
||||
fi
|
||||
done
|
||||
if [[ "$wait" != true ]]; then
|
||||
if [ "$wait" != true ]; then
|
||||
if ! rm -d "$grub_btrfs_mount_point" >/dev/null 2>&1; then
|
||||
printf "Unable to delete %s: Device or ressource is busy\n" "$grub_btrfs_mount_point" >&2;
|
||||
printf "Unable to delete %s: Device or resource is busy\n" "$grub_btrfs_mount_point" >&2;
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -193,10 +212,10 @@ make_menu_entries()
|
||||
entry "submenu '${title_menu}' {
|
||||
submenu '${title_submenu}' { echo }"
|
||||
for k in "${name_kernel[@]}"; do
|
||||
[[ ! -f "${boot_dir}"/"${k}" ]] && continue;
|
||||
[ ! -f "${boot_dir}"/"${k}" ] && continue;
|
||||
kversion=${k#*"-"}
|
||||
for i in "${name_initramfs[@]}"; do
|
||||
if [[ "${name_initramfs}" != "x" ]] ; then
|
||||
if [ "${name_initramfs}" != "x" ] ; then
|
||||
# prefix_i=${i%%"-"*}
|
||||
suffix_i=${i#*"-"}
|
||||
# alt_suffix_i=${i##*"-"}
|
||||
@@ -207,7 +226,7 @@ make_menu_entries()
|
||||
else continue;
|
||||
fi
|
||||
for u in "${name_microcode[@]}"; do
|
||||
if [[ "${name_microcode}" != "x" ]] ; then
|
||||
if [ "${name_microcode}" != "x" ] ; then
|
||||
entry "
|
||||
menuentry ' "${k}" & "${i}" & "${u}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid' {"
|
||||
else
|
||||
@@ -218,17 +237,26 @@ make_menu_entries()
|
||||
if [ x\$feature_all_video_module = xy ]; then
|
||||
insmod all_video
|
||||
fi
|
||||
set gfxpayload=keep
|
||||
insmod ${boot_fs}
|
||||
set gfxpayload=keep"
|
||||
for j in "${insmods[@]}"; do
|
||||
entry "\
|
||||
${j}"
|
||||
done
|
||||
entry "\
|
||||
if [ x\$feature_platform_search_hint = xy ]; then
|
||||
search --no-floppy --fs-uuid --set=root ${boot_hs} ${boot_uuid}
|
||||
else
|
||||
search --no-floppy --fs-uuid --set=root ${boot_uuid}
|
||||
fi"
|
||||
if [ "${SUSE_BTRFS_SNAPSHOT_BOOTING:-"false"}" = "true" ]; then
|
||||
entry "\
|
||||
set btrfs_subvolid=5"
|
||||
fi
|
||||
entry "\
|
||||
echo 'Loading Snapshot: "${snap_date_trim}" "${snap_dir_name_trim}"'
|
||||
echo 'Loading Kernel: "${k}" ...'
|
||||
linux \"${boot_dir_root_grub}/"${k}"\" root="${LINUX_ROOT_DEVICE}" ${kernel_parameters} ${rootflags}subvol=\""${snap_dir_name_trim}"\""
|
||||
if [[ "${name_microcode}" != "x" ]] ; then
|
||||
if [ "${name_microcode}" != "x" ] ; then
|
||||
entry "\
|
||||
echo 'Loading Microcode & Initramfs: "${u}" "${i}" ...'
|
||||
initrd \"${boot_dir_root_grub}/"${u}"\" \"${boot_dir_root_grub}/"${i}"\""
|
||||
@@ -242,7 +270,7 @@ make_menu_entries()
|
||||
done
|
||||
else
|
||||
for u in "${name_microcode[@]}"; do
|
||||
if [[ "${name_microcode}" != "x" ]] ; then
|
||||
if [ "${name_microcode}" != "x" ] ; then
|
||||
entry "
|
||||
menuentry ' "${k}" & "${u}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid' {"
|
||||
else
|
||||
@@ -259,11 +287,16 @@ make_menu_entries()
|
||||
search --no-floppy --fs-uuid --set=root ${boot_hs} ${boot_uuid}
|
||||
else
|
||||
search --no-floppy --fs-uuid --set=root ${boot_uuid}
|
||||
fi"
|
||||
if [ "${SUSE_BTRFS_SNAPSHOT_BOOTING:-"false"}" = "true" ]; then
|
||||
entry "\
|
||||
set btrfs_subvolid=5"
|
||||
fi
|
||||
entry "\
|
||||
echo 'Loading Snapshot: "${snap_date_trim}" "${snap_dir_name_trim}"'
|
||||
echo 'Loading Kernel: "${k}" ...'
|
||||
linux \"${boot_dir_root_grub}/"${k}"\" root="${LINUX_ROOT_DEVICE}" ${kernel_parameters} ${rootflags}subvol=\""${snap_dir_name_trim}"\""
|
||||
if [[ "${name_microcode}" != "x" ]] ; then
|
||||
if [ "${name_microcode}" != "x" ] ; then
|
||||
entry "\
|
||||
echo 'Loading Microcode: "${u}" ...'
|
||||
initrd \"${boot_dir_root_grub}/"${u}"\""
|
||||
@@ -305,7 +338,7 @@ snapshot_list()
|
||||
# ignore specific path during run "grub-mkconfig"
|
||||
if [ -n "${GRUB_BTRFS_IGNORE_SPECIFIC_PATH}" ] ; then
|
||||
for isp in "${GRUB_BTRFS_IGNORE_SPECIFIC_PATH[@]}" ; do
|
||||
[[ "${path_snapshot}" == "${isp}" ]] && continue 2;
|
||||
[ "${path_snapshot}" = "${isp}" ] && continue 2;
|
||||
done
|
||||
fi
|
||||
if [ -n "${GRUB_BTRFS_IGNORE_PREFIX_PATH}" ] ; then
|
||||
@@ -313,30 +346,38 @@ snapshot_list()
|
||||
[[ "${path_snapshot}" == "${isp}"/* ]] && continue 2;
|
||||
done
|
||||
fi
|
||||
[[ ! -d "$grub_btrfs_mount_point/$path_snapshot/boot" ]] && continue; # Discard snapshots without /boot folder
|
||||
[ ! -d "$grub_btrfs_mount_point/$path_snapshot/boot" ] && continue; # Discard snapshots without /boot folder
|
||||
|
||||
# Parse Snapper & timeshift informations
|
||||
# Parse Snapper & timeshift & yabsnap information
|
||||
local type_snapshot="N/A"
|
||||
local description_snapshot="N/A"
|
||||
|
||||
# path to yabsnap snapshot meta data
|
||||
local yabsnap_info="$grub_btrfs_mount_point/${path_snapshot%"/"*}/$(echo "${snap[13]}" | awk -F'/' '{print $3 "-meta.json"}')"
|
||||
|
||||
if [[ -s "$grub_btrfs_mount_point/${path_snapshot%"/"*}/$snapper_info" ]] ; then
|
||||
type_snapshot=$(awk -F"<|>" 'match($2, /^type/) {print $3}' "$grub_btrfs_mount_point/${path_snapshot%"/"*}/$snapper_info") # search matching string beginning "type"
|
||||
description_snapshot=$(awk -F"<|>" 'match($2, /^description/) {print $3}' "$grub_btrfs_mount_point/${path_snapshot%"/"*}/$snapper_info") # search matching string beginning "description"
|
||||
elif [[ -s "$grub_btrfs_mount_point/${path_snapshot%"/"*}/$timeshift_info" ]] ; then
|
||||
type_snapshot=$(awk -F" : " 'match($1, /^[ \t]+"tags"/) {gsub(/"|,/,"");print $2}' "$grub_btrfs_mount_point/${path_snapshot%"/"*}/$timeshift_info") # search matching string beginning "tags"
|
||||
description_snapshot=$(awk -F" : " 'match($1, /^[ \t]+"comments"/) {gsub(/"|,/,"");print $2}' "$grub_btrfs_mount_point/${path_snapshot%"/"*}/$timeshift_info") # search matching string beginning "comments"
|
||||
description_snapshot=$(awk -F" : " 'match($1, /^[ \t]+"comments"/) {gsub(/"|,/,"");print $2}' "$grub_btrfs_mount_point/${path_snapshot%"/"*}/$timeshift_info") # search matching string beginning "comments" fix '
|
||||
elif [[ -s $yabsnap_info ]] ; then
|
||||
type_snapshot=$(grep -P '^\s*"trigger"' $yabsnap_info | awk -F'"' '{print $4}') # search matching string beginning "trigger"
|
||||
description_snapshot=$(grep -P '^\s*"comment"' $yabsnap_info | awk -F'"' '{print $4}') # search matching string beginning "comment"
|
||||
fi
|
||||
[[ -z "$type_snapshot" ]] && type_snapshot=("N/A")
|
||||
[[ -z "$description_snapshot" ]] && description_snapshot=("N/A")
|
||||
|
||||
[ -z "$type_snapshot" ] && type_snapshot=("N/A")
|
||||
[ -z "$description_snapshot" ] && description_snapshot=("N/A")
|
||||
|
||||
# ignore specific {type,tag,description} of snapshot during run "grub-mkconfig"
|
||||
if [ -n "${GRUB_BTRFS_IGNORE_SNAPSHOT_TYPE}" ] ; then
|
||||
for ist in "${GRUB_BTRFS_IGNORE_SNAPSHOT_TYPE[@]}" ; do
|
||||
[[ "${type_snapshot}" == "${ist}" ]] && continue 2;
|
||||
[ "${type_snapshot}" = "${ist}" ] && continue 2;
|
||||
done
|
||||
fi
|
||||
if [ -n "${GRUB_BTRFS_IGNORE_SNAPSHOT_DESCRIPTION}" ] ; then
|
||||
for isd in "${GRUB_BTRFS_IGNORE_SNAPSHOT_DESCRIPTION[@]}" ; do
|
||||
[[ "${description_snapshot}" == "${isd}" ]] && continue 2;
|
||||
[ "${description_snapshot}" = "${isd}" ] && continue 2;
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -351,21 +392,21 @@ snapshot_list()
|
||||
local max_date_length=0
|
||||
for i in "${date_snapshots[@]}"; do
|
||||
local length="${#i}"
|
||||
[[ "$length" -gt "$max_date_length" ]] && max_date_length=$length
|
||||
[ "$length" -gt "$max_date_length" ] && max_date_length=$length
|
||||
done
|
||||
|
||||
# Find max length of a snapshot name, needed for pretty formatting
|
||||
local max_path_length=0
|
||||
for i in "${path_snapshots[@]}"; do
|
||||
local length="${#i}"
|
||||
[[ "$length" -gt "$max_path_length" ]] && max_path_length=$length
|
||||
[ "$length" -gt "$max_path_length" ] && max_path_length=$length
|
||||
done
|
||||
|
||||
# Find max length of a snapshot type, needed for pretty formatting
|
||||
local max_type_length=0
|
||||
for i in "${type_snapshots[@]}"; do
|
||||
local length="${#i}"
|
||||
[[ "$length" -gt "$max_type_length" ]] && max_type_length=$length
|
||||
[ "$length" -gt "$max_type_length" ] && max_type_length=$length
|
||||
done
|
||||
|
||||
# Find max length of a snapshot description, needed for pretty formatting
|
||||
@@ -406,14 +447,14 @@ detect_kernel()
|
||||
for okernel in "${boot_dir}"/vmlinuz-* \
|
||||
"${boot_dir}"/vmlinux-* \
|
||||
"${boot_dir}"/kernel-* ; do
|
||||
[[ ! -f "${okernel}" ]] && continue;
|
||||
[ ! -f "${okernel}" ] && continue;
|
||||
list_kernel+=("$okernel")
|
||||
done
|
||||
|
||||
# Custom name kernel in "GRUB_BTRFS_NKERNEL"
|
||||
if [ -n "${GRUB_BTRFS_NKERNEL}" ] ; then
|
||||
for ckernel in "${boot_dir}/${GRUB_BTRFS_NKERNEL[@]}" ; do
|
||||
[[ ! -f "${ckernel}" ]] && continue;
|
||||
[ ! -f "${ckernel}" ] && continue;
|
||||
list_kernel+=("$ckernel")
|
||||
done
|
||||
fi
|
||||
@@ -427,14 +468,14 @@ detect_initramfs()
|
||||
for oinitramfs in "${boot_dir}"/initrd.img-* \
|
||||
"${boot_dir}"/initramfs-* \
|
||||
"${boot_dir}"/initrd-* ; do
|
||||
[[ ! -f "${oinitramfs}" ]] && continue;
|
||||
[ ! -f "${oinitramfs}" ] && continue;
|
||||
list_initramfs+=("$oinitramfs")
|
||||
done
|
||||
|
||||
# Custom name initramfs in "GRUB_BTRFS_NINIT"
|
||||
if [ -n "${GRUB_BTRFS_NINIT}" ] ; then
|
||||
for cinitramfs in "${boot_dir}/${GRUB_BTRFS_NINIT[@]}" ; do
|
||||
[[ ! -f "${cinitramfs}" ]] && continue;
|
||||
[ ! -f "${cinitramfs}" ] && continue;
|
||||
list_initramfs+=("$cinitramfs")
|
||||
done
|
||||
fi
|
||||
@@ -447,13 +488,9 @@ detect_microcode()
|
||||
list_ucode=()
|
||||
# Original intel/amd microcode (auto-detect)
|
||||
# See "https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html"
|
||||
for oiucode in "${boot_dir}"/intel-uc.img \
|
||||
"${boot_dir}"/intel-ucode.img \
|
||||
"${boot_dir}"/amd-uc.img \
|
||||
"${boot_dir}"/amd-ucode.img \
|
||||
"${boot_dir}"/early_ucode.cpio \
|
||||
"${boot_dir}"/microcode.cpio; do
|
||||
[[ ! -f "${oiucode}" ]] && continue;
|
||||
for oiucode in ${GRUB_EARLY_INITRD_LINUX_STOCK} ; do
|
||||
oiucode="${boot_dir}/${oiucode}"
|
||||
[ ! -f "${oiucode}" ] && continue;
|
||||
list_ucode+=("$oiucode")
|
||||
done
|
||||
|
||||
@@ -509,7 +546,7 @@ boot_bounded()
|
||||
# Initialize menu entries
|
||||
IFS=$'\n'
|
||||
for item in $(snapshot_list); do
|
||||
[[ ${limit_snap_show} -le 0 ]] && break; # fix: limit_snap_show=0
|
||||
[ "${limit_snap_show}" -le 0 ] && break; # fix: limit_snap_show=0
|
||||
IFS=$oldIFS
|
||||
parse_snapshot_list
|
||||
boot_dir="$grub_btrfs_mount_point/$snap_dir_name_trim$boot_directory"
|
||||
@@ -523,14 +560,15 @@ boot_bounded()
|
||||
detect_rootflags
|
||||
title_format
|
||||
boot_dir_root_grub="$(make_system_path_relative_to_its_root "${boot_dir}")" # convert "boot_directory" to root of GRUB (e.g /boot become /)
|
||||
insmods=("${list_insmods[@]##*"/"}")
|
||||
make_menu_entries
|
||||
# show snapshot found during run "grub-mkconfig"
|
||||
if [[ "${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:-"true"}" = "true" ]]; then
|
||||
if [ "${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:-"true"}" = "true" ]; then
|
||||
printf "Found snapshot: %s\n" "$item" >&2 ;
|
||||
fi
|
||||
# Limit snapshots found during run "grub-mkconfig"
|
||||
count_limit_snap=$((1+count_limit_snap))
|
||||
[[ $count_limit_snap -ge $limit_snap_show ]] && break;
|
||||
[ "$count_limit_snap" -ge "$limit_snap_show" ] && break;
|
||||
done
|
||||
IFS=$oldIFS
|
||||
}
|
||||
@@ -550,19 +588,19 @@ boot_separate()
|
||||
# Initialize menu entries
|
||||
IFS=$'\n'
|
||||
for item in $(snapshot_list); do
|
||||
[[ ${limit_snap_show} -le 0 ]] && break; # fix: limit_snap_show=0
|
||||
[ "${limit_snap_show}" -le 0 ] && break; # fix: limit_snap_show=0
|
||||
IFS=$oldIFS
|
||||
parse_snapshot_list
|
||||
detect_rootflags
|
||||
title_format
|
||||
make_menu_entries
|
||||
# show snapshot found during run "grub-mkconfig"
|
||||
if [[ "${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:-"true"}" = "true" ]]; then
|
||||
if [ "${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:-"true"}" = "true" ]; then
|
||||
printf "Found snapshot: %s\n" "$item" >&2 ;
|
||||
fi
|
||||
# Limit snapshots found during run "grub-mkconfig"
|
||||
count_limit_snap=$((1+count_limit_snap))
|
||||
[[ $count_limit_snap -ge $limit_snap_show ]] && break;
|
||||
[ "$count_limit_snap" -ge "$limit_snap_show" ] && break;
|
||||
done
|
||||
IFS=$oldIFS
|
||||
}
|
||||
@@ -574,15 +612,15 @@ if [ -e "$grub_btrfs_directory/grub-btrfs.cfg" ]; then
|
||||
mv -f "$grub_btrfs_directory/grub-btrfs.cfg" "$grub_btrfs_directory/grub-btrfs.cfg.bkp"
|
||||
fi
|
||||
# Create mount point then mounting
|
||||
[[ ! -d $grub_btrfs_mount_point ]] && mkdir -p "$grub_btrfs_mount_point"
|
||||
[ ! -d "$grub_btrfs_mount_point" ] && mkdir -p "$grub_btrfs_mount_point"
|
||||
mount -o ro,subvolid=5 /dev/disk/by-uuid/"$root_uuid" "$grub_btrfs_mount_point/" > /dev/null
|
||||
trap "unmount_grub_btrfs_mount_point" EXIT # unmounting mount point on EXIT signal
|
||||
count_warning_menuentries=0 # Count menuentries
|
||||
count_limit_snap=0 # Count snapshots
|
||||
check_uuid_required
|
||||
# Detects if /boot is a separate partition
|
||||
[[ "${GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION,,}" == "true" ]] && printf "Override boot partition detection : enable \n" >&2 && boot_separate;
|
||||
if [[ "$root_uuid" != "$boot_uuid" ]] || [[ "$root_uuid_subvolume" != "$boot_uuid_subvolume" ]]; then boot_separate ; else boot_bounded ; fi
|
||||
[ "$(echo "$GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION}" | tr '[:upper:]' '[:lower:]')" = "true" ] && printf "Override boot partition detection : enable \n" >&2 && boot_separate;
|
||||
if [ "$root_uuid" != "$boot_uuid" ] || [ "$root_uuid_subvolume" != "$boot_uuid_subvolume" ]; then boot_separate ; else boot_bounded ; fi
|
||||
# Make a submenu in GRUB (grub.cfg)
|
||||
cat << EOF
|
||||
if [ ! -e "${grub_btrfs_search_directory}/grub-btrfs.cfg" ]; then
|
||||
@@ -594,13 +632,13 @@ submenu '${submenuname}' ${protection_authorized_users}${unrestricted_access_sub
|
||||
fi
|
||||
EOF
|
||||
# Show warn, menuentries exceeds 250 entries
|
||||
[[ $count_warning_menuentries -ge 250 ]] && printf "Generated %s total GRUB entries. You might experience issues loading snapshots menu in GRUB.\n" "${count_warning_menuentries}" >&2 ;
|
||||
[ $count_warning_menuentries -ge 250 ] && printf "Generated %s total GRUB entries. You might experience issues loading snapshots menu in GRUB.\n" "${count_warning_menuentries}" >&2 ;
|
||||
# Show total found snapshots
|
||||
if [[ "${GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND:-"true"}" = "true" && -n "${count_limit_snap}" && "${count_limit_snap}" != "0" ]]; then
|
||||
if [ "${GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND:-"true"}" = "true" ] && [ -n "${count_limit_snap}" ] && [ "${count_limit_snap}" != "0" ]; then
|
||||
printf "Found %s snapshot(s)\n" "${count_limit_snap}" >&2 ;
|
||||
fi
|
||||
# if no snapshot found, delete the "$grub_btrfs_directory/grub-btrfs.new" file and the "$grub_btrfs_directory/grub-btrfs.cfg.bkp" file and exit
|
||||
if [[ "${count_limit_snap}" = "0" || -z "${count_limit_snap}" ]]; then
|
||||
if [ "${count_limit_snap}" = "0" ] || [ -z "${count_limit_snap}" ]; then
|
||||
rm -f "$grub_btrfs_directory/grub-btrfs.new" "$grub_btrfs_directory/grub-btrfs.cfg.bkp"
|
||||
print_error "No snapshots found."
|
||||
fi
|
||||
|
||||
8
Makefile
8
Makefile
@@ -44,13 +44,11 @@ install:
|
||||
@cp manpages/grub-btrfs.8.man ${TEMP_DIR}/grub-btrfs.8
|
||||
@if test "$(INSTALL_DOCS)" = true; then \
|
||||
echo "Installing manpages..."; \
|
||||
bzip2 ${TEMP_DIR}/grub-btrfs.8; \
|
||||
install -Dm644 -t "${MAN_DIR}/man8" "${TEMP_DIR}/grub-btrfs.8.bz2"; \
|
||||
install -Dm644 -t "${MAN_DIR}/man8" "${TEMP_DIR}/grub-btrfs.8"; \
|
||||
fi
|
||||
@cp manpages/grub-btrfsd.8.man ${TEMP_DIR}/grub-btrfsd.8
|
||||
@if test "$(INSTALL_DOCS)" = true; then \
|
||||
bzip2 ${TEMP_DIR}/grub-btrfsd.8; \
|
||||
install -Dm644 -t "${MAN_DIR}/man8" "${TEMP_DIR}/grub-btrfsd.8.bz2"; \
|
||||
install -Dm644 -t "${MAN_DIR}/man8" "${TEMP_DIR}/grub-btrfsd.8"; \
|
||||
fi
|
||||
@install -Dm755 -t "$(DESTDIR)/etc/grub.d/" 41_snapshots-btrfs
|
||||
@install -Dm644 -t "$(DESTDIR)/etc/default/grub-btrfs/" config
|
||||
@@ -147,7 +145,7 @@ help:
|
||||
@echo " BOOT_DIR_FEDORA | path | boot data location (Fedora, RHEL, CentOS, Rocky...) | '/boot/grub2'"
|
||||
@echo " SHARE_DIR | path | shared data location | '\$$(DESTDIR)\$$(PREFIX)/share'"
|
||||
@echo " LIB_DIR | path | system libraries location | '\$$(DESTDIR)\$$(PREFIX)/lib'"
|
||||
@echo " PKGNAME | name | name of the ditributed package | 'grub-btrfs'"
|
||||
@echo " PKGNAME | name | name of the distributed package | 'grub-btrfs'"
|
||||
@echo " INITCPIO | bool | include mkinitcpio hook | false"
|
||||
@echo " SYSTEMD | bool | include unit files | true"
|
||||
@echo " OPENRC | bool | include OpenRc daemon | false"
|
||||
|
||||
20
README.md
20
README.md
@@ -8,7 +8,7 @@
|
||||
### 🔎 Description:
|
||||
grub-btrfs improves the grub bootloader by adding a btrfs snapshots sub-menu, allowing the user to boot into snapshots.
|
||||
|
||||
grub-btrfs supports manual snapshots as well as snapper and timeshift created snapshots.
|
||||
grub-btrfs supports manual snapshots as well as snapper, timeshift, and yabsnap created snapshots.
|
||||
|
||||
##### Warning: booting read-only snapshots can be tricky
|
||||
|
||||
@@ -25,13 +25,13 @@ Refer to the [documentation](https://github.com/Antynea/grub-btrfs/blob/master/i
|
||||
* Automatically detect if `/boot` is in a separate partition.
|
||||
* Automatically detect kernel, initramfs and Intel/AMD microcode in `/boot` directory within snapshots.
|
||||
* Automatically create corresponding menu entries in `grub.cfg`
|
||||
* Automatically detect the type/tags and descriptions/comments of Snapper/Timeshift snapshots.
|
||||
* Automatically detect the type/tags/triggers and descriptions/comments of Snapper/Timeshift/Yabsnap snapshots.
|
||||
* Automatically generate `grub.cfg` if you use the provided Systemd/ OpenRC service.
|
||||
|
||||
- - -
|
||||
### 🛠️ Installation:
|
||||
#### Arch Linux
|
||||
The package is available in the community repository [grub-btrfs](https://archlinux.org/packages/community/any/grub-btrfs/)
|
||||
The package is available in the extra repository [grub-btrfs](https://archlinux.org/packages/extra/any/grub-btrfs/)
|
||||
```
|
||||
pacman -S grub-btrfs
|
||||
```
|
||||
@@ -65,7 +65,7 @@ Booting into read-only snapshots is fully supported when choosing btrfs as the f
|
||||
* [grub](https://archlinux.org/packages/core/x86_64/grub/)
|
||||
* [bash >4](https://archlinux.org/packages/core/x86_64/bash/)
|
||||
* [gawk](https://archlinux.org/packages/core/x86_64/gawk/)
|
||||
* (only when using the grub-btrfsd daemon)[inotify-tools](https://archlinux.org/packages/community/x86_64/inotify-tools/)
|
||||
* (only when using the grub-btrfsd daemon)[inotify-tools](https://archlinux.org/packages/extra/x86_64/inotify-tools/)
|
||||
|
||||
- - -
|
||||
### 📚 Manual usage of grub-btrfs
|
||||
@@ -75,7 +75,7 @@ To manually generate grub snapshot entries you can run `sudo /etc/grub.d/41_snap
|
||||
* On **Fedora** use `grub2-mkconfig -o /boot/grub2/grub.cfg`
|
||||
* On **Debian and Ubuntu based** distributions `update-grub` is a script that runs `grub-mkconfig ...`
|
||||
|
||||
This process can be automated to occur whenever you create or delete snaphots but this process is slightly different depending upon your distributions choice on init system. See the relevant instructions for your init system below.
|
||||
This process can be automated to occur whenever you create or delete snapshots but this process is slightly different depending upon your distributions choice on init system. See the relevant instructions for your init system below.
|
||||
|
||||
### ⚙️ Customization:
|
||||
|
||||
@@ -97,7 +97,7 @@ The daemon can be configured by passing different command line arguments to it.
|
||||
The available arguments are:
|
||||
* `SNAPSHOTS_DIRS`
|
||||
This argument specifies the (space separated) paths where grub-btrfsd looks for newly created snapshots and snapshot deletions. It is usually defined by the program used to make snapshots.
|
||||
E.g. for Snapper this would be `/.snapshots`. It is possible to define more than one directory here, all directories will inherit the same settings (recursive etc.).
|
||||
E.g. for Snapper or Yabsnap this would be `/.snapshots`. It is possible to define more than one directory here, all directories will inherit the same settings (recursive etc.).
|
||||
This argument is not necessary to provide if `--timeshift-auto` is set.
|
||||
* `-c / --no-color`
|
||||
Disable colors in output.
|
||||
@@ -118,7 +118,7 @@ Displays a short help message.
|
||||
### 🪀 Automatically update grub upon snapshot creation or deletion
|
||||
Grub-btrfsd is a daemon that watches the snapshot directory for you and updates the grub menu automatically every time a snapshot is created or deleted.
|
||||
By default this daemon watches the directory `/.snapshots` for changes (creation or deletion of snapshots) and triggers the grub menu creation and re-installation of grub if any changes are noticed.
|
||||
Therefore, if Snapper is used with its default directory, the daemon can just be started and nothing needs to be configured. See the instructions below to configure grub-btrfsd for use with Timeshift or when using an alternative snapshots directory with Snapper.
|
||||
Therefore, if Snapper or Yabsnap is used with its default directory, the daemon can just be started and nothing needs to be configured. See the instructions below to configure grub-btrfsd for use with Timeshift or when using an alternative snapshots directory with Snapper/Yabsnap.
|
||||
- - -
|
||||
#### grub-btrfsd systemd instructions
|
||||
To start the daemon run:
|
||||
@@ -274,6 +274,10 @@ After that, the daemon should be restarted with:
|
||||
sudo rc-service grub-btrfsd restart
|
||||
```
|
||||
|
||||
##### 🔒 Snapshots on LUKS encrypted devices
|
||||
By default, grub-btrfs generates entries that does not load modules for dealing with encrypted devices.
|
||||
Enable the `GRUB_BTRFS_ENABLE_CRYPTODISK` variable in `/etc/default/grub-btrfs/config` to load said modules and then execute the steps to mount encrypted root after selecting the snapshot.
|
||||
|
||||
- - -
|
||||
### Troubleshooting
|
||||
If you experience problems with grub-btrfs don't hesitate [to file an issue](https://github.com/Antynea/grub-btrfs/issues/new/choose).
|
||||
@@ -294,7 +298,7 @@ If you have problems with the daemon, you can run it with the `--verbose`-flag.
|
||||
``` bash
|
||||
sudo /usr/bin/grub-btrfsd --verbose --timeshift-auto` (for timeshift)
|
||||
# or
|
||||
sudo /usr/bin/grub-btrfsd /.snapshots --verbose` (for snapper)
|
||||
sudo /usr/bin/grub-btrfsd /.snapshots --verbose` (for snapper/yabsnap)
|
||||
```
|
||||
Or pass `--verbose` to the daemon using the Systemd .service file or the OpenRC conf.d file respectively.
|
||||
|
||||
|
||||
18
config
18
config
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
GRUB_BTRFS_VERSION=4.12-master-2023-04-28T16:26:00+00:00
|
||||
GRUB_BTRFS_VERSION=4.13-yabsnap_info_support-2024-03-06T13:43:57+00:00
|
||||
|
||||
# Disable grub-btrfs.
|
||||
# Default: "false"
|
||||
@@ -49,14 +49,14 @@ GRUB_BTRFS_VERSION=4.12-master-2023-04-28T16:26:00+00:00
|
||||
# Default: ("")
|
||||
#GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")
|
||||
|
||||
# Additonal kernel command line parameters that should be passed to the kernel
|
||||
# Additional kernel command line parameters that should be passed to the kernel
|
||||
# when booting a snapshot.
|
||||
# For dracut based distros this could be useful to pass "rd.live.overlay.overlayfs=1"
|
||||
# or "rd.live.overlay.readonly=1" to the Kernel for booting snapshots read only.
|
||||
# Default: ""
|
||||
#GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"
|
||||
|
||||
# Comma seperated mount options to be used when booting a snapshot.
|
||||
# Comma separated mount options to be used when booting a snapshot.
|
||||
# They can be defined here as well as in the "/" line inside the respective snapshots'
|
||||
# "/etc/fstab" files. Mount options found in both places are combined, and this variable
|
||||
# takes priority over `fstab` entries.
|
||||
@@ -74,13 +74,15 @@ GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("@")
|
||||
# Any path starting with the specified string will be ignored.
|
||||
# e.g : if `prefix path` = @, all snapshots beginning with "@/..." will be ignored.
|
||||
# Default: ("var/lib/docker" "@var/lib/docker" "@/var/lib/docker")
|
||||
GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/docker")
|
||||
GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/docker" "var/lib/containers" "@var/lib/containers" "@/var/lib/containers")
|
||||
|
||||
# Ignore specific type/tag of snapshot during run "grub-mkconfig".
|
||||
# For snapper:
|
||||
# Type = single, pre, post.
|
||||
# For Timeshift:
|
||||
# Tag = boot, ondemand, hourly, daily, weekly, monthly.
|
||||
# For yabsnap:
|
||||
# Trigger = S, I, U.
|
||||
# Default: ("")
|
||||
#GRUB_BTRFS_IGNORE_SNAPSHOT_TYPE=("")
|
||||
|
||||
@@ -107,14 +109,14 @@ GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/doc
|
||||
|
||||
# Location where grub-btrfs.cfg should be saved.
|
||||
# Some distributions (like OpenSuSE) store those files at the snapshot directory
|
||||
# instead of boot. Be aware that this direcory must be available for grub during
|
||||
# instead of boot. Be aware that this directory must be available for grub during
|
||||
# startup of the system.
|
||||
# Default: $GRUB_BTRFS_GRUB_DIRNAME
|
||||
#GRUB_BTRFS_GBTRFS_DIRNAME="/boot/grub"
|
||||
|
||||
# Location of the directory where Grub searches for the grub-btrfs.cfg file.
|
||||
# Some distributions (like OpenSuSE) store those file at the snapshot directory
|
||||
# instead of boot. Be aware that this direcory must be available for grub during
|
||||
# instead of boot. Be aware that this directory must be available for grub during
|
||||
# startup of the system.
|
||||
# Default: "\${prefix}" # This is a grub variable that resolves to where grub is
|
||||
# installed. (like /boot/grub, /boot/efi/grub)
|
||||
@@ -156,3 +158,7 @@ GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/doc
|
||||
# doesn't work if GRUB_BTRFS_PROTECTION_AUTHORIZED_USERS isn't empty
|
||||
# Default: "false"
|
||||
#GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU="true"
|
||||
|
||||
# Enable booting from snapshots stored on LUKS encrypted devices
|
||||
# Default: "false"
|
||||
#GRUB_BTRFS_ENABLE_CRYPTODISK="true"
|
||||
|
||||
@@ -204,9 +204,9 @@ setup() {
|
||||
}
|
||||
|
||||
create_grub_menu() {
|
||||
# create the grub submenu of the whole grub menu, depending on wether the submenu already exists
|
||||
# create the grub submenu of the whole grub menu, depending on whether the submenu already exists
|
||||
# and gives feedback if it worked
|
||||
if grep "snapshots-btrfs" "{grub_directory}/grub.cfg"; then
|
||||
if grep "snapshots-btrfs" "${GRUB_BTRFS_GRUB_DIRNAME:-/boot/grub}"/grub.cfg; then
|
||||
if /etc/grub.d/41_snapshots-btrfs; then
|
||||
log "Grub submenu recreated" "${GREEN}"
|
||||
else
|
||||
@@ -258,7 +258,7 @@ daemon_function() {
|
||||
set_snapshot_dir
|
||||
log "${BASHPID}: detected Timeshift startup, PID is: $timeshift_pid" "${CYAN}"
|
||||
vlog "${BASHPID}: new snapshots directory is $snapdir" "${CYAN}"
|
||||
(create_grub_menu) # create the grub menu once immidiatly in a forking process. Snapshots from commandline using timeshift --create need this
|
||||
(create_grub_menu) # create the grub menu once immediately in a forking process. Snapshots from commandline using timeshift --create need this
|
||||
}
|
||||
fi
|
||||
runs=false
|
||||
|
||||
@@ -82,7 +82,7 @@ Example: \fCGRUB_BTRFS_SHOW_SNAPSHOTS_FOUND="false"\fP
|
||||
|
||||
.SS "\fCGRUB_BTRFS_ROOTFLAGS\fP"
|
||||
.PP
|
||||
Comma seperated mount options to be used when booting a snapshot.
|
||||
Comma separated mount options to be used when booting a snapshot.
|
||||
They can be defined here as well as in the “/” line inside the respective snapshots’
|
||||
“/etc/fstab” files. Mount options found in both places are combined, and this variable
|
||||
takes priority over `fstab` entries.
|
||||
@@ -102,6 +102,14 @@ Default: “false”
|
||||
.IP \(em 4
|
||||
Example: \fCGRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION="true"\fP
|
||||
|
||||
.SS "\GRUB_BTRFS_ENABLE_CRYPTODISK\fP"
|
||||
.PP
|
||||
Enable booting from snapshots stored on LUKS encrypted devices
|
||||
.IP \(em 4
|
||||
Default: “false”
|
||||
.IP \(em 4
|
||||
Example: \GRUB_BTRFS_ENABLE_CRYPTODISK="true"\fP
|
||||
|
||||
.SS "CUSTOM KERNELS"
|
||||
.SS "\fCGRUB_BTRFS_NKERNEL\fP / \fCGRUB_BTRFS_NINIT\fP / \fCGRUB_BTRFS_CUSTOM_MICROCODE\fP"
|
||||
.PP
|
||||
@@ -116,7 +124,7 @@ Example: \fCGRUB_BTRFS_NKERNEL=("kernel\-5.19.4\-custom" "vmlinux\-5.19.4\-custo
|
||||
|
||||
.SS "\fCGRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS\fP"
|
||||
.PP
|
||||
Additonal kernel command line parameters that should be passed to the kernelwhen
|
||||
Additional kernel command line parameters that should be passed to the kernelwhen
|
||||
booting a snapshot.
|
||||
For dracut based distros this could be useful to pass “rd.live.overlay.overlayfs=1”
|
||||
or “rd.live.overlay.readonly=1” to the Kernel for booting read only snapshots.
|
||||
@@ -190,7 +198,7 @@ Example: \fCGRUB_BTRFS_GRUB_DIRNAME="/boot/grub2"\fP
|
||||
.PP
|
||||
Location where grub-btrfs.cfg should be saved.
|
||||
Some distributions (like OpenSuSE) store those file at the snapshot directory
|
||||
instead of boot. Be aware that this direcory must be available for grub during
|
||||
instead of boot. Be aware that this directory must be available for grub during
|
||||
startup of the system.
|
||||
.IP \(em 4
|
||||
Default: \fC$GRUB_BTRFS_GRUB_DIRNAME\fP
|
||||
@@ -201,7 +209,7 @@ Example: \fCGRUB_BTRFS_GBTRFS_DIRNAME="/.snapshots"\fP
|
||||
.PP
|
||||
Location of the directory where Grub searches for the grub-btrfs.cfg file.
|
||||
Some distributions (like OpenSuSE) store those file at the snapshot directory
|
||||
instead of boot. Be aware that this direcory must be available for grub during
|
||||
instead of boot. Be aware that this directory must be available for grub during
|
||||
startup of the system.
|
||||
.IP \(em 4
|
||||
Default: “\${prefix}” (This is a grub variable that resolves to where grub is
|
||||
|
||||
@@ -58,7 +58,7 @@ Show snapshots found during run "grub-mkconfig"
|
||||
- Example: ~GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND="false"~
|
||||
|
||||
*** ~GRUB_BTRFS_ROOTFLAGS~
|
||||
Comma seperated mount options to be used when booting a snapshot.
|
||||
Comma separated mount options to be used when booting a snapshot.
|
||||
They can be defined here as well as in the "/" line inside the respective snapshots'
|
||||
"/etc/fstab" files. Mount options found in both places are combined, and this variable
|
||||
takes priority over `fstab` entries.
|
||||
@@ -73,6 +73,11 @@ Change to "true" if your boot partition is not detected as separate.
|
||||
- Default: "false"
|
||||
- Example: ~GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION="true"~
|
||||
|
||||
*** ~GRUB_BTRFS_ENABLE_CRYPTODISK~
|
||||
Enable booting from snapshots stored on LUKS encrypted devices
|
||||
- Default: "false"
|
||||
- Example: ~GRUB_BTRFS_ENABLE_CRYPTODISK="true"~
|
||||
|
||||
** CUSTOM KERNELS
|
||||
|
||||
*** ~GRUB_BTRFS_NKERNEL~ / ~GRUB_BTRFS_NINIT~ / ~GRUB_BTRFS_CUSTOM_MICROCODE~
|
||||
@@ -84,7 +89,7 @@ Customs kernel, initramfs and microcodes that are not detected can be added in t
|
||||
~GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")~
|
||||
|
||||
*** ~GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS~
|
||||
Additonal kernel command line parameters that should be passed to the kernelwhen
|
||||
Additional kernel command line parameters that should be passed to the kernelwhen
|
||||
booting a snapshot.
|
||||
For dracut based distros this could be useful to pass "rd.live.overlay.overlayfs=1"
|
||||
or "rd.live.overlay.readonly=1" to the Kernel for booting read only snapshots.
|
||||
@@ -139,7 +144,7 @@ For example, on Fedora with EFI : "/boot/efi/EFI/fedora"
|
||||
*** ~GRUB_BTRFS_GBTRFS_DIRNAME~
|
||||
Location where grub-btrfs.cfg should be saved.
|
||||
Some distributions (like OpenSuSE) store those file at the snapshot directory
|
||||
instead of boot. Be aware that this direcory must be available for grub during
|
||||
instead of boot. Be aware that this directory must be available for grub during
|
||||
startup of the system.
|
||||
- Default: ~$GRUB_BTRFS_GRUB_DIRNAME~
|
||||
- Example: ~GRUB_BTRFS_GBTRFS_DIRNAME="/.snapshots"~
|
||||
@@ -147,7 +152,7 @@ For example, on Fedora with EFI : "/boot/efi/EFI/fedora"
|
||||
*** ~GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME~
|
||||
Location of the directory where Grub searches for the grub-btrfs.cfg file.
|
||||
Some distributions (like OpenSuSE) store those file at the snapshot directory
|
||||
instead of boot. Be aware that this direcory must be available for grub during
|
||||
instead of boot. Be aware that this directory must be available for grub during
|
||||
startup of the system.
|
||||
- Default: "\${prefix}" (This is a grub variable that resolves to where grub is
|
||||
installed. (like /boot/grub, /boot/efi/grub))
|
||||
|
||||
@@ -82,7 +82,7 @@ Example: \fCGRUB_BTRFS_SHOW_SNAPSHOTS_FOUND="false"\fP
|
||||
|
||||
.SS "\fCGRUB_BTRFS_ROOTFLAGS\fP"
|
||||
.PP
|
||||
Comma seperated mount options to be used when booting a snapshot.
|
||||
Comma separated mount options to be used when booting a snapshot.
|
||||
They can be defined here as well as in the “/” line inside the respective snapshots’
|
||||
“/etc/fstab” files. Mount options found in both places are combined, and this variable
|
||||
takes priority over `fstab` entries.
|
||||
@@ -116,7 +116,7 @@ Example: \fCGRUB_BTRFS_NKERNEL=("kernel\-5.19.4\-custom" "vmlinux\-5.19.4\-custo
|
||||
|
||||
.SS "\fCGRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS\fP"
|
||||
.PP
|
||||
Additonal kernel command line parameters that should be passed to the kernelwhen
|
||||
Additional kernel command line parameters that should be passed to the kernelwhen
|
||||
booting a snapshot.
|
||||
For dracut based distros this could be useful to pass “rd.live.overlay.overlayfs=1”
|
||||
or “rd.live.overlay.readonly=1” to the Kernel for booting read only snapshots.
|
||||
@@ -190,7 +190,7 @@ Example: \fCGRUB_BTRFS_GRUB_DIRNAME="/boot/grub2"\fP
|
||||
.PP
|
||||
Location where grub-btrfs.cfg should be saved.
|
||||
Some distributions (like OpenSuSE) store those file at the snapshot directory
|
||||
instead of boot. Be aware that this direcory must be available for grub during
|
||||
instead of boot. Be aware that this directory must be available for grub during
|
||||
startup of the system.
|
||||
.IP \(em 4
|
||||
Default: \fC$GRUB_BTRFS_GRUB_DIRNAME\fP
|
||||
@@ -201,7 +201,7 @@ Example: \fCGRUB_BTRFS_GBTRFS_DIRNAME="/.snapshots"\fP
|
||||
.PP
|
||||
Location of the directory where Grub searches for the grub-btrfs.cfg file.
|
||||
Some distributions (like OpenSuSE) store those file at the snapshot directory
|
||||
instead of boot. Be aware that this direcory must be available for grub during
|
||||
instead of boot. Be aware that this directory must be available for grub during
|
||||
startup of the system.
|
||||
.IP \(em 4
|
||||
Default: “\${prefix}” (This is a grub variable that resolves to where grub is
|
||||
|
||||
Reference in New Issue
Block a user