Antynea 8508cac7d8 GRUB shouldn't break anymore (#46)
* Update 41_snapshots-btrfs

Enhanced error handling :
	- new function available: print_error
	- if btrfs-progs is not present, print a error and exit

New options in etc/default/grub 
	- disable this script
		
Enhanced menuentries:
	- menuentries is now store in new grub configfile (/boot/grub/grub.cfg)
	- use new functions for make a menuentry: make_menu_entries and entry
	- harmonize menuentry with matching version kernel&initramfs # initramfs-linux-fallback is include and not boot with intel-ucode if exist , same as original patch in GRUB for Arch Linux
	- make a menuentry in Grub menu (grub.cfg) to load our configfile

Enhanced /boot detection:
	- create two separate function for make menuentries, if /boot is on a separate partition, use function boot_separate, else, boot_bounded
	- if no kernel found, print a message and exit
	- if no initramfs found, print a message and exit

Delete function: boot_dir
No longer uses gettext_printf function of grub-mkconfig_lib

New function to detect kernel:
	- add all original standard kernel
	- verifying if kernel exist before to continue

New functionto  detect initramfs:
	- add all original standard initramfs
	- verifying if initramfs exist before to continue
	
New function to detect microcode

New counter:
	- add a counter to show a warning if the total menuentries made exceeds 250 entries

Purge some obsolete code

Size tabulation is now 4
2018-04-16 21:43:47 +02:00
2015-09-23 02:14:46 +02:00
2014-02-12 02:24:56 -08:00

GitHub release

grub-btrfs

This is a version 2.xx of grub-btrfs

BTC donation address: 1Lbvz244WA8xbpHek9W2Y12cakM6rDe5Rt

Description

grub-btrfs, Include btrfs snapshots at boot options. (grub menu)

What does grub-btrfs v2.xx do :

Simple rollback using snapshots you made previously.

  • 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.

  • Automatically detect snapper and use snapper's snapshot description if available.

How to use it:

Add this lines to /etc/default/grub:

  • GRUB_BTRFS_SUBMENUNAME="Arch Linux 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, weird reaction with snapper)

  • 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="50"

    (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")

  • GRUB_BTRFS_CREATE_ONLY_HARMONIZED_ENTRIES="true"

    (Create entries with matching version number instead of all possible combinations of kernel and initramfs, very useful with debian-like distributions)

  • GRUB_BTRFS_SNAPPER_CONFIG="root"

    (Snapper's config name to use)

Generate grub.cfg (on Arch linux use grub-mkconfig -o /boot/grub/grub.cfg )

grub-btrfs automatically generates snapshots entries.

You will see it appear differents entries (e.g : Snapshot: 2018-01-03 15:08:41 @test1 )

Automatically update grub

If you would like grub to automatically update when Snapper timeline snapshots and cleanups occur, simply install 10-update_grub.conf in the following locations:

  • /etc/systemd/system/snapper-timeline.service.d/
  • /etc/systemd/system/snapper-cleanup.service.d/

Once the configuration files are in place, systemctl daemon-reload should be run to reload the units and make the changes active.

Discussion

Pour les francophones : https://forums.archlinux.fr/viewtopic.php?f=18&t=17177

Special thanks for assistance and contributions

Description
Include btrfs snapshots at boot options. (Grub menu)
Readme GPL-3.0 1.2 MiB
Languages
Shell 60.3%
Roff 30.7%
Makefile 9%