mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 13:05:00 +08:00
v4 (#62)
* Readme updated * localization no longer supported * New systemd service. * 41_snapshots-btrfs, ahead updated * Makefile added
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
[Service]
|
|
||||||
# Set the possible paths for `grub-mkconfig`
|
|
||||||
Environment="PATH=/sbin:/bin:/usr/sbin:/usr/bin"
|
|
||||||
# Load environment variables from the configuration
|
|
||||||
EnvironmentFile=/etc/grub.d/41_snapshots-btrfs_config
|
|
||||||
# Regenerate just '/boot/grub/grub-btrfs.cfg' if it exists, else regenerate the whole grub menu
|
|
||||||
ExecStartPost=/bin/bash -c 'if [ -s "/boot/${GRUB_BTRFS_DIRNAME:-grub}/grub-btrfs.cfg" ]; then /etc/grub.d/41_snapshots-btrfs; else ${GRUB_BTRFS_MKCONFIG:-/usr/bin/grub-mkconfig} -o /boot/${GRUB_BTRFS_DIRNAME:-grub}/grub.cfg; fi'
|
|
||||||
@@ -6,30 +6,32 @@
|
|||||||
# BTC donation address: 1Lbvz244WA8xbpHek9W2Y12cakM6rDe5Rt
|
# BTC donation address: 1Lbvz244WA8xbpHek9W2Y12cakM6rDe5Rt
|
||||||
# Github: https://github.com/Antynea/grub-btrfs
|
# Github: https://github.com/Antynea/grub-btrfs
|
||||||
#
|
#
|
||||||
# Purpose: Include btrfs snapshots at boot options (grub-menu).
|
# Purpose:
|
||||||
|
# Improves Grub by adding "btrfs snapshots" to the Grub menu.
|
||||||
|
# You can start your system on a "snapshot" from the Grub menu.
|
||||||
|
# Supports manual snapshots, snapper ...
|
||||||
|
# Warning : it isn't recommended to start on read-only snapshot
|
||||||
#
|
#
|
||||||
# What this script does:
|
# What this script does:
|
||||||
# Simple rollback using snapshots you made previously.
|
|
||||||
# - Automatically List snapshots existing on root partition (btrfs).
|
# - Automatically List snapshots existing on root partition (btrfs).
|
||||||
# - Automatically Detect if "/boot" is in separate partition.
|
# - Automatically Detect if "/boot" is in separate partition.
|
||||||
# - Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots.
|
# - Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots.
|
||||||
# - Automatically Create corresponding "menuentry" in grub.cfg , which ensures a very easy rollback.
|
# - Automatically Create corresponding "menuentry" in grub.cfg
|
||||||
# - Automatically detect snapper and use snapper's snapshot description if available.
|
# - Automatically detect snapper and use snapper's snapshot description if available.
|
||||||
|
# - Automatically generate grub.cfg if you use the provided systemd service.
|
||||||
#
|
#
|
||||||
# How to customize it:
|
# Installation:
|
||||||
# - Refer to config for the list of available options and their default values.
|
# - Run `make install` or look into Makefile for instructions on where to put each file.
|
||||||
# - Place your configurations to /etc/default/grub-btrfs/config.
|
|
||||||
#
|
#
|
||||||
# - Generate grub.cfg (on Arch Linux use grub-mkconfig -o /boot/$grub_directory/grub.cfg)
|
# Customization:
|
||||||
|
# Refer to config for the list of available options and their default values.
|
||||||
|
# Place your configurations to /etc/default/grub-btrfs/config.
|
||||||
#
|
#
|
||||||
# - grub-btrfs automatically generates snapshots entries.
|
# Automatically update Grub
|
||||||
# - You will see it appear different entries (e.g : Snapshot: [2014-02-12 11:24:37] my snapshot name overkill)
|
# If you would like Grub to automatically update when a snapshots is made or deleted:
|
||||||
#
|
# - Mount your subvolume which contains snapshots to /.snapshots
|
||||||
# Automatically update grub
|
# - Use systemctl start/enable grub-btrfs.path
|
||||||
# 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:
|
# grub-btrfs.path will automatically (re)generate grub.cfg when a modification appear in /.snapshots
|
||||||
# - /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.
|
|
||||||
#
|
#
|
||||||
# Special thanks for assistance and contributions:
|
# Special thanks for assistance and contributions:
|
||||||
# - My friends
|
# - My friends
|
||||||
@@ -47,6 +49,7 @@ grub_btrfs_config="${sysconfdir}/default/grub-btrfs/config"
|
|||||||
|
|
||||||
[[ -f "$grub_btrfs_config" ]] && . "$grub_btrfs_config"
|
[[ -f "$grub_btrfs_config" ]] && . "$grub_btrfs_config"
|
||||||
. "$datarootdir/grub/grub-mkconfig_lib"
|
. "$datarootdir/grub/grub-mkconfig_lib"
|
||||||
|
. "${sysconfdir}/default/grub"
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
### Variables in /etc/default/grub-btrfs/config ###
|
### Variables in /etc/default/grub-btrfs/config ###
|
||||||
|
|||||||
99
README.md
99
README.md
@@ -1,60 +1,51 @@
|
|||||||
[](https://github.com/Antynea/grub-btrfs)
|
[](https://github.com/Antynea/grub-btrfs/releases)
|
||||||
|

|
||||||
|
|
||||||
## grub-btrfs
|
## grub-btrfs
|
||||||
|
|
||||||
This is a version 3.xx of grub-btrfs
|
This is a version 4.xx of grub-btrfs
|
||||||
##### BTC donation address: 1Lbvz244WA8xbpHek9W2Y12cakM6rDe5Rt
|
##### BTC donation address: `1Lbvz244WA8xbpHek9W2Y12cakM6rDe5Rt`
|
||||||
##
|
##
|
||||||
### Description
|
### Description
|
||||||
|
Improves Grub by adding "btrfs snapshots" to the Grub menu.
|
||||||
|
|
||||||
grub-btrfs, Include btrfs snapshots at boot options. (grub menu)
|
You can start your system on a "snapshot" from the Grub menu.
|
||||||
|
|
||||||
|
Supports manual snapshots, snapper ...
|
||||||
|
|
||||||
|
##### Warning : it isn't recommended to start on read-only snapshot
|
||||||
##
|
##
|
||||||
### What does grub-btrfs v3.xx do :
|
### What does grub-btrfs v4.xx do :
|
||||||
|
|
||||||
Simple rollback using snapshots you made previously.
|
|
||||||
|
|
||||||
* Automatically List snapshots existing on root partition (btrfs).
|
* Automatically List snapshots existing on root partition (btrfs).
|
||||||
|
|
||||||
* Automatically Detect if "/boot" is in separate partition.
|
* Automatically Detect if "/boot" is in separate partition.
|
||||||
|
|
||||||
* Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots.
|
* Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots.
|
||||||
|
* Automatically Create corresponding "menuentry" in `grub.cfg`
|
||||||
* Automatically Create corresponding "menuentry" in grub.cfg , which ensures a very easy rollback.
|
|
||||||
|
|
||||||
* Automatically detect snapper and use snapper's snapshot description if available.
|
* Automatically detect snapper and use snapper's snapshot description if available.
|
||||||
|
* Automatically generate `grub.cfg` if you use the provided systemd service.
|
||||||
##
|
##
|
||||||
### How to customize it:
|
### Installation :
|
||||||
|
* Run `make install` or look into Makefile for instructions on where to put each file.
|
||||||
|
* Generate your Grub menu after installation for the changes to take effect. (on Arch linux use `grub-mkconfig -o /boot/grub/grub.cfg`)
|
||||||
|
##
|
||||||
|
### Customization:
|
||||||
|
|
||||||
You have the possibility to modify many parameters.
|
You have the possibility to modify many parameters in `/etc/default/grub-btrfs/config`.
|
||||||
Add this lines to /etc/default/grub:
|
|
||||||
|
|
||||||
* GRUB_BTRFS_SUBMENUNAME="Arch Linux Snapshots"
|
* GRUB_BTRFS_SUBMENUNAME="Arch Linux Snapshots"
|
||||||
|
|
||||||
(Name menu appearing in grub.)
|
(Name appearing in the Grub menu.)
|
||||||
|
|
||||||
* GRUB_BTRFS_PREFIXENTRY="Snapshot:"
|
* GRUB_BTRFS_PREFIXENTRY="Snapshot:"
|
||||||
|
|
||||||
(Add a name ahead your snapshots entries.)
|
(Add a name ahead your snapshots entries in the Grub menu.)
|
||||||
|
|
||||||
* GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT="true"
|
* GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT="true"
|
||||||
|
|
||||||
(Show full path snapshot or only name, weird reaction with snapper)
|
(Show full path snapshot or only name in the Grub menu, weird reaction with snapper)
|
||||||
|
|
||||||
* GRUB_BTRFS_TITLE_FORMAT="p/d/n"
|
* GRUB_BTRFS_TITLE_FORMAT="p/d/n"
|
||||||
|
|
||||||
(Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available)
|
(Custom title, shows/hides p"prefix" d"date" n"name" in the Grub menu, separator "/", custom order available)
|
||||||
|
|
||||||
* GRUB_BTRFS_NKERNEL=("kernel-custom")
|
|
||||||
|
|
||||||
(Use it only if you have a custom kernel name)
|
|
||||||
|
|
||||||
* GRUB_BTRFS_NINIT=("initramfs-custom.img" "initrd.img-custom")
|
|
||||||
|
|
||||||
(Use it only if you have a custom initramfs name)
|
|
||||||
|
|
||||||
* GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img")
|
|
||||||
|
|
||||||
(Use it only if you have custom intel-ucode)
|
|
||||||
|
|
||||||
* GRUB_BTRFS_LIMIT="50"
|
* GRUB_BTRFS_LIMIT="50"
|
||||||
|
|
||||||
@@ -74,6 +65,18 @@ Add this lines to /etc/default/grub:
|
|||||||
|
|
||||||
(Show Total number of snapshots found during run "grub-mkconfig")
|
(Show Total number of snapshots found during run "grub-mkconfig")
|
||||||
|
|
||||||
|
* GRUB_BTRFS_NKERNEL=("kernel-custom")
|
||||||
|
|
||||||
|
(Use it only if you have a custom kernel name)
|
||||||
|
|
||||||
|
* GRUB_BTRFS_NINIT=("initramfs-custom.img" "initrd.img-custom")
|
||||||
|
|
||||||
|
(Use it only if you have a custom initramfs name)
|
||||||
|
|
||||||
|
* GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img")
|
||||||
|
|
||||||
|
(Use it only if you have custom intel-ucode)
|
||||||
|
|
||||||
* GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("var/lib/docker")
|
* GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("var/lib/docker")
|
||||||
|
|
||||||
(Ignore specific path during run "grub-mkconfig")
|
(Ignore specific path during run "grub-mkconfig")
|
||||||
@@ -82,44 +85,28 @@ Add this lines to /etc/default/grub:
|
|||||||
|
|
||||||
(Snapper's config name to use)
|
(Snapper's config name to use)
|
||||||
|
|
||||||
* GRUB_BTRFS_DISABLE="true"
|
* GRUB_BTRFS_DISABLE="false"
|
||||||
|
|
||||||
(Disable grub-btrfs)
|
(Disable grub-btrfs)
|
||||||
|
|
||||||
* GRUB_BTRFS_DIRNAME="grub"
|
* GRUB_BTRFS_DIRNAME="grub"
|
||||||
|
|
||||||
(Name of the grub folder on /boot/)
|
(Name of the grub folder in `/boot/`, might be grub2 on some distributions )
|
||||||
|
|
||||||
* GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION="false"
|
* GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION="false"
|
||||||
(Change to "true" if you have a boot partition in a different subvolume)
|
(Change to "true" if you have a boot partition in a different subvolume)
|
||||||
|
|
||||||
* GRUB_BTRFS_MKCONFIG=grub-mkconfig
|
* GRUB_BTRFS_MKCONFIG=grub-mkconfig
|
||||||
|
|
||||||
(Name or path of the 'grub-mkconfig' executable; this is 'grub2-mkconfig' on some systems)
|
(Name or path of the 'grub-mkconfig' executable; might be 'grub2-mkconfig' on some distributions)
|
||||||
|
|
||||||
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
|
### Automatically update grub
|
||||||
|
If you would like Grub to automatically update when a snapshots is made or deleted:
|
||||||
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:
|
* Mount your subvolume which contains snapshots to `/.snapshots`
|
||||||
|
* Use `systemctl start/enable grub-btrfs.path`
|
||||||
- `/etc/systemd/system/snapper-timeline.service.d/`
|
* `grub-btrfs.path` automatically (re)generate `grub.cfg` when a modification appear in `/.snapshots`
|
||||||
- `/etc/systemd/system/snapper-cleanup.service.d/`
|
|
||||||
|
|
||||||
Or copy `grub-btrfs.path` and `grub-btrfs.service` to `/etc/systemd/system/`
|
|
||||||
|
|
||||||
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
|
### Special thanks for assistance and contributions
|
||||||
|
|
||||||
* [maximbaz](https://github.com/maximbaz)
|
* [maximbaz](https://github.com/maximbaz)
|
||||||
* [crossroads1112](https://github.com/crossroads1112)
|
* [crossroads1112](https://github.com/crossroads1112)
|
||||||
* [penetal](https://github.com/penetal)
|
* [penetal](https://github.com/penetal)
|
||||||
|
|||||||
0
grub-btrfs.path
Executable file → Normal file
0
grub-btrfs.path
Executable file → Normal file
0
grub-btrfs.service
Executable file → Normal file
0
grub-btrfs.service
Executable file → Normal file
Binary file not shown.
Reference in New Issue
Block a user