core: 不重要的更改

- 更优雅地 overwrite windows 命令
- 更改 openSUSE 源
- 删除 wicked 网卡配置的 cloud-init 注释
This commit is contained in:
bin456789
2025-03-10 22:23:37 +08:00
parent 243bdb0831
commit 27b571408d
4 changed files with 28 additions and 8 deletions

View File

@@ -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)
<!-- [![Lines of Code](https://aschey.tech/tokei/github/bin456789/reinstall?category=code&label=Lines%20of%20Code&style=flat-square)](https://github.com/aschey/vercel-tokei) -->
One-Click Script to Reinstall System [中文](README.md)

View File

@@ -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)
<!-- [![Lines of Code](https://aschey.tech/tokei/github/bin456789/reinstall?category=code&label=Lines%20of%20Code&style=flat-square)](https://github.com/aschey/vercel-tokei) -->
一键重装脚本 [English](README.en.md)

View File

@@ -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

View File

@@ -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/