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=("")
* grub-btrfs.path : improves unit
#### Remember to modify your configuration accordingly.
Allows the unit to start and stop automatically when the mount point is detected.
If the mount point is already mounted when the unit is activated `systemctl enable grub-btrfs.path`,
it will be necessary to start the unit for monitoring to begin `systemctl start grub-btrfs.path`.
- `DefaultDependencies=no`
Prevents systemd from automatically generating `Wants= or Requires= or After=`.
- `Requires=\x2esnapshots.mount`
Ensures unit is started if mount point exists.
- `After=\x2esnapshots.mount`
Unit start after the mounting point exists.
- `BindsTo=\x2esnapshots.mount`
If the mount point is removed, the unit will stop.
- `PathModified=\x2esnapshots.mount`
The monitored folder containing the snapshots.
- `WantedBy=\x2esnapshots.mount`
If the mount point exists, unit start automatically. (only if unit is activated before the mount point is mounted)
* Readme: Update "Automatically update grub" section
Update section following the recent change in the `grub-btrfs.path` unit.
Add information to be able to update the `grub-btrfs` menu every time the system is restart/shutdown.
This commit is an expansion to :
87b816345b
Since a new `make` parameter has been introduced, it should be mentioned
in the output of the `help` target.
Also, the table is being expanded by a new column describing the type of
data that each parameter may be assigned, like paths or boolean values.
Errata commit:
This commit has no substantive code change.
This commit is provided only to document a correction to a previous commit message.
This pertains to commit object 87b816345b
Due to improper handling, the aforementioned commit message is incorrect.
Correct message is :
[Makefile] remove `mkinitcpio` dependency
The mkinitcpio binary is not available even on Arch, when building in a
clean environment (e.g. building distro packages in a clean chroot).
This causes the mkinitcpio hook to not be present in the final package,
which is resolved by this commit, by adding a `make` switch. This switch
allows users to explicitely turn on inclusion of the hook.
[uninstall:] don't remove non-existent folders
This prevents some warnings being output when on a non-Archlinux system,
without a previously installed initcpio hook, a `make uninstall` is per-
formed.
These three folders should _only_ be deleted if they had been mistakenly
created during `make install`.
Co-authored-by: Kriss <kr1ss.x@yandex.com>