mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-18 20:39:14 +08:00
core: 删除 centos 7, oracle 7, debain 10
This commit is contained in:
parent
645f7476d3
commit
f316acfd27
4
.github/workflows/run_reinstall.yml
vendored
4
.github/workflows/run_reinstall.yml
vendored
@ -22,12 +22,13 @@ jobs:
|
||||
git config --global core.autocrlf false
|
||||
- uses: actions/checkout@v4
|
||||
- run: |
|
||||
${{ matrix.command }} centos 7
|
||||
${{ matrix.command }} centos
|
||||
${{ matrix.command }} alma-8
|
||||
${{ matrix.command }} rocky 9
|
||||
${{ matrix.command }} fedora
|
||||
${{ matrix.command }} ubuntu
|
||||
${{ matrix.command }} debian
|
||||
${{ matrix.command }} debian --ci
|
||||
${{ matrix.command }} kali
|
||||
${{ matrix.command }} alpine
|
||||
${{ matrix.command }} opensuse
|
||||
@ -36,6 +37,7 @@ jobs:
|
||||
|
||||
${{ matrix.command }} netboot.xyz
|
||||
${{ matrix.command }} dd --img=https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-SelfInstall.raw.xz
|
||||
${{ matrix.command }} windows --image-name='Windows 11 Pro'
|
||||
|
||||
# 测试失败例子
|
||||
# ${{ matrix.command }} wrong-os
|
||||
|
54
README.en.md
54
README.en.md
@ -11,7 +11,7 @@ Reinstall server with one-click [中文](README.md)
|
||||
|
||||
## Highlights
|
||||
|
||||
- Support installation of 12 common Linux distributions.
|
||||
- Support installation of 13 common Linux distributions.
|
||||
- Support for installing Windows using the official original ISO. The script can automatically search for the ISO and drivers.
|
||||
- Support reinstallation in any direction, meaning `Linux to Linux`, `Linux to Win`, `Win to Win`, `Win to Linux`.
|
||||
- Specifically tailored for low-spec machines, addressing insufficient memory that prevents network installation.
|
||||
@ -22,23 +22,21 @@ Reinstall server with one-click [中文](README.md)
|
||||
|
||||
## System Requirements
|
||||
|
||||
| Target System | Version | Memory | Disk |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ---------------------- |
|
||||
| <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB |
|
||||
| <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://github.com/bin456789/reinstall/assets/7548515/f74b3d5b-085f-4df3-bcc9-8a9bd80bb16d" /> Kali | Rolling | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://netplan.readthedocs.io/en/latest/_static/favicon.png" /> Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB |
|
||||
| <img width="16" height="16" src="https://www.centos.org/assets/img/favicon.png" /> CentOS | 7, 9 (stream) | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 7, 8, 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> Alma | 8, 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky | 8, 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 39, 40 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | 15.5, 15.6, Tumbleweed (Rolling) | 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 |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | Any | 512 MB | Depending on the image |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB |
|
||||
| Target System | Version | Memory | Disk |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ---------------------- |
|
||||
| <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB |
|
||||
| <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://github.com/bin456789/reinstall/assets/7548515/f74b3d5b-085f-4df3-bcc9-8a9bd80bb16d" /> Kali | Rolling | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://netplan.readthedocs.io/en/latest/_static/favicon.png" /> Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB |
|
||||
| <img width="16" height="16" src="https://www.centos.org/assets/img/favicon.png" /> CentOS | 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.redhat.com/favicon.ico" /> RedHat <img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> Alma <img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky <img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 8, 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 39, 40 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | 15.5, 15.6, Tumbleweed (Rolling) | 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 |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | Any | 512 MB | Depending on the image |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB |
|
||||
|
||||
(\*) Indicates installation using cloud images, not traditional network installation.
|
||||
|
||||
@ -136,13 +134,19 @@ certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubuserco
|
||||
>
|
||||
> When installing other systems, can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console).
|
||||
|
||||
> [!IMPORTANT]
|
||||
> To install Red Hat, you need to provide the `qcow2` image link obtained from the following website.
|
||||
>
|
||||
> See <https://access.redhat.com/downloads/content/rhel>
|
||||
|
||||
```bash
|
||||
bash reinstall.sh centos 7|9 (9 is stream version)
|
||||
oracle 7|8|9
|
||||
bash reinstall.sh centos 9
|
||||
alma 8|9
|
||||
rocky 8|9
|
||||
oracle 8|9
|
||||
redhat 8|9 --img 'https://xxx.qcow2'
|
||||
fedora 39|40
|
||||
debian 10|11|12
|
||||
debian 11|12
|
||||
ubuntu 20.04|22.04|24.04
|
||||
alpine 3.17|3.18|3.19|3.20
|
||||
opensuse 15.5|15.6|tumbleweed
|
||||
@ -252,10 +256,10 @@ Use `Dism++` File menu > Open Image File, select the iso to be installed to get
|
||||
|
||||
- Windows (Vista ~ 11)
|
||||
- Windows Server (2008 ~ 2025)
|
||||
- Windows Server Essentials *
|
||||
- Windows Server (Semi) Annual Channel *
|
||||
- Hyper-V Server *
|
||||
- Azure Stack HCI *
|
||||
- Windows Server Essentials \*
|
||||
- Windows Server (Semi) Annual Channel \*
|
||||
- Hyper-V Server \*
|
||||
- Azure Stack HCI \*
|
||||
|
||||
\* Must specify an ISO link.
|
||||
|
||||
|
54
README.md
54
README.md
@ -11,7 +11,7 @@
|
||||
|
||||
## 亮点
|
||||
|
||||
- 支持安装 12 种常见 Linux 发行版
|
||||
- 支持安装 13 种常见 Linux 发行版
|
||||
- 支持用官方原版 iso 安装 Windows,并且脚本会自动查找 iso 和驱动
|
||||
- 支持任意方向重装,也就是支持 `Linux to Linux`、`Linux to Win`、`Win to Win`、`Win to Linux`
|
||||
- 专门适配低配小鸡,解决内存过少导致无法进行网络安装
|
||||
@ -22,23 +22,21 @@
|
||||
|
||||
## 配置要求
|
||||
|
||||
| 目标系统 | 版本 | 内存 | 硬盘 |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ------------ |
|
||||
| <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB |
|
||||
| <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://github.com/bin456789/reinstall/assets/7548515/f74b3d5b-085f-4df3-bcc9-8a9bd80bb16d" /> Kali | 滚动 | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://netplan.readthedocs.io/en/latest/_static/favicon.png" /> Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB |
|
||||
| <img width="16" height="16" src="https://www.centos.org/assets/img/favicon.png" /> CentOS | 7, 9 (stream) | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 7, 8, 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> Alma | 8, 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky | 8, 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 39, 40 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | 15.5, 15.6, Tumbleweed (滚动) | 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 |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | 任何 | 512 MB | 取决于镜像 |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB |
|
||||
| 目标系统 | 版本 | 内存 | 硬盘 |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ------------ |
|
||||
| <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB |
|
||||
| <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://github.com/bin456789/reinstall/assets/7548515/f74b3d5b-085f-4df3-bcc9-8a9bd80bb16d" /> Kali | 滚动 | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://netplan.readthedocs.io/en/latest/_static/favicon.png" /> Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB |
|
||||
| <img width="16" height="16" src="https://www.centos.org/assets/img/favicon.png" /> CentOS | 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.redhat.com/favicon.ico" /> RedHat <img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> Alma <img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky <img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 8, 9 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 39, 40 | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | 15.5, 15.6, Tumbleweed (滚动) | 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 |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | 任何 | 512 MB | 取决于镜像 |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB |
|
||||
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB |
|
||||
|
||||
(\*) 表示使用云镜像安装,非传统网络安装
|
||||
|
||||
@ -136,13 +134,19 @@ certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubuserco
|
||||
>
|
||||
> 安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 安装 Red Hat 需填写以下网站得到的 `qcow2` 镜像链接
|
||||
>
|
||||
> <https://access.redhat.com/downloads/content/rhel>
|
||||
|
||||
```bash
|
||||
bash reinstall.sh centos 7|9 (9 为 stream 版本)
|
||||
oracle 7|8|9
|
||||
bash reinstall.sh centos 9
|
||||
alma 8|9
|
||||
rocky 8|9
|
||||
oracle 8|9
|
||||
redhat 8|9 --img 'https://xxx.qcow2'
|
||||
fedora 39|40
|
||||
debian 10|11|12
|
||||
debian 11|12
|
||||
ubuntu 20.04|22.04|24.04
|
||||
alpine 3.17|3.18|3.19|3.20
|
||||
opensuse 15.5|15.6|tumbleweed
|
||||
@ -252,10 +256,10 @@ Windows Server 2022 SERVERDATACENTER
|
||||
|
||||
- Windows (Vista ~ 11)
|
||||
- Windows Server (2008 ~ 2025)
|
||||
- Windows Server Essentials *
|
||||
- Windows Server (Semi) Annual Channel *
|
||||
- Hyper-V Server *
|
||||
- Azure Stack HCI *
|
||||
- Windows Server Essentials \*
|
||||
- Windows Server (Semi) Annual Channel \*
|
||||
- Hyper-V Server \*
|
||||
- Azure Stack HCI \*
|
||||
|
||||
\* 需填写 iso 链接
|
||||
|
||||
|
@ -70,8 +70,7 @@ ${spaces}routes:
|
||||
EOF
|
||||
# 网关条目
|
||||
for gateway in $gateways; do
|
||||
|
||||
# debian 10 的 cloud-init 不支持 to: default
|
||||
# debian 11 的 netplan 不支持 to: default
|
||||
case $gateway in
|
||||
*.*) to='0.0.0.0/0' ;;
|
||||
*:*) to='::/0' ;;
|
||||
@ -82,7 +81,6 @@ ${spaces} - to: $to
|
||||
${spaces} via: $gateway
|
||||
${spaces} on-link: true
|
||||
EOF
|
||||
|
||||
done
|
||||
} | insert_into_file $conf before 'match:'
|
||||
|
||||
@ -189,7 +187,7 @@ fix_wicked_conf() {
|
||||
systemctl restart wicked
|
||||
}
|
||||
|
||||
# debian 10/11/12: netplan + networkd/resolved
|
||||
# debian 11/12: netplan + networkd/resolved
|
||||
# 23.1.1 修复
|
||||
fix_netplan_conf
|
||||
|
||||
|
@ -157,7 +157,6 @@ d-i partman/early_command string true; \
|
||||
|
||||
true >/bin/os-prober
|
||||
|
||||
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
|
||||
# kali ssh 默认关闭
|
||||
# 另一种方法处理 cloudcone
|
||||
# if [ "$link_grub_dir" = 1 ]; then mkdir /target/boot/grub2; echo 'chainloader (hd0)+1' >/target/boot/grub2/grub.cfg; fi; \
|
||||
@ -166,5 +165,4 @@ d-i preseed/late_command string true; \
|
||||
if [ "$link_grub_dir" = 1 ]; then ln -s grub /target/boot/grub2; fi; \
|
||||
|
||||
in-target systemctl enable ssh; \
|
||||
echo "PermitRootLogin yes" >/target/etc/ssh/sshd_config.d/01-permitrootlogin.conf || \
|
||||
echo "PermitRootLogin yes" >>/target/etc/ssh/sshd_config
|
||||
echo "PermitRootLogin yes" >/target/etc/ssh/sshd_config.d/01-permitrootlogin.conf
|
||||
|
46
reinstall.sh
46
reinstall.sh
@ -30,22 +30,22 @@ usage_and_exit() {
|
||||
reinstall____='./reinstall.sh'
|
||||
fi
|
||||
cat <<EOF
|
||||
Usage: $reinstall____ centos 7|9
|
||||
oracle 7|8|9
|
||||
Usage: $reinstall____ centos 9
|
||||
alma 8|9
|
||||
rocky 8|9
|
||||
oracle 8|9
|
||||
redhat 8|9 --img='http://xxx.qcow2'
|
||||
fedora 39|40
|
||||
debian 10|11|12
|
||||
debian 11|12
|
||||
ubuntu 20.04|22.04|24.04
|
||||
alpine 3.17|3.18|3.19|3.20
|
||||
opensuse 15.5|15.6|tumbleweed
|
||||
kali
|
||||
arch
|
||||
gentoo
|
||||
dd --img='http://xxx'
|
||||
dd --img='http://xxx.gzip' or .xz
|
||||
windows --image-name='windows xxx yyy' --lang=xx-yy
|
||||
windows --image-name='windows xxx yyy' --iso='http://xxx'
|
||||
windows --image-name='windows xxx yyy' --iso='http://xxx.iso'
|
||||
netboot.xyz
|
||||
|
||||
Manual: https://github.com/bin456789/reinstall
|
||||
@ -752,7 +752,6 @@ setos() {
|
||||
|
||||
setos_debian() {
|
||||
case "$releasever" in
|
||||
10) codename=buster ;;
|
||||
11) codename=bullseye ;;
|
||||
12) codename=bookworm ;;
|
||||
esac
|
||||
@ -767,9 +766,6 @@ setos() {
|
||||
if is_use_cloud_image; then
|
||||
# cloud image
|
||||
is_virt && ci_type=genericcloud || ci_type=generic
|
||||
# 甲骨文 debian 10 amd64 genericcloud vnc 没有显示
|
||||
# 甲骨文 debian 10 arm64 没有 genericcloud 镜像
|
||||
[ "$releasever" -eq 10 ] && ci_type=generic
|
||||
eval ${step}_img=$cdimage_mirror/cloud/$codename/latest/debian-$releasever-$ci_type-$basearch_alt.qcow2
|
||||
else
|
||||
# 传统安装
|
||||
@ -783,8 +779,6 @@ setos() {
|
||||
mirror=http://$deb_hostname/debian/dists/$codename/main/installer-$basearch_alt/current/images/netboot/debian-installer/$basearch_alt
|
||||
|
||||
is_virt && flavour=-cloud || flavour=
|
||||
# 甲骨文 debian 10 amd64 cloud 内核 vnc 没有显示
|
||||
[ "$releasever" -eq 10 ] && [ "$basearch_alt" = amd64 ] && flavour=
|
||||
# 甲骨文 arm64 cloud 内核 vnc 没有显示
|
||||
[ "$basearch_alt" = arm64 ] && flavour=
|
||||
|
||||
@ -1009,12 +1003,7 @@ setos() {
|
||||
esac
|
||||
fi
|
||||
case $distro in
|
||||
"centos")
|
||||
case $releasever in
|
||||
"7") ci_image=$ci_mirror/$releasever/images/CentOS-7-$basearch-GenericCloud.qcow2 ;;
|
||||
"9") ci_image=$ci_mirror/$releasever-stream/$basearch/images/CentOS-Stream-GenericCloud-$releasever-latest.$basearch.qcow2 ;;
|
||||
esac
|
||||
;;
|
||||
"centos") ci_image=$ci_mirror/$releasever-stream/$basearch/images/CentOS-Stream-GenericCloud-$releasever-latest.$basearch.qcow2 ;;
|
||||
"alma") ci_image=$ci_mirror/AlmaLinux-$releasever-GenericCloud-latest.$basearch.qcow2 ;;
|
||||
"rocky") ci_image=$ci_mirror/Rocky-$releasever-GenericCloud-Base.latest.$basearch.qcow2 ;;
|
||||
"fedora")
|
||||
@ -1035,12 +1024,7 @@ setos() {
|
||||
else
|
||||
# 传统安装
|
||||
case $distro in
|
||||
"centos")
|
||||
case $releasever in
|
||||
"7") mirrorlist="http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os" ;;
|
||||
"9") mirrorlist="https://mirrors.centos.org/mirrorlist?repo=centos-baseos-9-stream&arch=$basearch" ;;
|
||||
esac
|
||||
;;
|
||||
"centos") mirrorlist="https://mirrors.centos.org/mirrorlist?repo=centos-baseos-$releasever-stream&arch=$basearch" ;;
|
||||
"alma") mirrorlist="https://mirrors.almalinux.org/mirrorlist/$releasever/baseos" ;;
|
||||
"rocky") mirrorlist="https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever" ;;
|
||||
"fedora") mirrorlist="https://mirrors.fedoraproject.org/mirrorlist?arch=$basearch&repo=fedora-$releasever" ;;
|
||||
@ -1065,14 +1049,8 @@ setos() {
|
||||
eval ${step}_ks=$confhome/redhat.cfg
|
||||
eval ${step}_vmlinuz=${mirror}images/pxeboot/vmlinuz
|
||||
eval ${step}_initrd=${mirror}images/pxeboot/initrd.img
|
||||
|
||||
if [ "$releasever" = 7 ]; then
|
||||
squashfs=${mirror}LiveOS/squashfs.img
|
||||
else
|
||||
squashfs=${mirror}images/install.img
|
||||
fi
|
||||
test_url $squashfs 'squashfs'
|
||||
eval ${step}_squashfs=$squashfs
|
||||
eval ${step}_squashfs=${mirror}images/install.img
|
||||
test_url ${mirror}images/install.img 'squashfs'
|
||||
fi
|
||||
}
|
||||
|
||||
@ -1150,13 +1128,13 @@ verify_os_name() {
|
||||
fi
|
||||
|
||||
for os in \
|
||||
'centos 7|9' \
|
||||
'oracle 7|8|9' \
|
||||
'centos |9' \
|
||||
'oracle 8|9' \
|
||||
'alma 8|9' \
|
||||
'rocky 8|9' \
|
||||
'redhat 8|9' \
|
||||
'fedora 39|40' \
|
||||
'debian 10|11|12' \
|
||||
'debian 11|12' \
|
||||
'ubuntu 20.04|22.04|24.04' \
|
||||
'alpine 3.17|3.18|3.19|3.20' \
|
||||
'opensuse 15.5|15.6|tumbleweed' \
|
||||
|
89
trans.sh
89
trans.sh
@ -1579,16 +1579,8 @@ create_cloud_init_network_config() {
|
||||
elif is_staticv6; then
|
||||
get_netconf_to ipv6_addr
|
||||
get_netconf_to ipv6_gateway
|
||||
# centos7 不认识 static6,但可改成 static,作用相同
|
||||
# https://github.com/canonical/cloud-init/commit/dacdd30080bd8183d1f1c1dc9dbcbc8448301529
|
||||
if [ -f /os/etc/system-release-cpe ] &&
|
||||
grep -E 'centos:7|oracle:linux:7' /os/etc/system-release-cpe; then
|
||||
type_ipv6_static=static
|
||||
else
|
||||
type_ipv6_static=static6
|
||||
fi
|
||||
yq -i ".network.config[$config_id].subnets[$subnet_id] = {
|
||||
\"type\": \"$type_ipv6_static\",
|
||||
\"type\": \"static6\",
|
||||
\"address\": \"$ipv6_addr\",
|
||||
\"gateway\": \"$ipv6_gateway\" }
|
||||
" $ci_file
|
||||
@ -1865,12 +1857,12 @@ EOF
|
||||
restore_resolv_conf $os_dir
|
||||
fi
|
||||
|
||||
if grep -E '^(10|11)' $os_dir/etc/debian_version; then
|
||||
if grep ^11 $os_dir/etc/debian_version; then
|
||||
cp_resolv_conf $os_dir
|
||||
chroot $os_dir apt update
|
||||
|
||||
if true; then
|
||||
# 将 debian 10/11 设置为 12 一样的网络管理器
|
||||
# 将 debian 11 设置为 12 一样的网络管理器
|
||||
# 可解决 ifupdown dhcp 不支持 24位掩码+不规则网关的问题
|
||||
DEBIAN_FRONTEND=noninteractive chroot $os_dir apt install -y netplan.io
|
||||
chroot $os_dir systemctl disable networking resolvconf
|
||||
@ -1885,7 +1877,7 @@ system_info:
|
||||
EOF
|
||||
|
||||
else
|
||||
# debian 10/11 默认不支持 rdnss,要安装 rdnssd 或者 nm
|
||||
# debian 11 默认不支持 rdnss,要安装 rdnssd 或者 nm
|
||||
DEBIAN_FRONTEND=noninteractive chroot $os_dir apt install -y rdnssd
|
||||
# 不会自动建立链接,因此不能删除
|
||||
restore_resolv_conf $os_dir
|
||||
@ -2049,11 +2041,7 @@ allow_root_password_login() {
|
||||
|
||||
disable_selinux_kdump() {
|
||||
os_dir=$1
|
||||
releasever=$(awk -F: '{ print $5 }' <$os_dir/etc/system-release-cpe)
|
||||
|
||||
if ! chroot $os_dir command -v grubby; then
|
||||
yum install grubby
|
||||
fi
|
||||
releasever=$(awk -F: '{ print $5 }' $os_dir/etc/system-release-cpe)
|
||||
|
||||
# selinux
|
||||
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/g' $os_dir/etc/selinux/config
|
||||
@ -2064,11 +2052,7 @@ disable_selinux_kdump() {
|
||||
|
||||
# kdump
|
||||
chroot $os_dir grubby --update-kernel ALL --args crashkernel=no
|
||||
if [ "$releasever" -eq 7 ]; then
|
||||
# el7 上面那条 grubby 命令不能设置 /etc/default/grub
|
||||
sed -i 's/crashkernel=[^ "]*/crashkernel=no/' $os_dir/etc/default/grub
|
||||
fi
|
||||
rm -rf $os_dir/etc/systemd/system/multi-user.target.wants/kdump.service
|
||||
chroot $os_dir systemctl disable kdump
|
||||
}
|
||||
|
||||
download_qcow() {
|
||||
@ -2118,20 +2102,13 @@ get_ci_installer_part_size() {
|
||||
esac
|
||||
}
|
||||
|
||||
yum() {
|
||||
chroot_dnf() {
|
||||
if [ "$distro" = oracle ]; then
|
||||
if [ "$releasever" = 7 ]; then
|
||||
chroot /os/ yum -y --disablerepo=* --enablerepo=ol${releasever}_latest "$@"
|
||||
else
|
||||
chroot /os/ dnf -y --disablerepo=* --enablerepo=ol${releasever}_baseos_latest --setopt=install_weak_deps=False "$@"
|
||||
fi
|
||||
enablerepo=ol${releasever}_baseos_latest
|
||||
else
|
||||
if [ "$releasever" = 7 ]; then
|
||||
chroot /os/ yum -y --disablerepo=* --enablerepo=base,updates "$@"
|
||||
else
|
||||
chroot /os/ dnf -y --disablerepo=* --enablerepo=baseos --setopt=install_weak_deps=False "$@"
|
||||
fi
|
||||
enablerepo=baseos
|
||||
fi
|
||||
chroot /os/ dnf -y --disablerepo=* --enablerepo=$enablerepo --setopt=install_weak_deps=False "$@"
|
||||
}
|
||||
|
||||
chroot_apt_autoremove() {
|
||||
@ -2276,26 +2253,11 @@ install_qcow_by_copy() {
|
||||
# 部分镜像例如 centos7 要手动删除 machine-id
|
||||
truncate_machine_id /os
|
||||
|
||||
# centos 7 yum 可能会使用 ipv6,即使没有 ipv6 网络
|
||||
if grep -E 'centos:7|oracle:linux:7' /os/etc/system-release-cpe; then
|
||||
if [ "$(cat /dev/ipv6_has_internet)" = "0" ]; then
|
||||
echo 'ip_resolve=4' >>/os/etc/yum.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# 删除云镜像自带的 dhcp 配置,防止歧义
|
||||
# clout-init 网络配置在 /etc/sysconfig/network-scripts/
|
||||
rm -rf /os/etc/NetworkManager/system-connections/*.nmconnection
|
||||
rm -rf /os/etc/sysconfig/network-scripts/ifcfg-*
|
||||
|
||||
# 为 centos 7 ci 安装 NetworkManager
|
||||
# 1. 能够自动配置 onlink 网关
|
||||
# 2. 解决 cloud-init 关闭了 ra,因为 nm 无视内核 ra 设置
|
||||
if grep -E 'centos:7|oracle:linux:7' /os/etc/system-release-cpe; then
|
||||
yum install -y NetworkManager
|
||||
chroot /os/ systemctl enable NetworkManager
|
||||
fi
|
||||
|
||||
# 修复 cloud-init 添加了 IPV*_FAILURE_FATAL
|
||||
# 甲骨文 dhcp6 获取不到 IP 将视为 fatal,原有的 ipv4 地址也会被删除
|
||||
insert_into_file $ci_file after '^runcmd:' <<EOF
|
||||
@ -2317,14 +2279,7 @@ EOF
|
||||
fi
|
||||
|
||||
# oracle linux 移除 lvm cmdline
|
||||
if ! chroot /os command -v grubby; then
|
||||
yum install grubby
|
||||
fi
|
||||
chroot /os grubby --update-kernel ALL --remove-args "resume rd.lvm.lv"
|
||||
if [ "$releasever" -eq 7 ]; then
|
||||
# el7 上面那条 grubby 命令不能设置 /etc/default/grub
|
||||
sed -i 's/ rd.lvm.lv=[^ "]*//g' /os/etc/default/grub
|
||||
fi
|
||||
|
||||
# fstab 添加 efi 分区
|
||||
if is_efi; then
|
||||
@ -2342,7 +2297,7 @@ EOF
|
||||
# bios 和 efi 转换前先删除
|
||||
|
||||
# bios转efi出错
|
||||
# centos7是bios镜像,/boot/grub2/grubenv 是真身
|
||||
# centos 和 oracle x86_64 镜像只有 bios 镜像,/boot/grub2/grubenv 是真身
|
||||
# 安装grub-efi时,grubenv 会改成指向efi分区grubenv软连接
|
||||
# 如果安装grub-efi前没有删除原来的grubenv,原来的grubenv将不变,新建的软连接将变成 grubenv.rpmnew
|
||||
# 后续grubenv的改动无法同步到efi分区,会造成grub2-setdefault失效
|
||||
@ -2352,18 +2307,16 @@ EOF
|
||||
rm -rf /os/boot/grub2/grubenv /os/boot/grub2/grub.cfg
|
||||
}
|
||||
|
||||
# 安装 efi 引导
|
||||
# 只有centos 和 oracle x86_64 镜像没有efi,其他系统镜像已经从efi分区复制了文件
|
||||
if is_efi && [ -z "$efi_part" ]; then
|
||||
# 安装引导
|
||||
if is_efi; then
|
||||
# 只有centos 和 oracle x86_64 镜像没有efi,其他系统镜像已经从efi分区复制了文件
|
||||
if [ -z "$efi_part" ]; then
|
||||
remove_grub_conflict_files
|
||||
chroot_dnf install efibootmgr grub2-efi shim
|
||||
fi
|
||||
else
|
||||
# bios
|
||||
remove_grub_conflict_files
|
||||
[ "$(uname -m)" = x86_64 ] && arch=x64 || arch=aa64
|
||||
yum install efibootmgr grub2-efi-$arch grub2-efi-$arch-modules shim-$arch
|
||||
fi
|
||||
|
||||
# 安装 bios 引导
|
||||
if ! is_efi; then
|
||||
remove_grub_conflict_files
|
||||
yum install grub2-pc grub2-pc-modules
|
||||
chroot /os/ grub2-install /dev/$xda
|
||||
fi
|
||||
|
||||
@ -2603,7 +2556,7 @@ fix_partition_table_by_parted() {
|
||||
|
||||
resize_after_install_cloud_image() {
|
||||
# 提前扩容
|
||||
# 1 修复 vultr 512m debian 10/11 generic/genericcloud 首次启动 kernel panic
|
||||
# 1 修复 vultr 512m debian 11 generic/genericcloud 首次启动 kernel panic
|
||||
# 2 修复 gentoo websync 时空间不足
|
||||
if [ "$distro" = debian ] || [ "$distro" = gentoo ]; then
|
||||
apk add parted
|
||||
|
Loading…
x
Reference in New Issue
Block a user