-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhologram-uefi-bootloader.pkg.toml
60 lines (52 loc) · 1.6 KB
/
hologram-uefi-bootloader.pkg.toml
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
[package]
name = "hologram-uefi-bootloader"
version = "1.2.0"
description = "hologram: UEFI bootloader using systemd-boot"
requires = [
"systemd", # for bootctl
"util-linux", # for blkid
"device-mapper", # for dmsetup
]
[[action]]
on = "setup"
script = '''
echo 'If this package is installed for the first time, run `bootctl install`.'
'''
[[file]]
path = "/boot/loader/loader.conf"
content = """
default arch
timeout 1
"""
[[file]]
path = "/boot/loader/entries/arch.conf"
content = """
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=PARTUUID=${PARTUUID} rw
"""
# This interpolation happens very late because other holograms might want to
# use the "${PARTUUID}" placeholder when rewriting the bootloader entry.
# See e.g. hologram-uefi-bootloader-with-luks.
[[file]]
path = "/usr/share/holo/files/99-root-partuuid/boot/loader/entries/arch.conf.holoscript"
mode = "0755"
content = '''
#!/bin/bash
ROOTDEVICE="$(mount | grep 'on / ' | cut -d' ' -f1)"
if [[ "$ROOTDEVICE" == /dev/mapper/* ]]; then
# root FS is encrypted -- find underlying block device
ROOTDEVICE="/dev/$(dmsetup deps -o blkdevname "$ROOTDEVICE" | cut -d'(' -f2 | cut -d')' -f1)"
fi
if [ "$ROOTDEVICE" == "" ]; then
echo "ERROR: cannot find root filesystem" >&2
exit 1
fi
PARTUUID="$(blkid -s PARTUUID -o value "$ROOTDEVICE")"
if [ "$PARTUUID" == "" ]; then
echo "ERROR: cannot find partition UUID" >&2
exit 1
fi
sed 's/\${PARTUUID}/'"$PARTUUID"'/g'
'''