修改重装

This commit is contained in:
lsy 2024-09-23 16:04:53 +08:00
parent 3fdd2a1d0d
commit 9f27db43cc

View File

@ -4,7 +4,7 @@ declare server
echo "请选择下载服务器" echo "请选择下载服务器"
echo "1.国内服务器" echo "1.国内服务器"
echo "2.国外服务器(默认)" echo "2.国外服务器(默认)"
read -p "请输入" pick read -p "请输入" pick
if [[ $pick == '1' ]];then if [[ $pick == '1' ]];then
server="https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.sh" server="https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.sh"
else else
@ -14,10 +14,10 @@ fi
declare -A imags_dick declare -A imags_dick
declare -a imags_arr declare -a imags_arr
declare imags_number=0 declare imags_number=0
imags_dick['arch']=() imags_dick['arch']=""
imags_dick['kali']=() imags_dick['kali']=""
imags_dick['debian']=(8 9 10 11 12) imags_dick['debian']="8 9 10 11 12"
imags_dick['Ubuntu']=(16.04 18.04 20.04 22.04 24.04) imags_dick['Ubuntu']="16.04 18.04 20.04 22.04 24.04"
for i in "${!imags_dick[@]}" ; do for i in "${!imags_dick[@]}" ; do
imags_number=$(( imags_number+1 )) imags_number=$(( imags_number+1 ))
@ -30,18 +30,19 @@ read -p "请选择需要安装的镜像序号:" pick
if [[ $pick =~ [1-"${#imags_dick[@]}"\ ] ]];then if [[ $pick =~ [1-"${#imags_dick[@]}"\ ] ]];then
declare img=${imags_dick[${imags_arr[$pick]}]} declare img=${imags_dick[${imags_arr[$pick]}]}
declare version='' declare version=''
declare version_arr=${imags_dick[$img]} declare -a version_arr
declare version_number=-1 declare version_number=0
if [[ ${#version_arr[@]} != 0 ]];then if [[ ! -z ${imags_dick[$img]} ]];then
echo "请输入要安装的版本(默认最新)" echo "请输入要安装的版本(默认最新)"
for i in "${!version_arr[@]}" ; do for i in ${imags_dick[$img]} ; do
version_number=$(( version_number+1 )) version_number=$(( version_number+1 ))
version_arr[$version_number]=$i
echo "${version_number}.${i}" echo "${version_number}.${i}"
done done
read -p "请输入:" pick read -p "请输入:" pick
if [ -z $pick ]; then if [ -z $pick ]; then
version=$version_arr[$version_number] version=$version_arr[$version_number]
elif [[ $pick =~ [0-$version_number] ]];then elif [[ $pick =~ [1-$version_number] ]];then
version=$version_arr[$pick] version=$version_arr[$pick]
fi fi
echo "bash <(curl -Ls ${server}) ${img} ${version}" echo "bash <(curl -Ls ${server}) ${img} ${version}"