From 30832c3ac1a83f0e471ff9b0b6dcae09bbd26530 Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Sun, 2 Apr 2023 09:20:23 -0700 Subject: [PATCH] Fixed issue with paths being remounted I noticed switching got slower and slower as I kept switching and there were a lot of duplicate directories in my mount output. See: https://discourse.nixos.org/t/duplicate-boot-entries-in-mount-output/26923/ --- systems/x86_64-linux/gospel/zfs.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/systems/x86_64-linux/gospel/zfs.nix b/systems/x86_64-linux/gospel/zfs.nix index e285111..a7dd9a4 100644 --- a/systems/x86_64-linux/gospel/zfs.nix +++ b/systems/x86_64-linux/gospel/zfs.nix @@ -17,10 +17,21 @@ boot.loader.grub.zfsSupport = true; boot.loader.grub.extraPrepareConfig = '' mkdir -p /boot/efis - for i in /boot/efis/*; do mount $i ; done + for i in /boot/efis/* ; do + (mount | grep -q "$i") + isDirectoryMounted=$? + if (test $isDirectoryMounted -ne 0); then + mount "$i" + fi + done mkdir -p /boot/efi - mount /boot/efi + # mount /boot/efi + (mount | grep -q /boot/efi) + isDirectoryMounted=$? + if (test $isDirectoryMounted -ne 0); then + mount /boot/efi + fi ''; boot.loader.grub.extraInstallCommands = '' ESP_MIRROR=$(mktemp -d)