mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 21:15:02 +08:00
Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0c50d1d76 | ||
|
|
87a94c19c2 | ||
|
|
c8a7214e22 | ||
|
|
befb66e801 | ||
|
|
7213d04a42 | ||
|
|
5ea4c86400 | ||
|
|
f17ce68fb3 | ||
|
|
7720cec5f9 | ||
|
|
b4bd7b952c | ||
|
|
56c11b8e2a | ||
|
|
d469db0a2d | ||
|
|
6ae56dbaf6 | ||
|
|
f820de4759 | ||
|
|
59164367e7 | ||
|
|
f256338074 | ||
|
|
52ab9dbe95 | ||
|
|
28e9524ca5 | ||
|
|
8fffc13c2f | ||
|
|
a4db6a8870 | ||
|
|
4388c334a3 | ||
|
|
a2acaefa9c | ||
|
|
3db73de479 | ||
|
|
39b2d09015 | ||
|
|
b511210646 | ||
|
|
63d653746b | ||
|
|
2df311179e | ||
|
|
58b8f5d3ec | ||
|
|
4081cbd27a | ||
|
|
9d3aa6d8a3 | ||
|
|
25e2c16828 | ||
|
|
14cbf60c5a | ||
|
|
2cf01a874f | ||
|
|
93b8ac07f5 | ||
|
|
252a6372dd | ||
|
|
297f539f0a | ||
|
|
1c6c8c6051 | ||
|
|
f0fb4b8e25 | ||
|
|
650ac69552 | ||
|
|
3ebc5b494a | ||
|
|
615cbe9f3a | ||
|
|
2e58a2b74d | ||
|
|
4f725a8431 | ||
|
|
d598529001 | ||
|
|
b925f639cd | ||
|
|
31a0baa2b1 | ||
|
|
3a7c6abece | ||
|
|
5e0951d8cb | ||
|
|
c9f5938e04 | ||
|
|
128cbe28f3 | ||
|
|
aae6892218 | ||
|
|
84ecc2a5a7 | ||
|
|
7c1178b17c | ||
|
|
7d07503f07 | ||
|
|
f646dfd900 | ||
|
|
b4d4bc0aac | ||
|
|
6f7fb178fb | ||
|
|
d561206775 | ||
|
|
563151507d |
@@ -1,39 +1,57 @@
|
||||
#! /usr/bin/bash
|
||||
#! /usr/bin/env bash
|
||||
#
|
||||
#
|
||||
#########################################################################################################################################################
|
||||
# Written by: Antynea #
|
||||
# #
|
||||
# Purpose: Include btrfs snapshots at boot options. #
|
||||
# #
|
||||
# What this script does: #
|
||||
# - Automatically List snapshots existing on root partition (btrfs). #
|
||||
# - Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots. (For custon name, see below.) #
|
||||
# - Automatically Create corresponding "menuentry" in grub.cfg , which ensures a very easy rollback. #
|
||||
# #
|
||||
# How to use it: #
|
||||
# - Add this lines to /etc/default/grub: #
|
||||
# #
|
||||
# * GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" (Name menu appearing in grub.) #
|
||||
# * GRUB_BTRFS_PREFIXENTRY="Snapshot:" (Add a name ahead your snapshots entries.) #
|
||||
# * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") (Use only if you have custom kernel name or auto-detect failed.) #
|
||||
# * GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") (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.) #
|
||||
# #
|
||||
# - Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg ) #
|
||||
# #
|
||||
# - grub-btrfs automatically generates snapshots entries. #
|
||||
# - You will see it appear different entries (e.g : Snapshot: my snapshot name overkill [2014-02-12 11:24:37]) #
|
||||
# #
|
||||
# Warning: #
|
||||
# #
|
||||
# Script in progress #
|
||||
# to do : #
|
||||
# # #
|
||||
# * verify compatibility with manjaro and snapper (but I don't use them, so it will take some time) #
|
||||
# #
|
||||
# #
|
||||
#########################################################################################################################################################
|
||||
#################################################################################################################################################
|
||||
# Written by: Antynea #
|
||||
# #
|
||||
# Purpose: Include btrfs snapshots at boot options (grub-menu). #
|
||||
# #
|
||||
# What this script does: #
|
||||
# - Automatically List snapshots existing on root partition (btrfs). #
|
||||
# - Automatically Detect if "/boot" is in separate partition. #
|
||||
# - Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots. (For custon name, see below.) #
|
||||
# - Automatically Create corresponding "menuentry" in grub.cfg , which ensures a very easy rollback. #
|
||||
# #
|
||||
# How to use it: #
|
||||
# - Add this lines to /etc/default/grub: #
|
||||
# #
|
||||
# * GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" #
|
||||
# (Name appearing in the Grub menu.) #
|
||||
# * GRUB_BTRFS_PREFIXENTRY="Snapshot:" #
|
||||
# (Add a name ahead your snapshots entries in the Grub menu.) #
|
||||
# * GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT="true" #
|
||||
# (Show full path snapshot or only name in the Grub menu) #
|
||||
# * GRUB_BTRFS_TITLE_FORMAT="p/d/n" #
|
||||
# (Custom title, shows/hides p"prefix" d"date" n"name" in the Grub menu, separator "/", custom order available) #
|
||||
# * GRUB_BTRFS_LIMIT="100" #
|
||||
# (Limit the number of snapshots populated in the GRUB menu.) #
|
||||
# * GRUB_BTRFS_SUBVOLUME_SORT="descending" #
|
||||
# (Sort the found subvolumes by newest first ("descending") or oldest first ("ascending"). #
|
||||
# If "ascending" is chosen then the $GRUB_BTRFS_LIMIT oldest subvolumes will populate the menu.) #
|
||||
# * GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND="true" #
|
||||
# (Show snapshots found during run "grub-mkconfig") #
|
||||
# * GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND="true" #
|
||||
# (Show Total of snapshots found during run "grub-mkconfig") #
|
||||
# * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") #
|
||||
# (Use only if you have custom kernel name or auto-detect failed.) #
|
||||
# * GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") #
|
||||
# (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") #
|
||||
# (Ignore specific path during run "grub-mkconfig") #
|
||||
# #
|
||||
# - Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg) #
|
||||
# #
|
||||
# - grub-btrfs automatically generates snapshots entries. #
|
||||
# - You will see it appear different entries (e.g : Snapshot: [2014-02-12 11:24:37] my snapshot name overkill) #
|
||||
# #
|
||||
# #
|
||||
# To do: #
|
||||
# #
|
||||
# * Display name of microcode in menuentry when available #
|
||||
# #
|
||||
#################################################################################################################################################
|
||||
|
||||
set -e
|
||||
|
||||
@@ -49,18 +67,35 @@ sysconfdir="/etc"
|
||||
######################################
|
||||
### Variables in /etc/default/grub ###
|
||||
######################################
|
||||
## Choice of method
|
||||
choise_of_method=${GRUB_BTRFS_SUBMENUNAME:-"1"}
|
||||
## Submenu name
|
||||
submenuname=${GRUB_BTRFS_SUBMENUNAME:-"ArchLinux Snapshots"}
|
||||
## Prefix entry
|
||||
prefixentry=${GRUB_BTRFS_PREFIXENTRY:-"Snapshot:"}
|
||||
## Show full path snapshot or only name
|
||||
path_snapshot=${GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT:-"true"}
|
||||
## Title format
|
||||
title_format=${GRUB_BTRFS_TITLE_FORMAT:-"p/d/n"}
|
||||
## Kernel(s) name(s)
|
||||
nkernel=("${GRUB_BTRFS_NKERNEL[@]}")
|
||||
## Initramfs name(s)
|
||||
ninit=("${GRUB_BTRFS_NINIT[@]}")
|
||||
## Microcode(s) name(s)
|
||||
microcode=("${GRUB_BTRFS_INTEL_UCODE[@]:-intel-ucode.img}")
|
||||
microcode=("${GRUB_BTRFS_INTEL_UCODE[@]}")
|
||||
## Limit to show in the Grub menu
|
||||
limit_snap_show="${GRUB_BTRFS_LIMIT:-100}"
|
||||
## How to sort snapshots list
|
||||
snap_list_sort=${GRUB_BTRFS_SUBVOLUME_SORT:-"descending"}
|
||||
case "${snap_list_sort}" in
|
||||
ascending) btrfssubvolsort=("--sort=+rootid");;
|
||||
*) btrfssubvolsort=("--sort=-rootid")
|
||||
esac
|
||||
## Show snapshots found during run "grub-mkconfig"
|
||||
show_snap_found=${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:-"true"}
|
||||
## Show Total of snapshots found during run "grub-mkconfig"
|
||||
show_total_snap_found=${GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND:-"true"}
|
||||
## Ignore specific path during run "grub-mkconfig"
|
||||
ignore_specific_path=("${GRUB_BTRFS_IGNORE_SPECIFIC_PATH[@]}")
|
||||
|
||||
|
||||
########################
|
||||
### variables script ###
|
||||
@@ -90,7 +125,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
|
||||
}
|
||||
|
||||
|
||||
@@ -104,11 +138,14 @@ boot_dir()
|
||||
snapshots_entry()
|
||||
{
|
||||
## \" required for snap,kernels,init,microcode with space in their name
|
||||
echo " submenu '${1} ${2} ${3}' {"
|
||||
for k in "${name_kernel[@]}"; do
|
||||
for i in "${name_initramfs[@]}"; do
|
||||
echo "\
|
||||
menuentry '${2} with "${k}" & "${i}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{
|
||||
echo " submenu '"${title_menu[*]}"' {
|
||||
submenu '---> "${title_menu[*]}" <---' { echo }
|
||||
"
|
||||
for k in "${name_kernel[@]}"; do
|
||||
for i in "${name_initramfs[@]}"; do
|
||||
for u in "${name_microcode[@]}"; do
|
||||
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
|
||||
@@ -120,104 +157,192 @@ 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: "${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}
|
||||
echo 'Loading Initramfs: "${i}" ...'"
|
||||
if [ -f "/${boot_dir_real_path}/"${microcode}"" ] ; then
|
||||
echo "\
|
||||
initrd \"${boot_dir_real_path}/"${microcode}"\" initrd \"/${snap_dir_name}/boot/"${i}"\""
|
||||
else
|
||||
echo "\
|
||||
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}" ...'
|
||||
initrd \"${boot_dir_real_path}/"${u}"\" \"${boot_dir_real_path}/"${i}"\""
|
||||
else
|
||||
echo "\
|
||||
echo 'Loading Initramfs: "${i}" ...'
|
||||
initrd \"${boot_dir_real_path}/"${i}"\""
|
||||
fi
|
||||
fi
|
||||
echo " }"
|
||||
done
|
||||
done
|
||||
done
|
||||
echo " }"
|
||||
}
|
||||
|
||||
## List of snapshots on filesystem
|
||||
snapshot_list()
|
||||
{
|
||||
for snap in $(btrfs subvolume list -sa /); do
|
||||
for snap in $(btrfs subvolume list -sa "${btrfssubvolsort}" /); do
|
||||
IFS=$oldIFS
|
||||
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
|
||||
}
|
||||
|
||||
## Detect kernels in "/boot"
|
||||
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
|
||||
}
|
||||
|
||||
## Detect initramfs in "/boot"
|
||||
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 in "/boot"
|
||||
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
|
||||
}
|
||||
|
||||
## Show full path snapshot or only name
|
||||
path_snapshot()
|
||||
{
|
||||
case "${path_snapshot}" in
|
||||
true) name_snapshot=("${snap_dir_name}");;
|
||||
*) name_snapshot=("${snap_dir_name#*"/"}")
|
||||
esac
|
||||
}
|
||||
|
||||
## Title format in grub-menu
|
||||
title_format()
|
||||
{
|
||||
case "${title_format}" in
|
||||
p/d/n) title_menu=("${prefixentry}" "${snap_date_time}" "${name_snapshot}");;
|
||||
p/n/d) title_menu=("${prefixentry}" "${snap_dir_name}" "${snap_date_time}");;
|
||||
p/d) title_menu=("${prefixentry}" "${snap_date_time}");;
|
||||
p/n) title_menu=("${prefixentry}" "${snap_dir_name}");;
|
||||
d/n) title_menu=("${snap_date_time}" "${snap_dir_name}");;
|
||||
n/d) title_menu=("${snap_dir_name}" "${snap_date_time}");;
|
||||
p) title_menu=("${prefixentry}");;
|
||||
d) title_menu=("${snap_date_time}");;
|
||||
n) title_menu=("${snap_dir_name}");;
|
||||
*) gettext_printf $"# Warning: GRUB_BTRFS_TITLE_FORMAT=${title_format}, syntax error \n" >&2
|
||||
esac
|
||||
}
|
||||
|
||||
## List of kernels, initramfs and microcode in snapshots
|
||||
list_kernels_initramfs()
|
||||
{
|
||||
IFS=$'\n'
|
||||
count_limit_snap=0
|
||||
for item in $(snapshot_list); do
|
||||
### fix: limit_snap_show=0
|
||||
[[ ${limit_snap_show} -le 0 ]] && break;
|
||||
IFS=$oldIFS
|
||||
item=($item)
|
||||
snap_dir_name=${item[@]:2:${#item[@]}}
|
||||
### ignore specific path during run "grub-mkconfig"
|
||||
if [ ! -z "${ignore_specific_path}" ] ; then
|
||||
for isp in ${ignore_specific_path[@]} ; do
|
||||
[[ "${gbgmp}"/"${snap_dir_name}" == "${gbgmp}"/"${isp}"/* ]] && continue 2;
|
||||
done
|
||||
fi
|
||||
### detect if /boot directory exist
|
||||
[[ ! -d "$gbgmp/$snap_dir_name/boot" ]] && continue;
|
||||
### show snapshot found during run "grub-mkconfig"
|
||||
snap_date_time=${item[@]:0:2}
|
||||
gettext_printf $"# Found Snapshot: %s\n" "$snap_dir_name $snap_date_time" >&2 ;
|
||||
if [[ "${show_snap_found}" = "true" ]]; then
|
||||
gettext_printf $"# Found Snapshot: %s\n" "${snap_date_time} ${snap_dir_name}" >&2 ;
|
||||
fi
|
||||
### Kernel (auto-detect + custom kernel)
|
||||
unset list_kernel
|
||||
detect_kernel
|
||||
name_kernel=("${list_kernel[@]##*"/"}")
|
||||
# echo "kernel = ${name_kernel[*]}"
|
||||
### Initramfs (autodetect + custom initramfs)
|
||||
unset list_initramfs
|
||||
detect_initramfs
|
||||
name_initramfs=("${list_initramfs[@]##*"/"}")
|
||||
# echo "initramfs = ${name_initramfs[*]}"
|
||||
# Create menu entries
|
||||
snapshots_entry "${prefixentry}" "${snap_dir_name}" "${snap_date_time}"
|
||||
### 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
|
||||
path_snapshot
|
||||
## title menu custom
|
||||
title_format
|
||||
# echo "${title_menu[*]}"
|
||||
snapshots_entry
|
||||
### Limit snapshots found during run "grub-mkconfig"
|
||||
count_limit_snap=$((1+$count_limit_snap))
|
||||
[[ $count_limit_snap -ge $limit_snap_show ]] && break;
|
||||
done
|
||||
IFS=$oldIFS
|
||||
}
|
||||
### END auto detect ###
|
||||
|
||||
### Choice of method ###
|
||||
if [ ${choise_of_method} = "1" ] ; then
|
||||
gettext_printf "###### - Grub-btrfs: Auto-detect - ######\n" >&2 ;
|
||||
### Start ###
|
||||
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/
|
||||
### Create a menu in grub
|
||||
echo "submenu '${submenuname}' {"
|
||||
list_kernels_initramfs ;
|
||||
## show total found snapshots
|
||||
if [[ "${show_total_snap_found}" = "true" ]]; then
|
||||
gettext_printf "# found ${count_limit_snap} snapshot(s)\n" >&2 ;
|
||||
fi
|
||||
## if no snapshot found, show a warning
|
||||
if [[ "${count_limit_snap}" = "0" ]]; then
|
||||
echo " submenu '---> "No snapshot found : Press ESC to return previous menu" <---' { echo } ";
|
||||
gettext_printf "# No snapshot found \n# make sure you have at least one snapshot \n# or please file a bug report at \"https://github.com/Antynea/grub-btrfs\"\n" >&2 ;
|
||||
fi
|
||||
echo "}"
|
||||
## unmount mount point
|
||||
umount $gbgmp
|
||||
gettext_printf "###### - Grub-btrfs: Auto-detect - ######\n" >&2 ;
|
||||
fi
|
||||
### End choice of method ###
|
||||
gettext_printf "###### - Grub-btrfs: Auto-detect End - ######\n" >&2 ;
|
||||
### End ###
|
||||
74
README.md
74
README.md
@@ -1,3 +1,5 @@
|
||||
[](https://github.com/Antynea/grub-btrfs)
|
||||
|
||||
### grub-btrfs
|
||||
|
||||
|
||||
@@ -11,32 +13,82 @@ grub-btrfs, Include btrfs snapshots at boot options. (grub menu)
|
||||
|
||||
Simple rollback using snapshots you made previously.
|
||||
|
||||
- Automatically List snapshots existing on root partition (btrfs).
|
||||
- Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots. (For custon name, see below.)
|
||||
- Automatically Create corresponding menuentry in grub.cfg , which ensures a very easy rollback.
|
||||
* Automatically List snapshots existing on root partition (btrfs).
|
||||
|
||||
* Automatically Detect if "/boot" is in separate partition.
|
||||
|
||||
* Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots. (For custom name, see below.)
|
||||
|
||||
* Automatically Create corresponding "menuentry" in grub.cfg , which ensures a very easy rollback.
|
||||
|
||||
|
||||
#### How to use it:
|
||||
|
||||
Add this lines to /etc/default/grub:
|
||||
|
||||
* GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" (Name menu appearing in grub.)
|
||||
* GRUB_BTRFS_PREFIXENTRY="Snapshot:" (Add a name ahead your snapshots entries.)
|
||||
* GRUB_BTRFS_NKERNEL=("vmlinuz-linux") (Use only if you have custom kernel name or auto-detect failed.)
|
||||
* GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") (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_SUBMENUNAME="ArchLinux Snapshots"
|
||||
|
||||
(Name menu appearing in grub.)
|
||||
|
||||
* GRUB_BTRFS_PREFIXENTRY="Snapshot:"
|
||||
|
||||
(Add a name ahead your snapshots entries.)
|
||||
|
||||
* GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT="true"
|
||||
|
||||
(Show full path snapshot or only name)
|
||||
|
||||
* GRUB_BTRFS_TITLE_FORMAT="p/d/n"
|
||||
|
||||
(Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available)
|
||||
|
||||
* GRUB_BTRFS_NKERNEL=("vmlinuz-linux")
|
||||
|
||||
(Use only if you have a custom kernel name or auto-detect failed.)
|
||||
|
||||
* GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img")
|
||||
|
||||
(Use only if you have a 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_LIMIT="100"
|
||||
|
||||
(Limit the number of snapshots populated in the GRUB menu.)
|
||||
|
||||
* GRUB_BTRFS_SUBVOLUME_SORT="descending"
|
||||
|
||||
(Sort the found subvolumes by newest first ("descending") or oldest first ("ascending").
|
||||
If "ascending" is chosen then the $GRUB_BTRFS_LIMIT oldest
|
||||
subvolumes will populate the menu.)
|
||||
|
||||
* GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND="true"
|
||||
|
||||
(Show snapshots found during run "grub-mkconfig")
|
||||
|
||||
* GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND="true"
|
||||
|
||||
(Show Total number of snapshots found during run "grub-mkconfig")
|
||||
|
||||
* GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("var/lib/docker" "nosnapshot")
|
||||
|
||||
(Ignore specific path during run "grub-mkconfig")
|
||||
|
||||
|
||||
|
||||
|
||||
Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg )
|
||||
|
||||
grub-btrfs automatically generates snapshots entries.
|
||||
|
||||
You will see it appear differents entries (e.g : Snapshot: my snapshot name overkill [2014-02-12 11:24:37])
|
||||
You will see it appear differents entries (e.g : Snapshot: [2014-02-12 11:24:37] my snapshot name overkill )
|
||||
|
||||
|
||||
#### TO DO
|
||||
|
||||
* verify compatibility with manjaro and snapper (but I don't use them, so it will take some time)
|
||||
|
||||
* Display name of microcode in menuentry when available
|
||||
|
||||
|
||||
## discussion
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user