* 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>
Script:
Improves the rootflags option in the kernel command line:
- Remove "rw" flag.
- Parse fstab mountoptions and add them to rootflags:
Adds functionality to read in snapshot specific mount flags
from the respective fstab and uses them in combination with the new
config option, while the latter is prioritized.
Both places can, but don't need to define mount flags. If either of them
doesn't, it will simply not be taken into account.
Config file:
Adds a new config variable "GRUB_BTRFS_ROOTFLAGS":
- The new variable is used to include user-defined rootflags in the
kernel command line of generated snapshot bootmenu entries.
See config file for more infos.
Makefile:
Install target:
- Added "uninstall" and "help" target to ".phony".
- Hook initcpio will be installed only on Arch Linux like distributions.
Uninstall target:
- All commands are in silent mode.
- "rmdir" command will not interrupt the uninstallation if the folder does not exist.
- Remove "-r" option to "rm" command.
- Fix a mistake in deleting the "readme" file.
- Uninstalling the "grub-btrfs.cfg" file uses the "GRUB_BTRFS_GRUB_DIRNAME" variable.
- Delete initcpio folder if not on Arch.
- Delete "grub-btrfs" docs and licenses folders.
help target:
- Add "help" target.
grub-btrfs.service: remove unnecessary path for bash and grub-mkconfig command
readme.md: add warning section to systemd service section
config file: Improves the description of the variable GRUB_BTRFS_MKCONFIG
Corrects the duplicate that appeared
Line16 should be :
`@install -Dm644 "initramfs/Arch Linux/overlay_snap_ro-hook" "$(LIB_DIR)/initcpio/hooks/grub-btrfs-overlayfs" # Arch Linux only`
* Fix#116 (#118)
* Renames variable GRUB_BTRFS_DIRNAME to GRUB_BTRFS_GRUB_DIRNAME and improves its description
* Adds variable GRUB_BTRFS_BOOT_DIRNAME, used to detect the boot partition and the location of kernels/initrafms/microcodes
* Create a initramfs folder & configuration files
* create a initramfs folder
* create Arch Linux folder
* Add `HOOK/INSTALL` files to generate a custom initrafms for boot on read-only snapshot for Arch Linux.
* Add readme file to initramfs folder
* Makefile changes
* Add readme file
* Add readme file of initramfs-overlayfs
* Add HOOK/INSTALL files for Arch Linux
* Readme changes
* Updates the documentation to be able to boot on a read-only snapshot.
* Redesign readme again.
* Modify "GRUB_BTRFS_DIRNAME"
* Full path to Grub folder is now configurable (/boot is no longer hard coded).
* Detection of the boot partition is now based on the location of the Grub folder.
* Warning [see](https://github.com/Antynea/grub-btrfs/pull/113#issuecomment-705916729)
Modify the function which is used to ignore a path.
@ shouldn't be hardcoded.
Create 2 separate functions to ignore a specific path or prefix path.
In specific path, only exact paths are ignored.
In prefix path, any path starting with the specified string will be ignored.
e.g :
if specific path = @, only @ snapshot will be ignored.
if prefix path = @, all snapshots beginning with "@/..." will be ignored.
* Add more information
Add more information.
Due to the redesign of the "Customization" section of the readme file.
* Redesign customization section
Move information of customization section to config file
Timeshift use `/run/timeshift/backup/timeshift-btrfs/snapshots` mountpoint for its snapshots.
Timeshift users must modify the monitoring path:
```
[Path]
PathModified=/.snapshots
```
to
```
[Path]
PathModified=/run/timeshift/backup/timeshift-btrfs/snapshots
```