core: 不重要的更新

This commit is contained in:
bin456789 2024-02-01 01:02:35 +08:00
parent db1b2c92ca
commit d9b53f1bf8
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
5 changed files with 24 additions and 23 deletions

View File

@ -121,20 +121,18 @@ test_internet() {
echo 'Testing Internet Connection...'
for i in $(seq 5); do
{
if is_need_test_ipv4 && nslookup www.qq.com $ipv4_dns1; then
echo "IPv4 has internet."
ipv4_has_internet=true
fi
if is_need_test_ipv6 && nslookup www.qq.com $ipv6_dns1; then
echo "IPv6 has internet."
ipv6_has_internet=true
fi
if ! is_need_test_ipv4 && ! is_need_test_ipv6; then
break
fi
sleep 1
} >/dev/null 2>&1
if is_need_test_ipv4 && nslookup www.qq.com $ipv4_dns1 2>/dev/null; then
echo "IPv4 has internet."
ipv4_has_internet=true
fi
if is_need_test_ipv6 && nslookup www.qq.com $ipv6_dns1 2>/dev/null; then
echo "IPv6 has internet."
ipv6_has_internet=true
fi
if ! is_need_test_ipv4 && ! is_need_test_ipv6; then
break
fi
sleep 1
done
}

View File

@ -21,4 +21,4 @@ runcmd:
- systemctl restart sshd
- touch /etc/cloud/cloud-init.disabled
# ubuntu 镜像运行 echo -e '\nDone' -e 会被显示出来
- printf '\n%s\n' 'done' >/dev/tty0 || true
- printf '\n%s\n' 'reinstall done' >/dev/tty0 || true

View File

@ -1,4 +1,4 @@
# shellcheck disable=2148
# shellcheck disable=SC2148
# 设置
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
@ -41,7 +41,7 @@ releasever=$(awk -F: '{ print $5 }' </etc/system-release-cpe)
# 提取 extra.confhome extra.mirrorlist extra.main_disk
prefix=extra
for var in $(grep -o "\b$prefix\.[^ ]*" /proc/cmdline | xargs); do
eval "$(echo $var | sed -E "s/$prefix\.([^=]*)=(.*)/\1='\2'/")"
eval "$(echo "$var" | sed -E "s/$prefix\.([^=]*)=(.*)/\1='\2'/")"
done
get_all_disks() {
@ -69,7 +69,8 @@ echo "ignoredisk --only-use=$(get_xda)" >$include
# 设置 tty
include=/tmp/include-bootloader
console_cmdline=$(wget $confhome/ttys.sh -O- | sh -s console=)
# shellcheck disable=SC2154
console_cmdline=$(wget "$confhome/ttys.sh" -O- | sh -s console=)
echo "bootloader --append=\"$console_cmdline\"" >$include
# 有 installer 分区,表示用了两步安装
@ -79,7 +80,7 @@ if [ -e /dev/disk/by-label/installer ]; then
# 1g内存下安装器默认开启了zram 但安装f38还是不够内存
# 具体表现为不断重启安装界面所以还要开启swap
ram_size=$(lsmem -b 2>/dev/null | grep 'Total online memory:' | awk '{ print $NF/1024/1024 }')
if [ -z $ram_size ] || [ $ram_size -le 1024 ]; then
if [ -z "$ram_size" ] || [ "$ram_size" -le 1024 ]; then
mount /dev/disk/by-label/installer /run/install/repo -o remount,rw
swapfile=/run/install/repo/swapfile
if command -v fallocate; then
@ -169,11 +170,11 @@ if [ -e /dev/disk/by-label/installer ]; then
# 提取 extra.localtest extra.confhome extra.mirrorlist
prefix=extra
for var in $(grep -o "\b$prefix\.[^ ]*" /proc/cmdline | xargs); do
eval "$(echo $var | sed -E "s/$prefix\.([^=]*)=(.*)/\1='\2'/")"
eval "$(echo "$var" | sed -E "s/$prefix\.([^=]*)=(.*)/\1='\2'/")"
done
cd /
curl -O $confhome/resize.sh
curl -O "$confhome/resize.sh"
echo '@reboot root bash /resize.sh' >/etc/cron.d/resize
fi
%end

View File

@ -1133,7 +1133,7 @@ install_grub_linux_efi() {
grub_efi=grubx64.efi
fi
# fedora x86_64 的 efi 无法识别 opensuse tumbleweed 的 xfs
# fedora 的 efi 无法识别 opensuse tumbleweed 的 xfs
# opensuse tumbleweed aarch64 的 efi 无法识别 alpine 3.19 的内核
if [ "$basearch" = aarch64 ]; then
efi_distro=fedora

View File

@ -511,7 +511,7 @@ del_invalid_efi_entry() {
while read -r line; do
part_uuid=$(echo "$line" | awk -F ',' '{print $3}')
efi_index=$(echo "$line" | grep_efi_index)
if ! lsblk -o PARTUUID | grep "$part_uuid"; then
if ! lsblk -o PARTUUID | grep -q "$part_uuid"; then
echo "Delete invalid EFI Entry: $line"
efibootmgr --quiet --bootnum "$efi_index" --delete-bootnum
fi
@ -2346,6 +2346,8 @@ EOF
}
EOF
fi
cat "$grub_cfg"
}
# 脚本入口