mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 04:49:13 +08:00
opensuse: 支持 tumbleweed
This commit is contained in:
parent
7405a7f242
commit
4159e60438
17
README.md
17
README.md
@ -9,6 +9,7 @@
|
|||||||
- 支持使用官方 iso 重装到 Windows (不支持 ARM)
|
- 支持使用官方 iso 重装到 Windows (不支持 ARM)
|
||||||
- 支持从 Windows 重装到 Linux
|
- 支持从 Windows 重装到 Linux
|
||||||
- 原系统分区支持 lvm / btrfs
|
- 原系统分区支持 lvm / btrfs
|
||||||
|
- 自动选择国内外安装源
|
||||||
- 使用 dd 或云镜像时有高贵的进度条,可通过 ssh/vnc/web/串行控制台 查看
|
- 使用 dd 或云镜像时有高贵的进度条,可通过 ssh/vnc/web/串行控制台 查看
|
||||||
- 有很多注释
|
- 有很多注释
|
||||||
|
|
||||||
@ -21,14 +22,14 @@
|
|||||||
curl -O https://ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
|
curl -O https://ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
|
||||||
|
|
||||||
### 安装 Linux:
|
### 安装 Linux:
|
||||||
bash reinstall.sh centos-7/8/9 (centos-8/9 为 stream 版本)
|
bash reinstall.sh centos 7|8|9 (8|9 为 stream 版本)
|
||||||
alma-8/9
|
alma 8|9
|
||||||
rocky-8/9
|
rocky 8|9
|
||||||
fedora-37/38
|
fedora 37|38
|
||||||
ubuntu-20.04/22.04
|
debian 10|11|12
|
||||||
alpine-3.16/3.17/3.18
|
ubuntu 20.04|22.04
|
||||||
debian-10/11/12
|
alpine 3.16|3.17|3.18
|
||||||
opensuse-15.4/15.5 (只支持云镜像)
|
opensuse 15.4|15.5|tumbleweed (只支持云镜像)
|
||||||
arch (只支持云镜像)
|
arch (只支持云镜像)
|
||||||
|
|
||||||
可选参数: --ci 强制使用云镜像
|
可选参数: --ci 强制使用云镜像
|
||||||
|
@ -17,7 +17,8 @@ chpasswd:
|
|||||||
type: text
|
type: text
|
||||||
runcmd:
|
runcmd:
|
||||||
# arch 没有 /etc/ssh/sshd_config.d/ 文件夹
|
# arch 没有 /etc/ssh/sshd_config.d/ 文件夹
|
||||||
- echo "PermitRootLogin yes" >/etc/ssh/sshd_config.d/01-permitrootlogin.conf || echo "PermitRootLogin yes" >>/etc/ssh/sshd_config
|
# opensuse tumbleweed 有 /etc/ssh/sshd_config.d/ 文件夹,但没有 /etc/ssh/sshd_config,但有/usr/etc/ssh/sshd_config
|
||||||
|
- grep 'Include.*/etc/ssh/sshd_config.d' /etc/sshd_config && echo "PermitRootLogin yes" >/etc/ssh/sshd_config.d/01-permitrootlogin.conf || echo "PermitRootLogin yes" >>/etc/ssh/sshd_config
|
||||||
- systemctl restart sshd
|
- systemctl restart sshd
|
||||||
# ubuntu 镜像运行 echo -e '\nDone' ,-e 会被显示出来
|
# ubuntu 镜像运行 echo -e '\nDone' ,-e 会被显示出来
|
||||||
- echo >/dev/tty0
|
- echo >/dev/tty0
|
||||||
|
65
reinstall.sh
65
reinstall.sh
@ -8,17 +8,17 @@ this_script=$(realpath $0)
|
|||||||
|
|
||||||
usage_and_exit() {
|
usage_and_exit() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: reinstall.sh centos-7/8/9
|
Usage: reinstall.sh centos 7|8|9
|
||||||
alma-8/9
|
alma 8|9
|
||||||
rocky-8/9
|
rocky 8|9
|
||||||
fedora-37/38
|
fedora 37|38
|
||||||
ubuntu-20.04/22.04
|
debian 10|11|12
|
||||||
alpine-3.16/3.17/3.18
|
ubuntu 20.04|22.04
|
||||||
debian-10/11/12
|
alpine 3.16|3.17|3.18
|
||||||
opensuse-15.4/15.5
|
opensuse 15.4|15.5|tumbleweed
|
||||||
arch
|
arch
|
||||||
windows --iso=xxx --image-name=xxx
|
|
||||||
dd --img=xxx
|
dd --img=xxx
|
||||||
|
windows --iso=xxx --image-name=xxx
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -330,27 +330,44 @@ setos() {
|
|||||||
|
|
||||||
setos_opensuse() {
|
setos_opensuse() {
|
||||||
cloud_image=1
|
cloud_image=1
|
||||||
if grep -iq Tumbleweed <<<"$releasever"; then
|
|
||||||
dir=tumbleweed
|
# aria2 有 mata4 问题
|
||||||
releasever=Tumbleweed
|
# https://download.opensuse.org/
|
||||||
|
|
||||||
|
# 清华源缺少 aarch64 tumbleweed appliances
|
||||||
|
# https://mirrors.tuna.tsinghua.edu.cn/opensuse/ports/aarch64/tumbleweed/appliances/
|
||||||
|
# https://mirrors.nju.edu.cn/opensuse/ports/aarch64/tumbleweed/appliances/
|
||||||
|
|
||||||
|
if is_in_china; then
|
||||||
|
mirror=https://mirrors.nju.edu.cn/opensuse
|
||||||
else
|
else
|
||||||
if ! grep -q '\.' <<<"$releasever"; then
|
mirror=https://mirror.fcix.net/opensuse
|
||||||
releasever=$(curl https://download.opensuse.org/download/distribution/leap/?json |
|
|
||||||
grep -oP "(?<=\"name\":\")$releasever\.[0-9]*" | tail -1)
|
|
||||||
fi
|
fi
|
||||||
dir=distribution/leap/$releasever
|
|
||||||
|
if grep -iq Tumbleweed <<<"$releasever"; then
|
||||||
|
# Tumbleweed
|
||||||
|
releasever=Tumbleweed
|
||||||
|
if [ "$basearch" = aarch64 ]; then
|
||||||
|
dir=ports/aarch64/tumbleweed/appliances
|
||||||
|
else
|
||||||
|
dir=tumbleweed/appliances
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# 常规版本
|
||||||
|
# 如果用户输入的版本号是 15,需要查询小版本号
|
||||||
|
if ! grep -q '\.' <<<"$releasever"; then
|
||||||
|
releasever=$(curl -L https://download.opensuse.org/download/distribution/openSUSE-stable/appliances/boxes/?json |
|
||||||
|
grep -oP "(?<=\"name\":\"Leap-)$releasever\.[0-9]*" | head -1)
|
||||||
|
fi
|
||||||
|
if [ "$releasever" = 15.4 ]; then
|
||||||
|
openstack=-OpenStack
|
||||||
|
fi
|
||||||
|
dir=distribution/leap/$releasever/appliances
|
||||||
releasever=Leap-$releasever
|
releasever=Leap-$releasever
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cloud image
|
|
||||||
# 有专门的kvm镜像,openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2,但里面没有cloud-init
|
# 有专门的kvm镜像,openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2,但里面没有cloud-init
|
||||||
# TODO: aria2 mata4问题
|
eval ${step}_img=$mirror/$dir/openSUSE-$releasever-Minimal-VM.$basearch$openstack-Cloud.qcow2
|
||||||
# TODO: Tumbleweed 网络问题/ssh主文件incloud子目录问题
|
|
||||||
if grep -q 15\.4 <<<"$releasever"; then
|
|
||||||
openstack=-OpenStack
|
|
||||||
fi
|
|
||||||
eval ${step}_img=https://mirror.fcix.net/opensuse/$dir/appliances/openSUSE-$releasever-Minimal-VM.$basearch$openstack-Cloud.qcow2
|
|
||||||
# eval ${step}_img=https://download.opensuse.org/$dir/appliances/openSUSE-$releasever-Minimal-VM.$basearch-Cloud.qcow2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setos_windows() {
|
setos_windows() {
|
||||||
|
6
trans.sh
6
trans.sh
@ -714,10 +714,16 @@ modify_dd_os() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
download_cloud_init_config $os_dir
|
download_cloud_init_config $os_dir
|
||||||
|
|
||||||
if [ -f $os_dir/etc/redhat-release ]; then
|
if [ -f $os_dir/etc/redhat-release ]; then
|
||||||
find_and_mount /boot
|
find_and_mount /boot
|
||||||
find_and_mount /boot/efi
|
find_and_mount /boot/efi
|
||||||
disable_selinux_kdump $os_dir
|
disable_selinux_kdump $os_dir
|
||||||
|
elif grep opensuse-tumbleweed $os_dir/etc/os-release; then
|
||||||
|
cp -f /etc/resolv.conf $os_dir/etc/resolv.conf
|
||||||
|
mount_pseudo_fs $os_dir
|
||||||
|
chroot $os_dir zypper install -y wicked
|
||||||
|
rm -f $os_dir/etc/resolv.conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user