mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 04:49:13 +08:00
nixos: 不使用 grub-mkconfig
grub-mkconfig -o /boot/grub/grub.cfg 会丢失系统启动条目
This commit is contained in:
parent
0e231e7aa0
commit
cc7d3a6b45
16
reinstall.sh
16
reinstall.sh
@ -3224,7 +3224,21 @@ if is_use_grub; then
|
|||||||
else
|
else
|
||||||
error_and_exit "grub not found"
|
error_and_exit "grub not found"
|
||||||
fi
|
fi
|
||||||
$grub-mkconfig -o $grub_cfg
|
|
||||||
|
# nixos 手动执行 grub-mkconfig -o /boot/grub/grub.cfg 会丢失系统启动条目
|
||||||
|
# 正确的方法是修改 configuration.nix 的 boot.loader.grub.extraEntries
|
||||||
|
# 但是修改 configuration.nix 不是很好,因此改成修改 grub.cfg
|
||||||
|
if [ -x /nix/var/nix/profiles/system/bin/switch-to-configuration ]; then
|
||||||
|
# 生成 grub.cfg
|
||||||
|
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
||||||
|
# 手动启用 41_custom
|
||||||
|
nixos_grub_home="$(dirname "$(readlink -f "$(get_cmd_path grub-mkconfig)")")/.."
|
||||||
|
$nixos_grub_home/etc/grub.d/41_custom >>$grub_cfg
|
||||||
|
elif is_have_cmd update-grub; then
|
||||||
|
update-grub
|
||||||
|
else
|
||||||
|
$grub-mkconfig -o $grub_cfg
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 选择用 custom.cfg (linux-bios) 还是 grub.cfg (win/linux-efi)
|
# 选择用 custom.cfg (linux-bios) 还是 grub.cfg (win/linux-efi)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user