2024-06-01 17:50:52 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright (C) 2021-2024 Thien Tran
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
|
|
# use this file except in compliance with the License. You may obtain a copy of
|
|
|
|
# the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations under
|
|
|
|
# the License.
|
|
|
|
|
|
|
|
# Install new grub version
|
2024-06-01 22:27:19 -04:00
|
|
|
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --disable-shim-lock
|
2024-06-01 18:25:05 -04:00
|
|
|
|
|
|
|
# Sign grub
|
|
|
|
sudo sbctl sign-all
|
2024-06-01 17:50:52 -04:00
|
|
|
|
|
|
|
# Disable root subvol pinning.
|
|
|
|
## This is **extremely** important, as snapper expects to be able to set the default btrfs subvol.
|
|
|
|
# shellcheck disable=SC2016
|
2024-06-01 18:25:05 -04:00
|
|
|
sudo sed -i 's/rootflags=subvol=${rootsubvol}//g' /mnt/etc/grub.d/10_linux
|
2024-06-01 17:50:52 -04:00
|
|
|
# shellcheck disable=SC2016
|
2024-06-01 18:25:05 -04:00
|
|
|
sudo sed -i 's/rootflags=subvol=${rootsubvol}//g' /mnt/etc/grub.d/20_linux_xen
|
2024-06-01 17:50:52 -04:00
|
|
|
|
|
|
|
# Generate grub config
|
2024-06-01 18:25:05 -04:00
|
|
|
sudo grub-mkconfig -o /boot/grub/grub.cfg
|