core: 将 grep --text 改成 -a

避免脚本早期运行时在 alpine 下报错
This commit is contained in:
bin456789
2026-03-15 23:32:51 +08:00
parent 41c4df9fdb
commit 8dd873d7dd

View File

@ -2321,7 +2321,7 @@ check_ram() {
is_efi() { is_efi() {
if is_in_windows; then if is_in_windows; then
# bcdedit | grep -qi '^path.*\.efi' # bcdedit | grep -qi '^path.*\.efi'
mountvol | grep -q --text 'EFI' mountvol | grep -q -a 'EFI'
else else
[ -d /sys/firmware/efi ] [ -d /sys/firmware/efi ]
fi fi
@ -2372,7 +2372,7 @@ is_use_local_extlinux() {
is_mbr_using_grub() { is_mbr_using_grub() {
find_main_disk find_main_disk
# 各发行版不一定自带 strings hexdump xxd od 命令 # 各发行版不一定自带 strings hexdump xxd od 命令
head -c 440 /dev/$xda | grep --text -iq 'GRUB' head -c 440 /dev/$xda | grep -a -iq 'GRUB'
} }
to_upper() { to_upper() {
@ -3116,7 +3116,7 @@ install_grub_win() {
# 添加引导 # 添加引导
# 脚本可能不是首次运行,所以先删除原来的 # 脚本可能不是首次运行,所以先删除原来的
id='{1c41f649-1637-52f1-aea8-f96bfebeecc8}' id='{1c41f649-1637-52f1-aea8-f96bfebeecc8}'
bcdedit /enum all | grep --text $id && bcdedit /delete $id bcdedit /enum all | grep -a $id && bcdedit /delete $id
bcdedit /create $id /d "$(get_entry_name)" /application bootsector bcdedit /create $id /d "$(get_entry_name)" /application bootsector
bcdedit /set $id device partition=$c: bcdedit /set $id device partition=$c:
bcdedit /set $id path \\g2ldr bcdedit /set $id path \\g2ldr
@ -4200,12 +4200,12 @@ remove_exist_reinstall() {
remove_exist_reinstall_efi_dir remove_exist_reinstall_efi_dir
bcdedit /set '{fwbootmgr}' bootsequence '{bootmgr}' bcdedit /set '{fwbootmgr}' bootsequence '{bootmgr}'
bcdedit /enum bootmgr | grep --text -B3 'reinstall' | awk '{print $2}' | grep '{.*}' | bcdedit /enum bootmgr | grep -a -B3 'reinstall' | awk '{print $2}' | grep '{.*}' |
xargs -I {} cmd /c bcdedit /delete {} xargs -I {} cmd /c bcdedit /delete {}
else else
# bios # bios
id='{1c41f649-1637-52f1-aea8-f96bfebeecc8}' id='{1c41f649-1637-52f1-aea8-f96bfebeecc8}'
if bcdedit /enum all | grep --text "$id"; then if bcdedit /enum all | grep -a "$id"; then
bcdedit /delete "$id" bcdedit /delete "$id"
fi fi
fi fi