From 5f9cc680b38244da2a8334b04cd4771d0bae5f77 Mon Sep 17 00:00:00 2001 From: lsy Date: Mon, 23 Sep 2024 15:54:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=87=8D=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/Other/Reinstall.sh | 51 +++++++++++++++++++++++++++++++++++++++ Menus/Software.sh | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 Config/Other/Reinstall.sh diff --git a/Config/Other/Reinstall.sh b/Config/Other/Reinstall.sh new file mode 100644 index 0000000..144c85c --- /dev/null +++ b/Config/Other/Reinstall.sh @@ -0,0 +1,51 @@ +#!/bin/bash +declare pick +declare server +echo "请选择下载服务器" +echo "1.国内服务器" +echo "2.国外服务器(默认)" +read -p "请输入" pick +if [[ $pick == '1' ]];then + server="https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.sh" +else + server="https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh" +fi + +declare -A imags_dick +declare -a imags_arr +declare imags_number=0 +imags_dick['arch']=() +imags_dick['kali']=() +imags_dick['debian']=(8 9 10 11 12) +imags_dick['Ubuntu']=(16.04 18.04 20.04 22.04 24.04) + +for i in "${!imags_dick[@]}" ; do + imags_number=$(( imags_number+1 )) + imags_arr[$imags_number]=$i + echo "${imags_number}.${i}" +done + +read -p "请选择需要安装的镜像序号:" pick + +if [[ $pick =~ [1-"${#imags_dick[@]}"\ ] ]];then + declare img=${imags_dick[${imags_arr[$pick]}]} + declare version='' + declare version_arr=${imags_dick[$img]} + declare version_number=-1 + if [[ ${#version_arr[@]} != 0 ]];then + echo "请输入要安装的版本(默认最新)" + for i in "${!version_arr[@]}" ; do + version_number=$(( version_number+1 )) + echo "${version_number}.${i}" + done + read -p "请输入:" pick + if [ -z $pick ]; then + version=$version_arr[$version_number] + elif [[ $pick =~ [0-$version_number] ]];then + version=$version_arr[$pick] + fi + echo "bash <(curl -Ls ${server}) ${img} ${version}" + fi +else + echo "选择错误" +fi \ No newline at end of file diff --git a/Menus/Software.sh b/Menus/Software.sh index e39c8a4..c8b0881 100644 --- a/Menus/Software.sh +++ b/Menus/Software.sh @@ -1,5 +1,5 @@ #!/bin/bash - +echo "正在更新系统包管理器" declare install_str declare version="$(cat /etc/os-release | grep "^ID" | awk -F '=' '{print $2}')" declare status=0