Skip to content

Commit e83b6e2

Browse files
Daniel Martinezclassabbyamp
authored andcommitted
New package: systemd-boot-256.6
1 parent cb31e12 commit e83b6e2

15 files changed

+1998
-13
lines changed

srcpkgs/systemd-boot-efistub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
systemd-boot
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## uncomment this line to disable the systemd-boot hook
2+
#SYSTEMD_BOOT_DISABLE=1
3+
4+
## Default $BOOT is /boot
5+
#BOOT="/boot"
6+
7+
## Default ESP is $BOOT
8+
#ESP="$BOOT"
9+
10+
## If unset, cmdline will be generated using UUID from fstab
11+
#CMDLINE=""
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/sh
2+
#
3+
# Kernel hook for systemd-boot.
4+
#
5+
# Arguments passed to this script: $1 pkgname, $2 version.
6+
#
7+
PKGNAME="$1"
8+
VERSION="$2"
9+
10+
. "$ROOTDIR/etc/default/systemd-boot"
11+
12+
if [ "$SYSTEMD_BOOT_DISABLE" ]; then
13+
exit 0
14+
fi
15+
16+
if ! bootctl is-installed >/dev/null; then
17+
echo "systemd-boot is not installed to the ESP"
18+
echo "run 'bootctl install' to install it"
19+
exit 0
20+
fi
21+
22+
BOOT="${BOOT:-/boot}"
23+
ESP="${ESP:-"$BOOT"}"
24+
25+
BOOT="$ROOTDIR/$BOOT"
26+
ESP="$ROOTDIR/$ESP"
27+
28+
[ -d "$ESP" ] || exit 0
29+
30+
ARCH="$(xbps-uhelper arch)"
31+
32+
# EFI_ARCH is the identifier from the UEFI specification
33+
case "$ARCH" in
34+
x86_64*) EFI_ARCH="x64";;
35+
i686*) EFI_ARCH="ia32";;
36+
aarch64*) EFI_ARCH="aa64";;
37+
esac
38+
39+
entries="$ESP/loader/entries"
40+
name="void-$ARCH-$VERSION"
41+
entry="$entries/$name.conf"
42+
43+
LINUX="vmlinuz-${VERSION}"
44+
45+
if [ ! -f "$ESP/$LINUX" ]; then
46+
LINUX="vmlinux-${VERSION}"
47+
if [ ! -f "$ESP/$LINUX" ]; then
48+
echo "Failed to find kernel at $ESP/vmlinuz-${VERSION} or $ESP/vmlinux-${VERSION}, aborting"
49+
exit 1
50+
fi
51+
fi
52+
53+
INITRD="initramfs-${VERSION}.img"
54+
55+
if [ ! -f "$ESP/$INITRD" ]; then
56+
echo "Failed to find initramfs at $ESP/$INITRD, aborting"
57+
exit 1
58+
fi
59+
60+
# check if user provided options in /etc/default/systemd-boot
61+
if [ -z "$CMDLINE" ]; then
62+
# get UUID from fstab
63+
CMDLINE="$( awk ' /^[[:space:]]*[^[:space:]#]+/ {
64+
DEVICE=$1
65+
MOUNTPOINT=$2
66+
FSTYPE=$3
67+
if (MOUNTPOINT == "/")
68+
{
69+
print "rootfstype="FSTYPE, "root="DEVICE
70+
exit
71+
}
72+
}' "$ROOTDIR/etc/fstab"
73+
)"
74+
if [ -z "$CMDLINE" ]; then
75+
echo "Failed to determine root device, aborting"
76+
exit 1
77+
fi
78+
CMDLINE="${CMDLINE} quiet rw"
79+
fi
80+
81+
mkdir -p "$entries"
82+
83+
cat <<-EOF > "$entry"
84+
title Void Linux $ARCH $VERSION
85+
sort-key void
86+
version $VERSION
87+
options $CMDLINE
88+
linux $LINUX
89+
initrd $INITRD
90+
EOF
91+
92+
if [ "$EFI_ARCH" ]; then
93+
cat <<-EOF >> "$entry"
94+
architecture $EFI_ARCH
95+
EOF
96+
fi
97+
98+
echo "Created systemd-boot entry $entry with options '$CMDLINE'"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
#
3+
# Kernel hook for systemd-boot.
4+
#
5+
# Arguments passed to this script: $1 pkgname, $2 version.
6+
#
7+
PKGNAME="$1"
8+
VERSION="$2"
9+
10+
. "$ROOTDIR/etc/default/systemd-boot"
11+
12+
if [ "$SYSTEMD_BOOT_DISABLE" ]; then
13+
exit 0
14+
fi
15+
16+
BOOT="${BOOT:-/boot}"
17+
ESP="${ESP:-"$BOOT"}"
18+
19+
BOOT="$ROOTDIR/$BOOT"
20+
ESP="$ROOTDIR/$ESP"
21+
22+
ARCH="$(xbps-uhelper arch)"
23+
24+
entries="$ESP/loader/entries"
25+
name="void-$ARCH-$VERSION"
26+
entry="$entries/$name.conf"
27+
28+
[ -d "$ESP" ] || exit 0
29+
30+
rm -f "$entry"
31+
32+
echo "Removed systemd-boot entry $entry"

0 commit comments

Comments
 (0)