-
Notifications
You must be signed in to change notification settings - Fork 6
/
update-bootloader
executable file
·63 lines (48 loc) · 2.08 KB
/
update-bootloader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
function yn-n() {
# N is the default
local REPLY
read -p "${1} [y/N] " -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
return 0
else
return 1
fi
}
function fail() {
echo -e "\e[31mSomething went wrong!\e[0m"
exit 1
}
cat <<EOF
This script will update the initramfs and bootloader, from inside a running
Mint installation previously set up using mint-encrypted-install.
EOF
if ! yn-n "Continue?"; then
exit 0
fi
# Not completely foolproof, but should do the job...
if ! lsb_release -a 2>/dev/null | grep 'vera' &>/dev/null || type ubiquity &>/dev/null; then
cat <<EOF
You are not running on an installed Linux Mint 21.1 system. Cannot go any
further.
EOF
exit 1
fi
if [ ! -e '/sys/firmware/efi' ]; then
echo 'Your firmware is BIOS. This script only supports UEFI. Cannot go any further.'
exit 1
fi
# Now actually start the update
# shellcheck disable=SC2015
sudo locale-gen --purge --no-archive &&
sudo update-initramfs -u &&
sudo update-grub &&
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --boot-directory=/boot --modules="all_video boot btrfs cat chain configfile crypto cryptodisk disk diskfilter echo efifwsetup efinet ext2 fat font gettext gcry_arcfour gcry_blowfish gcry_camellia gcry_cast5 gcry_crc gcry_des gcry_dsa gcry_idea gcry_md4 gcry_md5 gcry_rfc2268 gcry_rijndael gcry_rmd160 gcry_rsa gcry_seed gcry_serpent gcry_sha1 gcry_sha256 gcry_sha512 gcry_tiger gcry_twofish gcry_whirlpool gfxmenu gfxterm gfxterm_background gzio halt hfsplus iso9660 jpeg keystatus loadenv loopback linux linuxefi lsefi lsefimmap lsefisystab lssal luks lvm mdraid09 mdraid1x memdisk minicmd normal part_apple part_msdos part_gpt password_pbkdf2 png raid5rec raid6rec reboot search search_fs_uuid search_fs_file search_label sleep squash4 test true video zfs zfscrypt zfsinfo" --recheck || fail
# Print out the boot order
echo
echo 'Boot order:'
sudo efibootmgr
cat <<EOF
Finished - you may want to change the boot order using 'efibootmgr -o',
and remember to run this script again if you update grub or the kernel.
EOF