core: 使用 get-xda.sh 寻找主硬盘

This commit is contained in:
bin456789
2024-02-02 00:31:21 +08:00
parent 5150feddc6
commit 5d3227fe64
5 changed files with 50 additions and 46 deletions

View File

@ -44,33 +44,17 @@ for var in $(grep -o "\b$prefix\.[^ ]*" /proc/cmdline | xargs); do
eval "$(echo "$var" | sed -E "s/$prefix\.([^=]*)=(.*)/\1='\2'/")"
done
get_all_disks() {
lsblk -rn --nodeps -o NAME,TYPE | grep 'disk$' | awk '{print $1}'
}
get_xda() {
# 防止 $main_disk 为空
if [ -z "$main_disk" ]; then
return
fi
for disk in $(get_all_disks); do
# shellcheck disable=SC2154
if fdisk -l "/dev/$disk" | grep -iq "$main_disk"; then
echo "$disk"
break
fi
done
}
# centos7 证书链未更新,需要 --no-check-certificate
# 只使用主硬盘
include=/tmp/include-disk-only-use
echo "ignoredisk --only-use=$(get_xda)" >$include
xda=$(wget --no-check-certificate "$confhome/get-xda.sh" -O- | sh -s)
echo "ignoredisk --only-use=$xda" >$include
# 设置 tty
include=/tmp/include-bootloader
# shellcheck disable=SC2154
console_cmdline=$(wget "$confhome/ttys.sh" -O- | sh -s console=)
console_cmdline=$(wget --no-check-certificate "$confhome/ttys.sh" -O- | sh -s console=)
echo "bootloader --append=\"$console_cmdline\"" >$include
# 有 installer 分区,表示用了两步安装