From 27b571408dac39cf4127d9c939f68745dd65dfdb Mon Sep 17 00:00:00 2001 From: bin456789 Date: Mon, 10 Mar 2025 22:23:37 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E4=B8=8D=E9=87=8D=E8=A6=81=E7=9A=84?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更优雅地 overwrite windows 命令 - 更改 openSUSE 源 - 删除 wicked 网卡配置的 cloud-init 注释 --- README.en.md | 1 - README.md | 1 - reinstall.sh | 21 +++++++++++++++------ trans.sh | 13 +++++++++++++ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/README.en.md b/README.en.md index 07b7d39..5f146fc 100644 --- a/README.en.md +++ b/README.en.md @@ -7,7 +7,6 @@ [![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code&label=Lines%20of%20Code&style=flat-square)](https://github.com/XAMPPRocky/tokei) [![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=flat-square&logo=telegram&logoColor=white)](https://t.me/reinstall_os) [![Github Sponsors](https://img.shields.io/badge/sponsor-30363D?style=flat-square&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/bin456789) - One-Click Script to Reinstall System [中文](README.md) diff --git a/README.md b/README.md index 0b4a1d9..6d6f69e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ [![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code&label=Lines%20of%20Code&style=flat-square)](https://github.com/XAMPPRocky/tokei) [![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=flat-square&logo=telegram&logoColor=white)](https://t.me/reinstall_os) [![Github Sponsors](https://img.shields.io/badge/sponsor-30363D?style=flat-square&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/bin456789) - 一键重装脚本 [English](README.en.md) diff --git a/reinstall.sh b/reinstall.sh index 702a3c3..683f63a 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -488,15 +488,14 @@ run_with_del_cr() { } run_with_del_cr_template() { - # 调用链:wmic() -> run_with_del_cr(wmic) -> _wmic() -> command wmic - if command -v _$exe >/dev/null; then + if get_function _$exe >/dev/null; then run_with_del_cr _$exe "$@" else run_with_del_cr command $exe "$@" fi } -_wmic() { +wmic() { if is_have_cmd wmic; then # 如果参数没有 GET,添加 GET,防止以下报错 # wmic memorychip /format:list @@ -1343,8 +1342,12 @@ Continue? } setos_opensuse() { - # aria2 有 mata4 问题 # https://download.opensuse.org/ + # curl 会跳转到最近的镜像源,但可能会被镜像源 block + # aria2 会跳转使用 metalink + + # https://downloadcontent.opensuse.org # 德国 + # https://downloadcontentcdn.opensuse.org # fastly cdn # 很多国内源缺少 aarch64 tumbleweed appliances # https://download.opensuse.org/ports/aarch64/tumbleweed/appliances/ @@ -1354,7 +1357,7 @@ Continue? if is_in_china; then mirror=https://mirror.nju.edu.cn/opensuse else - mirror=https://ftp.gwdg.de/pub/opensuse + mirror=https://downloadcontentcdn.opensuse.org fi if [ "$releasever" = tumbleweed ]; then @@ -2667,7 +2670,7 @@ install_grub_linux_efi() { if is_in_china; then mirror=https://mirror.nju.edu.cn/opensuse else - mirror=https://ftp.gwdg.de/pub/opensuse + mirror=https://downloadcontentcdn.opensuse.org fi [ "$basearch" = x86_64 ] && ports='' || ports=/ports/$basearch @@ -3611,6 +3614,12 @@ if is_in_windows; then # 为 windows 程序输出删除 cr for exe in $WINDOWS_EXES; do + # 如果我们覆写了 wmic(),则先将 wmic() 重命名为 _wmic() + if get_function $exe >/dev/null 2>&1; then + eval "_$(get_function $exe)" + fi + # 使用以下方法重新生成 wmic() + # 调用链:wmic() -> run_with_del_cr(wmic) -> _wmic() -> command wmic eval "$exe(){ $(get_function_content run_with_del_cr_template | sed "s/\$exe/$exe/g") }" done fi diff --git a/trans.sh b/trans.sh index 25eeb73..fb450dc 100644 --- a/trans.sh +++ b/trans.sh @@ -3347,6 +3347,11 @@ EOF chroot $os_dir cloud-init devel net-convert \ -p /net.cfg -k yaml -d out -D opensuse -O sysconfig + # 删除 + # Created by cloud-init on instance boot automatically, do not edit. + # + sed -i '/^#/d' "$os_dir/out/etc/sysconfig/network/ifcfg-eth"* + for ethx in $(get_eths); do # 1. 修复甲骨文云重启后 ipv6 丢失 # https://github.com/openSUSE/wicked/issues/1058 @@ -5642,6 +5647,14 @@ EOF # 2012 9.3.0 # 2008 (r2) 7.2.0.1555 + # 9.3.1 + # https://downloads.xenserver.com/vm-tools-windows/9.3.1/managementagentx64.msi + # http://downloadns.citrix.com.edgesuite.net/17461/managementagentx64.msi + + # 7.2.0.1555 + # http://downloadns.citrix.com.edgesuite.net/14656/managementagentx64.msi + # http://downloadns.citrix.com.edgesuite.net/14655/managementagentx86.msi + # xen # 没签名,暂时用aws的驱动代替 # https://lore.kernel.org/xen-devel/E1qKMmq-00035B-SS@xenbits.xenproject.org/