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,12 +121,11 @@ test_internet() {
echo 'Testing Internet Connection...' echo 'Testing Internet Connection...'
for i in $(seq 5); do for i in $(seq 5); do
{ if is_need_test_ipv4 && nslookup www.qq.com $ipv4_dns1 2>/dev/null; then
if is_need_test_ipv4 && nslookup www.qq.com $ipv4_dns1; then
echo "IPv4 has internet." echo "IPv4 has internet."
ipv4_has_internet=true ipv4_has_internet=true
fi fi
if is_need_test_ipv6 && nslookup www.qq.com $ipv6_dns1; then if is_need_test_ipv6 && nslookup www.qq.com $ipv6_dns1 2>/dev/null; then
echo "IPv6 has internet." echo "IPv6 has internet."
ipv6_has_internet=true ipv6_has_internet=true
fi fi
@ -134,7 +133,6 @@ test_internet() {
break break
fi fi
sleep 1 sleep 1
} >/dev/null 2>&1
done done
} }

View File

@ -21,4 +21,4 @@ runcmd:
- systemctl restart sshd - systemctl restart sshd
- touch /etc/cloud/cloud-init.disabled - touch /etc/cloud/cloud-init.disabled
# ubuntu 镜像运行 echo -e '\nDone' -e 会被显示出来 # 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' keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8 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 # 提取 extra.confhome extra.mirrorlist extra.main_disk
prefix=extra prefix=extra
for var in $(grep -o "\b$prefix\.[^ ]*" /proc/cmdline | xargs); do 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 done
get_all_disks() { get_all_disks() {
@ -69,7 +69,8 @@ echo "ignoredisk --only-use=$(get_xda)" >$include
# 设置 tty # 设置 tty
include=/tmp/include-bootloader 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 echo "bootloader --append=\"$console_cmdline\"" >$include
# 有 installer 分区,表示用了两步安装 # 有 installer 分区,表示用了两步安装
@ -79,7 +80,7 @@ if [ -e /dev/disk/by-label/installer ]; then
# 1g内存下安装器默认开启了zram 但安装f38还是不够内存 # 1g内存下安装器默认开启了zram 但安装f38还是不够内存
# 具体表现为不断重启安装界面所以还要开启swap # 具体表现为不断重启安装界面所以还要开启swap
ram_size=$(lsmem -b 2>/dev/null | grep 'Total online memory:' | awk '{ print $NF/1024/1024 }') 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 mount /dev/disk/by-label/installer /run/install/repo -o remount,rw
swapfile=/run/install/repo/swapfile swapfile=/run/install/repo/swapfile
if command -v fallocate; then if command -v fallocate; then
@ -169,11 +170,11 @@ if [ -e /dev/disk/by-label/installer ]; then
# 提取 extra.localtest extra.confhome extra.mirrorlist # 提取 extra.localtest extra.confhome extra.mirrorlist
prefix=extra prefix=extra
for var in $(grep -o "\b$prefix\.[^ ]*" /proc/cmdline | xargs); do 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 done
cd / cd /
curl -O $confhome/resize.sh curl -O "$confhome/resize.sh"
echo '@reboot root bash /resize.sh' >/etc/cron.d/resize echo '@reboot root bash /resize.sh' >/etc/cron.d/resize
fi fi
%end %end

View File

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

View File

@ -511,7 +511,7 @@ del_invalid_efi_entry() {
while read -r line; do while read -r line; do
part_uuid=$(echo "$line" | awk -F ',' '{print $3}') part_uuid=$(echo "$line" | awk -F ',' '{print $3}')
efi_index=$(echo "$line" | grep_efi_index) 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" echo "Delete invalid EFI Entry: $line"
efibootmgr --quiet --bootnum "$efi_index" --delete-bootnum efibootmgr --quiet --bootnum "$efi_index" --delete-bootnum
fi fi
@ -2346,6 +2346,8 @@ EOF
} }
EOF EOF
fi fi
cat "$grub_cfg"
} }
# 脚本入口 # 脚本入口