更新软件结构

This commit is contained in:
lsy 2024-09-26 16:20:14 +08:00
parent 5db4586f2b
commit 6d17986574
12 changed files with 18 additions and 115 deletions

View File

@ -17,11 +17,11 @@ case $pick in
docker_number=$(( docker_number+1 )) docker_number=$(( docker_number+1 ))
echo "${docker_number}.${i}" echo "${docker_number}.${i}"
done done
echo "要删除的镜像序号,多个镜像用 空格 隔开" echo "要停止的镜像序号,多个镜像用 空格 隔开"
read -p "请输入:" pick read -p "请输入:" pick
for i in $pick ; do for i in $pick ; do
if [[ $i =~ [1-$docker_number] ]]; then if [[ $i =~ [1-$docker_number] ]]; then
docker rmi "${docker_arr[$i]}" docker stop "${docker_arr[$(( i -1 ))]}"
fi fi
done done
;; ;;

View File

@ -63,30 +63,30 @@ if ! [[ -d "${path}/linuxtool" ]];then
exit exit
fi fi
chmod +x "$path/linuxtool/Run.sh" &> /dev/null chmod +x "$path/linuxtool/run.sh" &> /dev/null
if [[ -e "${HOME}/.bashrc" ]];then if [[ -e "${HOME}/.bashrc" ]];then
sed -i '/alias tool.*/d' "${HOME}/.bashrc" sed -i '/alias tool.*/d' "${HOME}/.bashrc"
echo "alias tool='$path/linuxtool/Run.sh'" | cat >> "${HOME}/.bashrc" echo "alias tool='$path/linuxtool/run.sh'" | cat >> "${HOME}/.bashrc"
source "${HOME}/.bashrc" &> /dev/null source "${HOME}/.bashrc" &> /dev/null
fi fi
if [[ -e "${HOME}/.profile" ]];then if [[ -e "${HOME}/.profile" ]];then
sed -i '/alias tool.*/d' "${HOME}/.profile" sed -i '/alias tool.*/d' "${HOME}/.profile"
echo "alias tool='$path/linuxtool/Run.sh'" | cat >> "${HOME}/.profile" echo "alias tool='$path/linuxtool/run.sh'" | cat >> "${HOME}/.profile"
source "${HOME}/.profile" &> /dev/null source "${HOME}/.profile" &> /dev/null
fi fi
if [[ -e "${HOME}/.zshrc" ]];then if [[ -e "${HOME}/.zshrc" ]];then
sed -i '/alias tool.*/d' "${HOME}/.zshrc" sed -i '/alias tool.*/d' "${HOME}/.zshrc"
echo "alias tool='$path/linuxtool/Run.sh'" | cat >> "${HOME}/.zshrc" echo "alias tool='$path/linuxtool/run.sh'" | cat >> "${HOME}/.zshrc"
source "${HOME}/.zshrc" &> /dev/null source "${HOME}/.zshrc" &> /dev/null
fi fi
sed -i '/alias tool.*/d' "/etc/profile" sed -i '/alias tool.*/d' "/etc/profile"
echo "alias tool='$path/linuxtool/Run.sh'" | cat >> "/etc/profile" echo "alias tool='$path/linuxtool/run.sh'" | cat >> "/etc/profile"
alias tool="$path/linuxtool/Run.sh" alias tool="$path/linuxtool/run.sh"
echo "工具箱已经安装成功" echo "工具箱已经安装成功"
echo "位置:${path}/linuxtool" echo "位置:${path}/linuxtool"

5
Config/User/test.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
if ! command -v ssh &> /dev/null; then
echo "ssh未安装"
exit
fi

View File

@ -24,7 +24,7 @@ if ! command -v socat &> /dev/null; then
fi fi
if [[ ! -f "${HOME}/.acme.sh/acme.sh" ]];then if [[ ! -f "${HOME}/.acme.sh/acme.sh" ]];then
rm -rf ${HOME}/.acme.sh rm -rf ${HOME}/.apple.sh
declare mail declare mail
read -p "请输入用来申请域名的邮箱:" mail read -p "请输入用来申请域名的邮箱:" mail
if [[ ! $mail =~ .*@.* ]];then if [[ ! $mail =~ .*@.* ]];then
@ -103,7 +103,7 @@ EOF
case ${mode_arr[$pick_mode]} in case ${mode_arr[$pick_mode]} in
'TXT记录') 'TXT记录')
declare log_output=$(${HOME}/.acme.sh/acme.sh --issue --dns $domain_str --yes-I-know-dns-manual-mode-enough-go-ahead-please) declare log_output=$(${HOME}/.apple.sh/apple.sh --issue --dns $domain_str --yes-I-know-dns-manual-mode-enough-go-ahead-please)
declare -a domain=($( echo "$log_output" | grep "Domain:" | awk -F ": " '{print $2}')) declare -a domain=($( echo "$log_output" | grep "Domain:" | awk -F ": " '{print $2}'))
declare -a txt_value=($(echo "$log_output" | grep "TXT value:" | awk -F ": " '{print $2}')) declare -a txt_value=($(echo "$log_output" | grep "TXT value:" | awk -F ": " '{print $2}'))
echo "请到dns系统解析TXT记录" echo "请到dns系统解析TXT记录"

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
declare path_script=$1
if ! command -v nginx &> /dev/null; then if ! command -v nginx &> /dev/null; then
if [[ -f "/usr/bin/apt-get" ]];then if [[ -f "/usr/bin/apt-get" ]];then
apt-get update -y apt-get update -y
@ -52,7 +50,7 @@ case $pick in
else else
echo "1.nginx(默认)" echo "1.nginx(默认)"
read -p "请选择:" pick read -p "请选择:" pick
bash "${path_script}/Config/Web/acme.sh" "nginx" "${domain}" bash "$(dirname $0)/acme/apply" "nginx" "${domain}"
ssl_certificate="${HOME}/.acme.sh/${ssl_domain}_ecc/fullchain.cer" ssl_certificate="${HOME}/.acme.sh/${ssl_domain}_ecc/fullchain.cer"
ssl_certificate_key="${HOME}/.acme.sh/${ssl_domain}_ecc/${ssl_domain}.key" ssl_certificate_key="${HOME}/.acme.sh/${ssl_domain}_ecc/${ssl_domain}.key"
fi fi

