Compare commits

...

3 Commits

Author SHA1 Message Date
bin456789
d55a27c1a2 debian: 修复在 256M 内存安装模式下无法识别 nvme 硬盘 2026-04-24 23:12:53 +08:00
bin456789
22d7a9a238 ubuntu: 添加 26.04, 删除 16.04 2026-04-24 00:12:09 +08:00
bin456789
ae3ad40c75 core: 修复在 el 的 sh 下无法运行 2026-04-12 18:10:09 +08:00
4 changed files with 73 additions and 106 deletions

View File

@@ -51,7 +51,7 @@ The system requirements for the target system are as follows:
| <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.20, 3.21, 3.22, 3.23 | 256 MB | 1 GB | | <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.20, 3.21, 3.22, 3.23 | 256 MB | 1 GB |
| <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 9, 10, 11, 12, 13 | 256 MB | 1 ~ 1.5 GB ^ | | <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 9, 10, 11, 12, 13 | 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://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://documentation.ubuntu.com/server/_static/favicon.png" /> Ubuntu | 16.04 LTS - 24.04 LTS, 25.10 | 512 MB \* | 2 GB | | <img width="16" height="16" src="https://documentation.ubuntu.com/server/_static/favicon.png" /> Ubuntu | 18.04 LTS - 26.04 LTS | 512 MB \* | 2 GB |
| <img width="16" height="16" src="https://img.alicdn.com/imgextra/i1/O1CN01oJnJZg1yK4RzI4Rx2_!!6000000006559-2-tps-118-118.png" /> Anolis | 7, 8, 23 | 512 MB \* | 5 GB | | <img width="16" height="16" src="https://img.alicdn.com/imgextra/i1/O1CN01oJnJZg1yK4RzI4Rx2_!!6000000006559-2-tps-118-118.png" /> Anolis | 7, 8, 23 | 512 MB \* | 5 GB |
| <img width="16" height="16" src="https://www.redhat.com/favicon.ico" /> RHEL &nbsp;<img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> AlmaLinux &nbsp;<img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky &nbsp;<img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 8, 9, 10 | 512 MB \* | 5 GB | | <img width="16" height="16" src="https://www.redhat.com/favicon.ico" /> RHEL &nbsp;<img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> AlmaLinux &nbsp;<img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky &nbsp;<img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 8, 9, 10 | 512 MB \* | 5 GB |
| <img width="16" height="16" src="https://opencloudos.org/qq.ico" /> OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB | | <img width="16" height="16" src="https://opencloudos.org/qq.ico" /> OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB |
@@ -168,7 +168,7 @@ bash reinstall.sh anolis 7|8|23
alpine 3.20|3.21|3.22|3.23 alpine 3.20|3.21|3.22|3.23
opensuse 15.6|16.0|tumbleweed opensuse 15.6|16.0|tumbleweed
openeuler 20.03|22.03|24.03|25.09 openeuler 20.03|22.03|24.03|25.09
ubuntu 16.04|18.04|20.04|22.04|24.04|25.10 [--minimal] ubuntu 18.04|20.04|22.04|24.04|26.04 [--minimal]
kali kali
arch arch
gentoo gentoo

View File

