mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 04:49:13 +08:00
core: 使用 dmesg 和 mokutil 判断安全启动状态
This commit is contained in:
parent
7a4eeb942a
commit
6dfa1c53c4
21
reinstall.sh
21
reinstall.sh
@ -1022,19 +1022,17 @@ setos() {
|
|||||||
|
|
||||||
# 仅打印前34个扇区 * 4096字节(按最大的算)
|
# 仅打印前34个扇区 * 4096字节(按最大的算)
|
||||||
# 每行512字节
|
# 每行512字节
|
||||||
"$img_type" -dc <"$tmp/img-test" | hexdump -n $((34 * 4096)) -e '512/1 "%02x" "\n"' -v >$tmp/img-test-raw
|
"$img_type" -dc <"$tmp/img-test" | hexdump -n $((34 * 4096)) -e '512/1 "%02x" "\n"' -v >$tmp/img-test-hex
|
||||||
if grep -q '^28732ac11ff8d211ba4b00a0c93ec93b' $tmp/img-test-raw; then
|
if grep -q '^28732ac11ff8d211ba4b00a0c93ec93b' $tmp/img-test-hex; then
|
||||||
echo 'DD: Image is EFI.'
|
echo 'DD: Image is EFI.'
|
||||||
else
|
else
|
||||||
echo 'DD: Image is not EFI.'
|
echo 'DD: Image is not EFI.'
|
||||||
warn '
|
warn '
|
||||||
The current machine uses EFI boot, but the DD image is not an EFI image.
|
The current machine uses EFI boot, but the DD image is not an EFI image.
|
||||||
Continue with DD? [Y/N]
|
Continue with DD?
|
||||||
|
|
||||||
当前机器使用 EFI 引导,但 DD 镜像不是 EFI 镜像。
|
当前机器使用 EFI 引导,但 DD 镜像不是 EFI 镜像。
|
||||||
继续 DD? [Y/N]
|
继续 DD?'
|
||||||
'
|
read -r -p '[y/N]: '
|
||||||
read -r -n 1
|
|
||||||
if [[ "$REPLY" = [Yy] ]]; then
|
if [[ "$REPLY" = [Yy] ]]; then
|
||||||
eval ${step}_confirmed_no_efi=1
|
eval ${step}_confirmed_no_efi=1
|
||||||
else
|
else
|
||||||
@ -1555,10 +1553,11 @@ is_secure_boot_enabled() {
|
|||||||
if is_in_windows; then
|
if is_in_windows; then
|
||||||
reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecureBoot\State' /v UEFISecureBootEnabled 2>/dev/null | grep 0x1
|
reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecureBoot\State' /v UEFISecureBootEnabled 2>/dev/null | grep 0x1
|
||||||
else
|
else
|
||||||
# localhost:~# mokutil --sb-state
|
if dmesg | grep -i 'Secure boot enabled'; then
|
||||||
# SecureBoot disabled
|
return 0
|
||||||
# Platform is in Setup Mode
|
fi
|
||||||
dmesg | grep -i 'Secure boot enabled'
|
install_pkg mokutil
|
||||||
|
mokutil --sb-state 2>&1 | grep -i 'SecureBoot enabled'
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user