mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-10-20 02:42:03 +08:00
Update disable_script function
* Update disable_script function: * A function is no longer required since the commands have been moved to the beginning of the script.
This commit is contained in:
+6
-10
@@ -44,16 +44,12 @@ grub_btrfs_config="${sysconfdir}/default/grub-btrfs/config"
|
|||||||
[[ -f "${sysconfdir}/default/grub" ]] && . "${sysconfdir}/default/grub"
|
[[ -f "${sysconfdir}/default/grub" ]] && . "${sysconfdir}/default/grub"
|
||||||
|
|
||||||
## Exit the script, if:
|
## Exit the script, if:
|
||||||
disable_script() {
|
[[ "${GRUB_BTRFS_DISABLE,,}" == "true" ]] && exit 0 # Disable Grub-btrfs is set to true (default=false)
|
||||||
[[ "${GRUB_BTRFS_DISABLE:-"false"}" == "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
|
||||||
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 "$datarootdir/grub/grub-mkconfig_lib" ]] && . "$datarootdir/grub/grub-mkconfig_lib" || exit 0 # grub-mkconfig_lib couldn't be found
|
# Root filesystem isn't btrfs
|
||||||
# Root filesystem isn't btrfs
|
root_fs=$(${grub_probe} --target="fs" / 2>/dev/null)
|
||||||
root_fs=$(${grub_probe} --target="fs" / 2>/dev/null)
|
[[ "$root_fs" != "btrfs" ]] && exit 0
|
||||||
[[ "$root_fs" != "btrfs" ]] && exit 0
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
disable_script
|
|
||||||
|
|
||||||
## Submenu name
|
## Submenu name
|
||||||
distro=$(awk -F "=" '/^NAME=/ {gsub(/"/, "", $2); print $2}' /etc/os-release)
|
distro=$(awk -F "=" '/^NAME=/ {gsub(/"/, "", $2); print $2}' /etc/os-release)
|
||||||
|
|||||||
Reference in New Issue
Block a user