diff --git a/alpine-network.sh b/alpine-network.sh index 8514ebb..f1df98b 100644 --- a/alpine-network.sh +++ b/alpine-network.sh @@ -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 } diff --git a/cloud-init.yaml b/cloud-init.yaml index 8107be2..5462d65 100644 --- a/cloud-init.yaml +++ b/cloud-init.yaml @@ -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 diff --git a/redhat.cfg b/redhat.cfg index fda08cf..e3fc7db 100644 --- a/redhat.cfg +++ b/redhat.cfg @@ -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 }' $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 diff --git a/reinstall.sh b/reinstall.sh index 16dbfe6..fc16cc4 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -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 diff --git a/trans.sh b/trans.sh index fbb89dc..0e4caaa 100644 --- a/trans.sh +++ b/trans.sh @@ -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" } # 脚本入口