Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use fwsetup --is-supported #8

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
grub2 (2.12-1deepin4) unstable; urgency=medium

* Do not use fwsetup --is-supported.
Ref: https://github.com/linuxdeepin/developer-center/issues/7523

-- Tianyu Chen <[email protected]> Mon, 18 Mar 2024 11:02:22 +0800

grub2 (2.12-1deepin3) unstable; urgency=medium

* remove loongarch64 patch.
Expand Down
50 changes: 50 additions & 0 deletions debian/patches/revert-fwsetup-is-supported.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Description: Do not use fwsetup --is-supported
fwsetup --is-supported is new in grub 2.12
Author: Tianyu Chen <[email protected]>
Origin: vendor
Bug-Deepin: https://github.com/linuxdeepin/developer-center/issues/7523
Forwarded: not-needed
Last-Update: 2024-03-18
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/util/grub.d/30_uefi-firmware.in
+++ b/util/grub.d/30_uefi-firmware.in
@@ -33,22 +33,26 @@

. "$pkgdatadir/grub-mkconfig_lib"

-LABEL="System Setup"
+EFI_VARS_DIR=/sys/firmware/efi/efivars
+EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c
+OS_INDICATIONS="$EFI_VARS_DIR/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE"

-gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2
+if [ -e "$OS_INDICATIONS" ] && \
+ [ "$(( $(printf 0x%x \'"$(cat $OS_INDICATIONS | cut -b5)"\') & 1 ))" = 1 ]; then
+ LABEL="UEFI Firmware Settings"

-gettext_printf "System Setup" >/dev/null 2>&1
-gettext_printf "UnionTech OS Restore" >/dev/null 2>&1
+ gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2

-if [ "x$hw_support" != x"true" ];then
-cat << EOF
+ gettext_printf "System Setup" >/dev/null 2>&1
+ gettext_printf "UnionTech OS Restore" >/dev/null 2>&1
+
+ if [ "x$hw_support" != x"true" ];then
+ cat << EOF
if [ "\$grub_platform" = "efi" ]; then
- fwsetup --is-supported
- if [ "\$?" = 0 ]; then
- menuentry '$(gettext_printf "System Setup")' \$menuentry_id_option 'uefi-firmware' {
- fwsetup
- }
- fi
+menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
+ fwsetup
+}
fi
EOF
+ fi
fi
1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ uniontech0029-make-users-parameter-work-2.patch
uniontech0034-enable-os-prober.patch
fix-remove-system-setup-on-huawei-pc.patch
uniontech0033-enable-grub-background-on-huawei-2
revert-fwsetup-is-supported.patch
Loading