@@ -51,7 +51,7 @@
| <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.20, 3.21, 3.22, 3.23 | 256 MB | 1 GB | | <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.20, 3.21, 3.22, 3.23 | 256 MB | 1 GB |
| <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 9, 10, 11, 12, 13 | 256 MB | 1 ~ 1.5 GB ^ | | <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 9, 10, 11, 12, 13 | 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://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://documentation.ubuntu.com/server/_static/favicon.png" /> Ubuntu | 16.04 LTS - 24.04 LTS, 25.10 | 512 MB \* | 2 GB | | <img width="16" height="16" src="https://documentation.ubuntu.com/server/_static/favicon.png" /> Ubuntu | 18.04 LTS - 26.04 LTS | 512 MB \* | 2 GB |
| <img width="16" height="16" src="https://img.alicdn.com/imgextra/i1/O1CN01oJnJZg1yK4RzI4Rx2_!!6000000006559-2-tps-118-118.png" /> Anolis | 7, 8, 23 | 512 MB \* | 5 GB | | <img width="16" height="16" src="https://img.alicdn.com/imgextra/i1/O1CN01oJnJZg1yK4RzI4Rx2_!!6000000006559-2-tps-118-118.png" /> Anolis | 7, 8, 23 | 512 MB \* | 5 GB |
| <img width="16" height="16" src="https://www.redhat.com/favicon.ico" /> RHEL &nbsp;<img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> AlmaLinux &nbsp;<img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky &nbsp;<img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 8, 9, 10 | 512 MB \* | 5 GB | | <img width="16" height="16" src="https://www.redhat.com/favicon.ico" /> RHEL &nbsp;<img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> AlmaLinux &nbsp;<img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky &nbsp;<img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 8, 9, 10 | 512 MB \* | 5 GB |
| <img width="16" height="16" src="https://opencloudos.org/qq.ico" /> OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB | | <img width="16" height="16" src="https://opencloudos.org/qq.ico" /> OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB |
@@ -168,7 +168,7 @@ bash reinstall.sh anolis 7|8|23
alpine 3.20|3.21|3.22|3.23 alpine 3.20|3.21|3.22|3.23
opensuse 15.6|16.0|tumbleweed opensuse 15.6|16.0|tumbleweed
openeuler 20.03|22.03|24.03|25.09 openeuler 20.03|22.03|24.03|25.09
ubuntu 16.04|18.04|20.04|22.04|24.04|25.10 [--minimal] ubuntu 18.04|20.04|22.04|24.04|26.04 [--minimal]
kali kali
arch arch
gentoo gentoo

View File

