mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-26 21:09:42 +01:00
feat: copy bootloader to temp location
This is a precaution to make sure we have enough disk space before renaming original bootloader.
This commit is contained in:
parent
c8cd4f7ef4
commit
5dbebb7cfa
1 changed files with 12 additions and 6 deletions
|
@ -80,15 +80,21 @@ in
|
||||||
after = [ "post-resume.target" ];
|
after = [ "post-resume.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Activation script to install apple-set-os-loader in order to unlock the iGPU
|
# Activation script to install apple-set-os-loader in order to unlock the iGPU
|
||||||
system.activationScripts.appleSetOsLoader = lib.optionalString t2Cfg.enableAppleSetOsLoader ''
|
system.activationScripts.appleSetOsLoader = lib.optionalString t2Cfg.enableAppleSetOsLoader ''
|
||||||
if [[ -e /boot/efi/EFI/BOOT/bootx64_original.efi ]]; then
|
if [[ -e /boot/efi/efi/boot/bootx64_original.efi ]]; then
|
||||||
true # It's already installed, no action required
|
true # It's already installed, no action required
|
||||||
elif [[ -e /boot/efi/EFI/BOOT/BOOTX64.EFI ]]; then
|
elif [[ -e /boot/efi/efi/boot/bootx64.efi ]]; then
|
||||||
mv /boot/efi/EFI/BOOT/BOOTX64.EFI /boot/efi/EFI/BOOT/bootx64_original.efi
|
# Copy the new bootloader to a temporary location
|
||||||
cp ${apple-set-os-loader-installer}/bootx64.efi /boot/efi/EFI/BOOT/bootx64.efi
|
cp ${apple-set-os-loader-installer}/bootx64.efi /boot/efi/efi/boot/bootx64_temp.efi
|
||||||
|
|
||||||
|
# Rename the original bootloader
|
||||||
|
mv /boot/efi/efi/boot/bootx64.efi /boot/efi/efi/boot/bootx64_original.efi
|
||||||
|
|
||||||
|
# Move the new bootloader to the final destination
|
||||||
|
mv /boot/efi/efi/boot/bootx64_temp.efi /boot/efi/efi/boot/bootx64.efi
|
||||||
else
|
else
|
||||||
echo "Error: /boot/efi/EFI/BOOT/BOOTX64.EFI is missing" >&2
|
echo "Error: /boot/efi/efi/boot/bootx64.efi is missing" >&2
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue