Skip to content

Commit 25c7a37

Browse files
committed
Add GRUB2_PASSWORD support, source custom.cfg
user.cfg, despite his name, is usually used to store GRUB2_PASSWORD variable: - grub2-set-password utility overwrite the whole file - security scanners look at the content of user.cfg https://github.com/ComplianceAsCode/content/blob/47fd3bcded59116ade8ea09eb396f363e37813d4/linux_os/guide/system/bootloader-grub2/uefi/grub2_uefi_password/oval/shared.xml Copy the content of the legacy /etc/grub.d/01_users as 01_grub2_password.cfg, and source custom.cfg instead of user.cfg for people in need of custom configs. This gets us closer to classic grub2-mkconfig behaviour.
1 parent 1af8396 commit 25c7a37

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ install:
3939

4040
install-grub-static:
4141
install -m 644 -D -t ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static src/grub2/*.cfg
42-
install -m 755 -d ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static/configs.d
42+
install -m 644 -D -t ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static/configs.d src/grub2/configs.d/*.cfg
4343

4444
install-systemd-unit:
4545
install -m 644 -D -t "${DESTDIR}$(PREFIX)/lib/systemd/system/" systemd/bootloader-update.service
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Keep the comment for grub2-set-password
2+
### BEGIN /etc/grub.d/01_users ###
3+
if [ -f ${prefix}/user.cfg ]; then
4+
source ${prefix}/user.cfg
5+
if [ -n "${GRUB2_PASSWORD}" ]; then
6+
set superusers="root"
7+
export superusers
8+
password_pbkdf2 root ${GRUB2_PASSWORD}
9+
fi
10+
fi

src/grub2/configs.d/41_custom.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Import user defined configuration
2+
# tracker: https://github.com/coreos/fedora-coreos-tracker/issues/805
3+
if [ -f $prefix/custom.cfg ]; then
4+
source $prefix/custom.cfg
5+
fi

src/grub2/grub-static-post.cfg

-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,5 @@ else
77
set timeout=1
88
fi
99

10-
# Import user defined configuration
11-
# tracker: https://github.com/coreos/fedora-coreos-tracker/issues/805
12-
if [ -f $prefix/user.cfg ]; then
13-
source $prefix/user.cfg
14-
fi
15-
1610
blscfg
1711

0 commit comments

Comments
 (0)