@@ -33,7 +33,9 @@ export LC_ALL=C
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
# 如果不是 bash 的话,继续执行会有语法错误,因此在这里判断是否 bash # 如果不是 bash 的话,继续执行会有语法错误,因此在这里判断是否 bash
if [ -z "$BASH" ]; then if [ -z "$BASH" ] ||
# el 的 sh 是 bash 运行在 posix 模式,依然有 $BASH 和 $BASH_VERSION
{ [ -n "$BASH" ] && [ -n "$POSIXLY_CORRECT" ]; }; then
if ! command -v bash >/dev/null; then if ! command -v bash >/dev/null; then
if [ -f /etc/alpine-release ]; then if [ -f /etc/alpine-release ]; then
if ! apk add bash; then if ! apk add bash; then
@@ -87,7 +89,7 @@ Usage: $reinstall_____ anolis 7|8|23
alpine 3.20|3.21|3.22|3.23 alpine 3.20|3.21|3.22|3.23
opensuse 15.6|16.0|tumbleweed opensuse 15.6|16.0|tumbleweed
openeuler 20.03|22.03|24.03|25.09 openeuler 20.03|22.03|24.03|25.09
ubuntu 16.04|18.04|20.04|22.04|24.04|25.10 [--minimal] ubuntu 18.04|20.04|22.04|24.04|26.04 [--minimal]
kali kali
arch arch
gentoo gentoo
@@ -1307,12 +1309,11 @@ Continue?
setos_ubuntu() { setos_ubuntu() {
case "$releasever" in case "$releasever" in
16.04) codename=xenial ;;
18.04) codename=bionic ;; 18.04) codename=bionic ;;
20.04) codename=focal ;; 20.04) codename=focal ;;
22.04) codename=jammy ;; 22.04) codename=jammy ;;
24.04) codename=noble ;; 24.04) codename=noble ;;
25.10) codename=questing ;; # non-lts 26.04) codename=resolute ;;
esac esac
if is_use_cloud_image; then if is_use_cloud_image; then
@@ -1336,24 +1337,19 @@ Continue?
[ "$basearch_alt" = amd64 ] || [ "${releasever%.*}" -ge 24 ] [ "$basearch_alt" = amd64 ] || [ "${releasever%.*}" -ge 24 ]
} }
get_suffix() { basearch_img=$basearch_alt
if [ "$releasever" = 16.04 ]; then if [ "$basearch_alt" = amd64 ] && [ "${releasever%.*}" -ge 26 ] && is_cpu_supports_x86_64_v3; then
if is_efi; then basearch_img=amd64v3
echo -uefi1
else
echo -disk1
fi fi
fi
}
if [ "$minimal" = 1 ]; then if [ "$minimal" = 1 ]; then
if ! is_have_minimal_image; then if ! is_have_minimal_image; then
error_and_exit "Minimal cloud image is not available for $releasever $basearch_alt." error_and_exit "Minimal cloud image is not available for $releasever $basearch_alt."
fi fi
eval ${step}_img="$ci_mirror/minimal/releases/$codename/release/ubuntu-$releasever-minimal-cloudimg-$basearch_alt$(get_suffix).img" eval ${step}_img="$ci_mirror/minimal/releases/$codename/release/ubuntu-$releasever-minimal-cloudimg-$basearch_img.img"
else else
# 用 codename 而不是 releasever可减少一次跳转 # 用 codename 而不是 releasever可减少一次跳转
eval ${step}_img="$ci_mirror/releases/$codename/release/ubuntu-$releasever-server-cloudimg-$basearch_alt$(get_suffix).img" eval ${step}_img="$ci_mirror/releases/$codename/release/ubuntu-$releasever-server-cloudimg-$basearch_img.img"
fi fi
else else
# 传统安装 # 传统安装
@@ -1924,7 +1920,7 @@ verify_os_name() {
'opensuse 15.6|16.0|tumbleweed' \ 'opensuse 15.6|16.0|tumbleweed' \
'alpine 3.20|3.21|3.22|3.23' \ 'alpine 3.20|3.21|3.22|3.23' \
'openeuler 20.03|22.03|24.03|25.09' \ 'openeuler 20.03|22.03|24.03|25.09' \
'ubuntu 16.04|18.04|20.04|22.04|24.04|25.10' \ 'ubuntu 18.04|20.04|22.04|24.04|26.04' \
'redhat' \ 'redhat' \
'kali' \ 'kali' \
'arch' \ 'arch' \
@@ -3484,7 +3480,14 @@ EOF
for driver in $(get_disk_drivers $xda); do for driver in $(get_disk_drivers $xda); do
echo "using driver: $driver" echo "using driver: $driver"
case $driver in case $driver in
nvme) extra_drivers+=" nvme nvme-core" ;; nvme)
extra_drivers+=" nvme nvme-core"
# debian 13+ / kali 有 nvme-auth 模块
# 添加后才能识别 nvme 硬盘
if grep -q nvme-auth lib/modules/$kver/modules.order; then
extra_drivers+=" nvme-auth"
fi
;;
# xen 的横杠特别不同 # xen 的横杠特别不同
xen_blkfront) extra_drivers+=" xen-blkfront" ;; xen_blkfront) extra_drivers+=" xen-blkfront" ;;
xen_scsifront) extra_drivers+=" xen-scsifront" ;; xen_scsifront) extra_drivers+=" xen-scsifront" ;;

View File

