Skip to content

Commit

Permalink
Make path of "grub-mkconfig_lib" configurable (#181)
Browse files Browse the repository at this point in the history
* 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 ...)
  • Loading branch information
Antynea authored Nov 17, 2021
1 parent 1accd5e commit 4f1aa38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions 41_snapshots-btrfs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

set -e

datarootdir="/usr/share"
sysconfdir="/etc"
grub_btrfs_config="${sysconfdir}/default/grub-btrfs/config"

Expand All @@ -46,7 +45,7 @@ grub_btrfs_config="${sysconfdir}/default/grub-btrfs/config"
## Exit the script, if:
[[ "${GRUB_BTRFS_DISABLE,,}" == "true" ]] && exit 0 # Disable Grub-btrfs is set to true (default=false)
if ! type btrfs >/dev/null 2>&1; then exit 0; fi # btrfs-progs isn't installed
[[ -f "$datarootdir/grub/grub-mkconfig_lib" ]] && . "$datarootdir/grub/grub-mkconfig_lib" || exit 0 # grub-mkconfig_lib couldn't be found
[[ -f "${GRUB_BTRFS_MKCONFIG_LIB:-/usr/share/grub/grub-mkconfig_lib}" ]] && . "${GRUB_BTRFS_MKCONFIG_LIB:-/usr/share/grub/grub-mkconfig_lib}" || exit 0 # grub-mkconfig_lib couldn't be found
# Root filesystem isn't btrfs
root_fs=$(${grub_probe} --target="fs" / 2>/dev/null)
[[ "$root_fs" != "btrfs" ]] && exit 0
Expand Down
5 changes: 5 additions & 0 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/doc
# Default: grub-script-check
#GRUB_BTRFS_SCRIPT_CHECK=grub2-script-check

# Path of grub-mkconfig_lib file, use by "grub-btrfs"
# Might be '/usr/share/grub2/grub-mkconfig_lib' on some systems (Opensuse ...)
# Default: /usr/share/grub/grub-mkconfig_lib
#GRUB_BTRFS_MKCONFIG_LIB=/usr/share/grub2/grub-mkconfig_lib

# Password protection management for submenu,snapshots
# Refer to the Grub documentation https://www.gnu.org/software/grub/manual/grub/grub.html#Authentication-and-authorisation
# and this comment https://github.com/Antynea/grub-btrfs/issues/95#issuecomment-682295660
Expand Down

0 comments on commit 4f1aa38

Please sign in to comment.