From 605b0b4a950c13ea9c3790d511c6cd6e7cfb57cc Mon Sep 17 00:00:00 2001 From: bin456789 Date: Mon, 20 Jan 2025 14:31:41 +0800 Subject: [PATCH] =?UTF-8?q?openeuler:=20=E4=BF=AE=E5=A4=8D=E6=9C=AA?= =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E7=BD=91=E7=BB=9C=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E7=BD=91=E5=8D=A1=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 2 +- README.md | 2 +- fix-eth-name.sh | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.en.md b/README.en.md index 22ebcf8..fa5fd78 100644 --- a/README.en.md +++ b/README.en.md @@ -116,7 +116,7 @@ certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/ ### Feature 1: Install Linux -- The username is `root` with a default password of `123@@@`. It may take a few minutes after the first boot to successfully log in. +- The username is `root` with a default password of `123@@@`. - When installing the latest version, the version number does not need to be specified. - Maximizes disk space usage: no boot partition (except for Fedora) and no swap partition. - Automatically selects different optimized kernels based on machine type, such as `Cloud` or `HWE` kernels. diff --git a/README.md b/README.md index 8884eba..a71a747 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/ ### 功能 1: 安装 Linux -- 用户名 `root` 默认密码 `123@@@`,首次开机可能要等几分钟才能成功登录 +- 用户名 `root` 默认密码 `123@@@` - 安装最新版可不输入版本号 - 最大化利用磁盘空间:不含 boot 分区(Fedora 例外),不含 swap 分区 - 自动根据机器类型选择不同的优化内核,例如 `Cloud`、`HWE` 内核 diff --git a/fix-eth-name.sh b/fix-eth-name.sh index aa13398..6d22fc4 100644 --- a/fix-eth-name.sh +++ b/fix-eth-name.sh @@ -5,6 +5,9 @@ set -eE +# openeuler 需等待 udev 将网卡名从 eth0 改为 enp3s0 +sleep 10 + # 本脚本在首次进入新系统后运行 # 将 trans 阶段生成的网络配置中的网卡名(eth0) 改为正确的网卡名,也适用于以下情况 # 1. alpine 要运行此脚本,因为安装后的内核可能有 netboot 没有的驱动 @@ -19,8 +22,7 @@ to_lower() { retry() { local max_try=$1 - local interval=$2 - shift 2 + shift for i in $(seq "$max_try"); do if "$@"; then @@ -30,7 +32,7 @@ retry() { if [ "$i" -ge "$max_try" ]; then return $ret fi - sleep "$interval" + sleep 1 fi done } @@ -40,7 +42,7 @@ retry() { # 因此需要等待网卡出现 get_ethx_by_mac() { mac=$(echo "$1" | to_lower) - retry 10 0.5 _get_ethx_by_mac "$mac" + retry 10 _get_ethx_by_mac "$mac" } _get_ethx_by_mac() { @@ -218,7 +220,7 @@ fix_netplan() { fix_systemd_networkd() { for file in /etc/systemd/network/10-cloud-init-eth*.network; do [ -f "$file" ] || continue - mac=$(grep ^MACAddress= $file | cut -d= -f2 | grep .) || continue + mac=$(grep ^MACAddress= "$file" | cut -d= -f2 | grep .) || continue ethx=$(get_ethx_by_mac "$mac") || continue proper_file=/etc/systemd/network/10-$ethx.network