mirror of
https://github.com/bin456789/reinstall.git
synced 2025-12-10 07:28:56 +08:00
opensuse: 添加 16.0
This commit is contained in:
19
README.en.md
19
README.en.md
@ -56,7 +56,7 @@ The system requirements for the target system are as follows:
|
||||
| <img width="16" height="16" src="https://www.centos.org/assets/icons/favicon.svg" /> CentOS Stream | 9, 10 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 41, 42 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.openeuler.org/favicon.ico" /> openEuler | 20.03 LTS - 24.03 LTS, 25.09 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | Leap 15.6, Tumbleweed (Rolling) | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | Leap 15.6, 16.0, Tumbleweed (Rolling) | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://nixos.org/favicon.svg" /> NixOS | 25.05 | 512 MB | 5 GB |
|
||||
| <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | Rolling | 512 MB | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | Rolling | 512 MB | 5 GB |
|
||||
@ -162,8 +162,8 @@ bash reinstall.sh anolis 7|8|23
|
||||
fedora 41|42
|
||||
nixos 25.05
|
||||
debian 9|10|11|12|13
|
||||
opensuse 15.6|tumbleweed
|
||||
alpine 3.19|3.20|3.21|3.22
|
||||
opensuse 15.6|16.0|tumbleweed
|
||||
openeuler 20.03|22.03|24.03|25.09
|
||||
ubuntu 16.04|18.04|20.04|22.04|24.04|25.10 [--minimal]
|
||||
kali
|
||||
@ -547,6 +547,21 @@ Log in to the server using Remote Desktop, open Device Manager, locate the graph
|
||||
- `--ssh-key /path/to/public_key`
|
||||
- `--ssh-key C:\path\to\public_key`
|
||||
|
||||
## How to Use an Old Version
|
||||
|
||||
According to the Law of Bug Conservation, fixing old bugs often introduces new ones.
|
||||
|
||||
If you encounter such a situation, you can try using an older version.
|
||||
|
||||
Go to <https://github.com/bin456789/reinstall/commits/main> and find the old version’s `commit_id` on the right side.
|
||||
|
||||
```bash
|
||||
commit_id=xxxxxxx
|
||||
curl -O https://raw.githubusercontent.com/bin456789/reinstall/$commit_id/reinstall.sh || wget -O ${_##*/} $_
|
||||
sed -i "/^confhome.*main$/s/main/$commit_id/" reinstall.sh
|
||||
bash reinstall.sh ...
|
||||
```
|
||||
|
||||
## How to Modify the Script for Your Own
|
||||
|
||||
1. Fork this repository.
|
||||
|
||||
19
README.md
19
README.md
@ -56,7 +56,7 @@
|
||||
| <img width="16" height="16" src="https://www.centos.org/assets/icons/favicon.svg" /> CentOS Stream | 9, 10 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 41, 42 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.openeuler.org/favicon.ico" /> openEuler | 20.03 LTS - 24.03 LTS, 25.09 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | Leap 15.6, Tumbleweed (滚动) | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | Leap 15.6, 16.0, Tumbleweed (滚动) | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://nixos.org/favicon.svg" /> NixOS | 25.05 | 512 MB | 5 GB |
|
||||
| <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | 滚动 | 512 MB | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | 滚动 | 512 MB | 5 GB |
|
||||
@ -162,8 +162,8 @@ bash reinstall.sh anolis 7|8|23
|
||||
fedora 41|42
|
||||
nixos 25.05
|
||||
debian 9|10|11|12|13
|
||||
opensuse 15.6|tumbleweed
|
||||
alpine 3.19|3.20|3.21|3.22
|
||||
opensuse 15.6|16.0|tumbleweed
|
||||
openeuler 20.03|22.03|24.03|25.09
|
||||
ubuntu 16.04|18.04|20.04|22.04|24.04|25.10 [--minimal]
|
||||
kali
|
||||
@ -547,6 +547,21 @@ Windows Server 2025 SERVERDATACENTER
|
||||
- `--ssh-key /path/to/public_key`
|
||||
- `--ssh-key C:\path\to\public_key`
|
||||
|
||||
## 如何使用旧版本
|
||||
|
||||
根据 Bug 守恒定律,修复旧 Bug 的同时会引入新的 Bug
|
||||
|
||||
如果遇到这种情况,可以尝试使用旧版本
|
||||
|
||||
从 <https://github.com/bin456789/reinstall/commits/main> 右侧找到旧版本的 `commit_id`
|
||||
|
||||
```bash
|
||||
commit_id=xxxxxxx
|
||||
curl -O https://raw.githubusercontent.com/bin456789/reinstall/$commit_id/reinstall.sh || wget -O ${_##*/} $_
|
||||
sed -i "/^confhome.*main$/s/main/$commit_id/" reinstall.sh
|
||||
bash reinstall.sh ...
|
||||
```
|
||||
|
||||
## 如何修改脚本自用
|
||||
|
||||
1. Fork 本仓库
|
||||
|
||||
27
reinstall.sh
27
reinstall.sh
@ -54,10 +54,10 @@ Usage: $reinstall_____ anolis 7|8|23
|
||||
fedora 41|42
|
||||
nixos 25.05
|
||||
debian 9|10|11|12|13
|
||||
opensuse 15.6|tumbleweed
|
||||
alpine 3.19|3.20|3.21|3.22
|
||||
opensuse 15.6|16.0|tumbleweed
|
||||
openeuler 20.03|22.03|24.03|25.09
|
||||
ubuntu 16.04|18.04|20.04|22.04|24.04|25.04 [--minimal]
|
||||
ubuntu 16.04|18.04|20.04|22.04|24.04|25.10 [--minimal]
|
||||
kali
|
||||
arch
|
||||
gentoo
|
||||
@ -1436,26 +1436,17 @@ Continue?
|
||||
else
|
||||
# leap
|
||||
dir=distribution/leap/$releasever/appliances
|
||||
if [ "$releasever" = 15.6 ]; then
|
||||
file=openSUSE-Leap-$releasever-Minimal-VM.$basearch-Cloud.qcow2
|
||||
case "$releasever" in
|
||||
15.6) file=openSUSE-Leap-$releasever-Minimal-VM.$basearch-Cloud.qcow2 ;;
|
||||
# 16.0) file=Leap-$releasever-Minimal-VM.$basearch-Cloud.qcow2 ;; # 缺少 openSUSE-repos-Leap 包,导致没有源
|
||||
16.0) file=Leap-$releasever-Minimal-VM.$basearch-kvm$(if [ "$basearch" = x86_64 ]; then echo '-and-xen'; fi).qcow2 ;;
|
||||
esac
|
||||
|
||||
# https://src.opensuse.org/openSUSE/Leap-Images/src/branch/leap-16.0/kiwi-templates-Minimal/Minimal.kiwi
|
||||
# https://build.opensuse.org/projects/Virtualization:Appliances:Images:openSUSE-Leap-15.6/packages/kiwi-templates-Minimal/files/Minimal.kiwi
|
||||
# https://build.opensuse.org/projects/Virtualization:Appliances:Images:openSUSE-Tumbleweed/packages/kiwi-templates-Minimal/files/Minimal.kiwi
|
||||
# 有专门的kvm镜像,openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2,里面没有cloud-init
|
||||
# file=openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2
|
||||
else
|
||||
# https://src.opensuse.org/openSUSE/Leap/raw/branch/16.0/Leap/Leap.kiwi
|
||||
# Default 比 Base 多了以下组件
|
||||
# <namedCollection name="salt_minion" />
|
||||
# <package name="patterns-base-salt_minion" />
|
||||
# <namedCollection name="kvm_host" />
|
||||
# <package name="patterns-base-kvm_host" />
|
||||
# <package name="lzop" />
|
||||
# <package name="wpa_supplicant" arch="x86_64,aarch64" />
|
||||
# <package name="k3s-install" />
|
||||
|
||||
# file=Leap.x86_64-Default.raw.xz
|
||||
file=Leap.x86_64-Base.raw.xz
|
||||
fi
|
||||
fi
|
||||
eval ${step}_img=$mirror/$dir/$file
|
||||
}
|
||||
|
||||
41
trans.sh
41
trans.sh
@ -3277,6 +3277,9 @@ disable_jeos_firstboot() {
|
||||
# 服务不存在时会报错
|
||||
chroot $os_dir systemctl disable "$name.service" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# 可选
|
||||
# chroot $os_dir zypper remove -y -u jeos-firstboot
|
||||
}
|
||||
|
||||
create_network_manager_config() {
|
||||
@ -3544,7 +3547,7 @@ EOF
|
||||
fi
|
||||
|
||||
# opensuse
|
||||
# 1. kernel-default-base 缺少 nvme 驱动,换成 kernel-default
|
||||
# 1. kernel-default-base 缺少 nvme gve mlx5 mana 驱动,换成 kernel-default
|
||||
# 2. 添加微码+固件
|
||||
# https://documentation.suse.com/smart/virtualization-cloud/html/minimal-vm/index.html
|
||||
if grep -q opensuse $os_dir/etc/os-release; then
|
||||
@ -3556,11 +3559,6 @@ EOF
|
||||
|
||||
disable_jeos_firstboot $os_dir
|
||||
|
||||
# 16.0 需要安装 openssh
|
||||
if ! chroot $os_dir rpm -qi openssh-server; then
|
||||
chroot $os_dir zypper install -y openssh-server
|
||||
fi
|
||||
|
||||
# 禁用 selinux
|
||||
disable_selinux $os_dir
|
||||
|
||||
@ -3634,23 +3632,19 @@ EOF
|
||||
error_and_exit "Unexpected kernel installed: $installed_kernel"
|
||||
fi
|
||||
|
||||
# 15.6 / tumbleweed 自带的是 kernel-default-base
|
||||
# 16.0 自带的是 kernel-default
|
||||
# 不能同时装 kernel-default-base 和 kernel-default
|
||||
|
||||
# 因此需要添加 --force-resolution 自动删除 kernel-default-base
|
||||
if ! [ "$installed_kernel" = "$target_kernel" ]; then
|
||||
chroot $os_dir zypper remove -y -u $installed_kernel
|
||||
|
||||
# x86 必须设置一个密码,否则报错,arm 没有这个问题
|
||||
# Failed to get root password hash
|
||||
# Failed to import /etc/uefi/certs/76B6A6A0.crt
|
||||
# warning: %post(kernel-default-5.14.21-150500.55.83.1.x86_64) scriptlet failed, exit status 255
|
||||
if grep -q '^root:[:!*]' $os_dir/etc/shadow; then
|
||||
echo "root:$(mkpasswd '')" | chroot $os_dir chpasswd -e
|
||||
chroot $os_dir zypper install -y $target_kernel
|
||||
chroot $os_dir zypper install -y --force-resolution $target_kernel
|
||||
chroot $os_dir passwd -d root
|
||||
else
|
||||
chroot $os_dir zypper install -y $target_kernel
|
||||
chroot $os_dir zypper install -y --force-resolution $target_kernel
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -3861,23 +3855,22 @@ change_ssh_conf() {
|
||||
value=$3
|
||||
sub_conf=$4
|
||||
|
||||
if line="^$key .*" && grep -Exq "$line" $os_dir/etc/ssh/sshd_config; then
|
||||
if line="^$key .*" && grep -Exq "$line" $os_dir/etc/ssh/sshd_config 2>/dev/null; then
|
||||
# 如果 sshd_config 存在此 key(非注释状态),则替换
|
||||
sed -Ei "s/$line/$key $value/" $os_dir/etc/ssh/sshd_config
|
||||
elif {
|
||||
elif include_line='^Include.*/etc/ssh/sshd_config.d' &&
|
||||
# arch 没有 /etc/ssh/sshd_config.d/ 文件夹
|
||||
# opensuse tumbleweed 没有 /etc/ssh/sshd_config
|
||||
# 有 /etc/ssh/sshd_config.d/ 文件夹
|
||||
# 有 /usr/etc/ssh/sshd_config
|
||||
grep -q 'Include.*/etc/ssh/sshd_config.d' $os_dir/etc/ssh/sshd_config ||
|
||||
grep -q '^Include.*/etc/ssh/sshd_config.d/' $os_dir/usr/etc/ssh/sshd_config
|
||||
} 2>/dev/null; then
|
||||
{ grep -q "$include_line" $os_dir/etc/ssh/sshd_config ||
|
||||
grep -q "$include_line" $os_dir/usr/etc/ssh/sshd_config; } 2>/dev/null; then
|
||||
mkdir -p $os_dir/etc/ssh/sshd_config.d/
|
||||
echo "$key $value" >"$os_dir/etc/ssh/sshd_config.d/$sub_conf"
|
||||
else
|
||||
# 如果 sshd_config 存在此 key (无论是否已注释),则替换,包括删除注释
|
||||
# 否则追加
|
||||
line="^#?$key .*"
|
||||
line="^[# ]*$key .*"
|
||||
if grep -Exq "$line" $os_dir/etc/ssh/sshd_config; then
|
||||
sed -Ei "s/$line/$key $value/" $os_dir/etc/ssh/sshd_config
|
||||
else
|
||||
@ -3894,7 +3887,17 @@ allow_password_login() {
|
||||
allow_root_password_login() {
|
||||
os_dir=$1
|
||||
|
||||
# opensuse 16/tumbleweed 安装 openssh-server-config-rootlogin
|
||||
# 会生成 /usr/etc/ssh/sshd_config.d/50-permit-root-login.conf
|
||||
# 但是如果用户删除了此文件,包有更新的话,可能会重新创建这个文件?
|
||||
# 因此先不用这个方法
|
||||
if false && [ -f $os_dir/etc/os-release ] &&
|
||||
grep -iq opensuse $os_dir/etc/os-release &&
|
||||
! grep -iq 15.6 $os_dir/etc/os-release; then
|
||||
chroot $os_dir zypper install -y openssh-server-config-rootlogin
|
||||
else
|
||||
change_ssh_conf "$os_dir" PermitRootLogin yes 01-permitrootlogin.conf
|
||||
fi
|
||||
}
|
||||
|
||||
change_ssh_port() {
|
||||
|
||||
Reference in New Issue
Block a user