This allows users to customize the snapshots path to work with, e.g., snapper.
If no path is configured, it will default to timeshift.
Signed-off-by: David P <megver83@parabola.nu>
* Make path of "grub-mkconfig_lib" configurable
* 41_snapshots-btrfs file:
- Remove "datarootdir" variable, is no longer used
- Replace "$datarootdir/grub/grub-mkconfig_lib" with "${GRUB_BTRFS_MKCONFIG_LIB:-/usr/share/grub/grub-mkconfig_lib}"
* Config file:
- Adds new GRUB_BTRFS_MKCONFIG_LIB variable
Might be '/usr/share/grub2/grub-mkconfig_lib' on some systems (Opensuse ...)
41_snapshots-btrfs file:
* Remove "grub_script_check" variable
Config file;
* Make name of "grub-script-check" configurable
* Might be 'grub2-script-check' on some systems (Fedora ...)
#### Script:
* Snapper:
- Now, the information is retrieved from the info.xml file.
* Timeshift:
* Now, the information is retrieved from the info.json file.
* Probe informations from device:
* Add the UUID of the root and boot subvolumes
* Show full path snapshot or only name:
* Remove, this feature never worked correctly
* Grub-menu:
* Now displays the following information in separate columns:
- Date of snapshot
- Path of snapshot
- Type/Tags of snapshot if available (snapper/timeshift)
- Description/Comments of snapshot if available (snapper/timeshift)
* Possibility to display only the desired information(s) (see config file)
* Adds a header for the column title
* GRUB_BTRFS_PREFIXENTRY is remove
* Boot partition detection:
* grub-btrfs is now able to detect if the boot folder/partition is a subvolume
* GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION should no longer be needed for this case
* Variables:
* Rename some variables
* Header:
* Update the header to reflect the changes.
#### Config:
* GRUB_BTRFS_PREFIXENTRY:
* Remove, no longer use
* GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT:
* Remove, no longer use
* GRUB_BTRFS_TITLE_FORMAT:
* Shows/Hides "date" "snapshot" "type" "description" in the Grub menu, custom order available.
Default: ("date" "snapshot" "type" "description")
* GRUB_BTRFS_IGNORE_SNAPPER_TYPE:
* Rename to GRUB_BTRFS_IGNORE_SNAPSHOT_TYPE
- Supports both timeshift and snapper tags/type
* GRUB_BTRFS_IGNORE_SNAPPER_DESCRIPTION:
* Rename to GRUB_BTRFS_IGNORE_SNAPSHOT_DESCRIPTION
- Supports both snapper and timeshift description/comments
* GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION:
* grub-btrfs is now able to detect if the boot folder/partition is a subvolume.
Activating this parameter should no longer be necessary for this case.
* GRUB_BTRFS_SNAPPER_CONFIG:
* Remove, no longer use
#### Readme:
* Update "What does grub-btrfs v4.xx do" section
* Adds support for timeshift
* Update "GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU":
* Remove default parameter (false), not needed
* adds automatic conversion of the value to lower case
* Adds security if a false positive is detected:
* if the command "grep -qs "$gbgmp" /proc/mounts;" returns a false positive.
"rm -d" will return an error if the directory is not empty.
* Rework the creation of the "grub-btrfs.cfg" file:
* Before, the "grub-btrfs.cfg" file was deleted and then the new configuration was written.
No backup was made.
* Now, the new configuration will be written in a temporary file "grub-btrfs.new" and then analysed with the "grub_script_check" command before being finally written in the "grub-btrfs.cfg" file.
If an error is detected, the "grub-btrfs.new" file will coexist with the old "grub-btrfs.cfg" file, if it exists.
* Adds trap command on EXIT signal:
* Now umount command will launch on EXIT signal.
* Adds a function called by the trap on EXIT signal to unmount and delete the temporary folder.
(That should be the end of multiple tmp.xxxxxxxxxx in /tmp)
- If the command fails, retry every 2 seconds. After 10 attempts, it will stop and display a warning.
- If the command is successful, "Succes" will be displayed.
* Adds "grub-btrfs" as a prefix to the temporarie mount folder.
(before = tmp.xxxxxxxxx , now = grub-btrfs.xxxxxxxxxx)
* Corrects printf format string:
* printf interprets escape sequences and format specifiers in the format string. If variables are included, any escape sequences or format specifiers in the data will be interpreted too, when you most likely wanted to treat it as data.
* Update "Installation section":
* Adds required dependencies
* Indicates that the command "update-grub", is an alias to "grub-mkconfig" on Debian-like distributions.
* With these changes, the script will be disabled as soon as possible, if :
* "GRUB_BTRFS_DISABLE" If this variable is set to "true"
* "btrfs-progs isn't installed" This package is required to retrieve information from the btrfs filesystem.
* "grub-mkconfig_lib couldn't be found" This library is required because the script depends on it.
* "Root filesystem isn't btrfs" grub-btrfs currently checks only the btrfs snapshots present on the root partition.
Running a command and then checking its exit status $? against 0 is redundant.
Instead of just checking the exit code of a command, it checks the exit code of a command that checks the exit code of a command.
* Add possibility to boot without init(rd,ramfs):
- For a snapshot to be valid, it must contain a boot folder and a kernel from the official list (or have been added to the custom kernel list)
- if a snapshot doesn't contain an init(rd,ramfs), it will be detected as valid.
- Suppress script stop when an init is not found
- If init isn't found, add the letter "x" to the init list. (hoping this doesn't break the support for custom init names)
- The microcode support is still present, despite the absence of init(rd,ramfs), is it really relevant ?
- Add filter to ignore snapper's snapshot "type or description" during run "grub-mkconfig"
- Two new variables available in the config file:
# Ignore specific type of snapper's snapshot during run "grub-mkconfig".
# Type = single, pre or post.
# Default: ("")
GRUB_BTRFS_IGNORE_SNAPPER_TYPE=("")
# Ignore specific description of snapper's snapshot during run "grub-mkconfig".
# Default: ("")
GRUB_BTRFS_IGNORE_SNAPPER_DESCRIPTION=("")