View File

@ -38,7 +38,7 @@ soft_dick['zsh-beautify']=1
soft_dick['docker']=1 soft_dick['docker']=1
soft_dick['x-cmd']=1 soft_dick['x-cmd']=1
echo "======一键安装常用软件======" echo "========$(basename $0 .sh)========"
for i in "${!soft_dick[@]}" ; do for i in "${!soft_dick[@]}" ; do
soft_number=$(( soft_number+1 )) soft_number=$(( soft_number+1 ))
soft_array[$soft_number]=$i soft_array[$soft_number]=$i

View File

@ -12,14 +12,13 @@ sources_dick['网易云']='https://mirrors.163.com'
declare -a pcik_array declare -a pcik_array
declare pick=0 declare pick=0
echo "========Sources========" echo "========$(basename $0 .sh)========"
for i in "${!sources_dick[@]}"; for i in "${!sources_dick[@]}";
do do
pick=$(( pick+1 )) pick=$(( pick+1 ))
pcik_array[$pick]=$i pcik_array[$pick]=$i
echo "${pick}.${i}" echo "${pick}.${i}"
done done
echo "========Sources========"
read -p "请输入:" pick read -p "请输入:" pick

View File

@ -1,34 +0,0 @@
#!/bin/bash
declare path_script=$1
declare file_name=$(basename $0 .sh)
declare pick_array
declare pick_number=6
declare pick
echo "========$(basename $0 .sh)========"
echo "1.换源"
echo "2.清除所有未使用镜像"
echo "-----一键搭建软件-----"
for i in "${path_script}/Config/${file_name}"/*;do
pick_number=$((pick_number + 1))
pick_array[$pick_number]=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
echo "${pick_number}.${pick_array[$pick_number]}"
done
echo "-----一键搭建软件-----"
echo "任意输入返回主菜单"
read -p "请输入要使用的功能:" pick
clear
if [[ $pick == '1' ]];then
elif [[ $pick == '2' ]];then
elif [[ "${pick}" =~ [${pick_number}-${#pick_array[*]}] ]];then
fi

View File

@ -1,18 +0,0 @@
declare path_script=$1
declare file_name=$(basename $0 .sh)
echo "========Other========"
declare print_number=0
declare -a print_arr
declare pick
for i in "${path_script}/Config/${file_name}"/* ; do
print_number=$(( print_number+1 ))
print_arr[$print_number]=$(basename $i .sh)
echo "${print_number}.${print_arr[$print_number]}"
done
echo "输入其他任意返回主页"
echo "========Other========"
read -p "请输入:" pick
if [[ $pick =~ [1-$print_number] ]]; then
bash "${path_script}/Config/${file_name}/${print_arr[$pick]}.sh"
fi

View File

@ -1,26 +0,0 @@
#!/bin/bash
if ! command -v ssh &> /dev/null; then
echo "ssh未安装"
exit
fi
declare path_script=$1
declare file_name=$(basename $0 .sh)
declare pick_array
declare pick_number=0
declare pick
echo "========Login========"
for i in "${path_script}/Config/${file_name}"/*;do
pick_number=$((pick_number + 1))
pick_array[$pick_number]=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
echo "${pick_number}.${pick_array[$pick_number]}"
done
echo "任意输入返回主菜单"
echo "========Login========"
read -p "请输入要使用的功能:" pick
if [[ $pick =~ [1-$pick_number] ]]; then
bash "${path_script}/Config/${file_name}/${pick_array[${pick}]}.sh"
fi

View File

@ -1,21 +0,0 @@
#!/bin/bash
declare path_script=$1
declare file_name=$(basename $0 .sh)
declare print_array
declare print_number=0
declare pick
echo "========Web========"
for i in "${path_script}/Config/${file_name}"/*;do
print_number=$((print_number + 1))
print_array[$print_number]=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
echo "${print_number}.${print_array[$print_number]}"
done
echo "========Web========"
read -p "请输入要使用的功能:" pick
if [[ "${pick}" =~ [1-${#print_array[*]}] ]];then
bash "${path_script}/Config/${file_name}/${print_array[${pick}]}.sh" "${path_script}"
fi

View File