diff --git a/README.md b/README.md index 2e62792..815cd53 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # reinstall +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/dc679a17751448628fe6d8ac35e26eed)](https://app.codacy.com/gh/bin456789/reinstall/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) +[![CodeFactor](https://www.codefactor.io/repository/github/bin456789/reinstall/badge)](https://www.codefactor.io/repository/github/bin456789/reinstall) + 又一个重装脚本 ## 亮点 @@ -31,6 +34,8 @@ curl -O https://ghps.cc/https://raw.githubusercontent.com/bin456789/reinstall/ma ### 用法 1: 安装 Linux +注意:静态 IP 的机器安装 centos、alma、rocky、fedora、debian、ubuntu,需添加参数 --ci 强制使用云镜像 + ```bash bash reinstall.sh centos 7|8|9 (8|9 为 stream 版本) alma 8|9 diff --git a/reinstall.sh b/reinstall.sh index e80524a..d2e8825 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -130,6 +130,10 @@ is_netboot_xyz() { [ "$distro" = netboot.xyz ] } +is_alpine_live() { + [ "$distro" = alpine ] && [ "$hold" = 1 ] +} + is_have_initrd() { ! is_netboot_xyz } @@ -673,8 +677,8 @@ install_pkg() { find_pkg_mgr() { if [ -z "$pkg_mgr" ]; then - for c in dnf yum apt pacman zypper emerge apk; do - is_have_cmd $c && pkg_mgr=$c && return + for mgr in dnf yum apt pacman zypper emerge apk; do + is_have_cmd $mgr && pkg_mgr=$mgr && return done return 1 fi @@ -974,7 +978,7 @@ install_grub_win() { info download grub grub_ver=2.06 is_in_china && grub_url=https://mirrors.tuna.tsinghua.edu.cn/gnu/grub/grub-$grub_ver-for-windows.zip || - grub_url=https://mirror.fcix.net/gnu/grub/grub-$grub_ver-for-windows.zip + grub_url=https://ftpmirror.gnu.org/gnu/grub/grub-$grub_ver-for-windows.zip curl -Lo /tmp/grub.zip $grub_url # unzip -qo /tmp/grub.zip 7z x /tmp/grub.zip -o/tmp -r -y -xr!i386-efi -xr!locale -xr!themes -bso0 @@ -1491,14 +1495,22 @@ EOF fi fi -if is_use_cloud_image; then - info 'cloud image mode' +info 'info' +echo "$distro $releasever" +if is_netboot_xyz; then + echo 'Reboot to start netboot.xyz.' +elif is_alpine_live; then + echo 'Reboot to start Alpine Live OS.' elif is_use_dd; then - info 'dd mode' -elif is_netboot_xyz; then - info 'boot into netboot.xyz' + echo 'Reboot to start DD.' else - info 'installer mode' -fi + if [ "$distro" = windows ]; then + username="administrator" + else + username="root" + fi -info 'Please reboot to begin the installation' + echo "Username: $username" + echo "Password: 123@@@" + echo "Reboot to start the installation." +fi