@@ -4402,10 +4402,7 @@ chroot_apt_autoremove() {
change_confs() { change_confs() {
action=$1 action=$1
# 只有 16.04 有 01autoremove-kernels file=$os_dir/etc/apt/apt.conf.d/01autoremove
# 16.04 结束支持后删除
for conf in 01autoremove 01autoremove-kernels; do
file=$os_dir/etc/apt/apt.conf.d/$conf
case "$action" in case "$action" in
change) change)
if [ -f $file ]; then if [ -f $file ]; then
@@ -4418,7 +4415,6 @@ chroot_apt_autoremove() {
fi fi
;; ;;
esac esac
done
} }
change_confs change change_confs change
@@ -4927,19 +4923,6 @@ EOF
done done
fi fi
# 16.04 arm64 镜像没有 grub 引导文件
if is_efi && ! [ -d $os_dir/boot/efi/EFI/ubuntu ]; then
chroot_apt_install $os_dir efibootmgr shim "grub-efi-$(get_axx64)"
# 创建 ubuntu 文件夹和 grubaa64.efi
DEBIAN_FRONTEND=noninteractive chroot $os_dir dpkg-reconfigure "grub-efi-$(get_axx64)"
cat <<EOF >"$os_dir/boot/efi/EFI/ubuntu/grub.cfg"
search.fs_uuid $os_part_uuid root
set prefix=(\$root)'/boot/grub'
configfile \$prefix/grub.cfg
EOF
fi
# 避免 do-release-upgrade 时自动执行 dpkg-reconfigure grub-xx 但是 efi/biosgrub 分区不存在而导致报错 # 避免 do-release-upgrade 时自动执行 dpkg-reconfigure grub-xx 但是 efi/biosgrub 分区不存在而导致报错
# shellcheck disable=SC2046 # shellcheck disable=SC2046
chroot_apt_remove $os_dir $(is_efi && echo 'grub-pc' || echo 'grub-efi*' 'shim*') chroot_apt_remove $os_dir $(is_efi && echo 'grub-pc' || echo 'grub-efi*' 'shim*')
@@ -4995,7 +4978,6 @@ EOF
# 网络配置 # 网络配置
# 18.04+ netplan # 18.04+ netplan
if is_have_cmd_on_disk $os_dir netplan; then
# 避免删除 cloud-init 后minimal 镜像的 netplan.io 被 autoremove # 避免删除 cloud-init 后minimal 镜像的 netplan.io 被 autoremove
chroot $os_dir apt-mark manual netplan.io chroot $os_dir apt-mark manual netplan.io
@@ -5022,17 +5004,6 @@ EOF
# 清理 # 清理
rm -rf $os_dir/net.cfg rm -rf $os_dir/net.cfg
fi fi
else
# 避免删除 cloud-init 后 ifupdown 被 autoremove
chroot $os_dir apt-mark manual ifupdown
# 16.04 镜像用 ifupdown/networking 管理网络
# 要安装 resolveconf不然 /etc/resolv.conf 为空
chroot_apt_install $os_dir resolvconf
ln -sf /run/resolvconf/resolv.conf $os_dir/etc/resolv.conf.orig
create_ifupdown_config $os_dir/etc/network/interfaces
fi
# 自带的 60-cloudimg-settings.conf 禁止了 PasswordAuthentication # 自带的 60-cloudimg-settings.conf 禁止了 PasswordAuthentication
file=$os_dir/etc/ssh/sshd_config.d/60-cloudimg-settings.conf file=$os_dir/etc/ssh/sshd_config.d/60-cloudimg-settings.conf
@@ -7337,13 +7308,7 @@ get_ubuntu_kernel_flavor() {
# https://github.com/systemd/systemd/blob/main/src/basic/virt.c # https://github.com/systemd/systemd/blob/main/src/basic/virt.c
# https://github.com/canonical/cloud-init/blob/main/tools/ds-identify # https://github.com/canonical/cloud-init/blob/main/tools/ds-identify
# http://git.annexia.org/?p=virt-what.git;a=blob;f=virt-what.in;hb=HEAD # http://git.annexia.org/?p=virt-what.git;a=blob;f=virt-what.in;hb=HEAD
if [ "$releasever" = 16.04 ]; then
if is_virt; then
echo virtual-hwe-$releasever
else
echo generic-hwe-$releasever
fi
else
# 这里有坑 # 这里有坑
# $(get_cloud_vendor) 调用了 cache_dmi_and_virt # $(get_cloud_vendor) 调用了 cache_dmi_and_virt
# 但是 $(get_cloud_vendor) 运行在 subshell 里面 # 但是 $(get_cloud_vendor) 运行在 subshell 里面
@@ -7362,7 +7327,6 @@ get_ubuntu_kernel_flavor() {
fi fi
;; ;;
esac esac
fi
} }
install_redhat_ubuntu() { install_redhat_ubuntu() {