From 6d179865740578b58ae6d32fc04b97ca37b11ba0 Mon Sep 17 00:00:00 2001 From: lsy Date: Thu, 26 Sep 2024 16:20:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=BD=AF=E4=BB=B6=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/Docker/image.sh | 4 ++-- Config/Manage/install.sh | 12 +++++----- Config/User/test.sh | 5 ++++ Config/Web/{acme.sh => acme/apply.sh} | 4 ++-- Config/Web/nginx.sh | 4 +--- Config/{Software.sh => software.sh} | 2 +- Menus/Sources.sh => Config/sources.sh | 3 +-- Menus/Docker.sh | 34 --------------------------- Menus/Other.sh | 18 -------------- Menus/User.sh | 26 -------------------- Menus/Web.sh | 21 ----------------- Run.sh => run.sh | 0 12 files changed, 18 insertions(+), 115 deletions(-) create mode 100644 Config/User/test.sh rename Config/Web/{acme.sh => acme/apply.sh} (95%) rename Config/{Software.sh => software.sh} (99%) rename Menus/Sources.sh => Config/sources.sh (97%) delete mode 100644 Menus/Docker.sh delete mode 100644 Menus/Other.sh delete mode 100644 Menus/User.sh delete mode 100644 Menus/Web.sh rename Run.sh => run.sh (100%) diff --git a/Config/Docker/image.sh b/Config/Docker/image.sh index c7c6206..39a8950 100644 --- a/Config/Docker/image.sh +++ b/Config/Docker/image.sh @@ -17,11 +17,11 @@ case $pick in docker_number=$(( docker_number+1 )) echo "${docker_number}.${i}" done - echo "要删除的镜像序号,多个镜像用 空格 隔开" + echo "要停止的镜像序号,多个镜像用 空格 隔开" read -p "请输入:" pick for i in $pick ; do if [[ $i =~ [1-$docker_number] ]]; then - docker rmi "${docker_arr[$i]}" + docker stop "${docker_arr[$(( i -1 ))]}" fi done ;; diff --git a/Config/Manage/install.sh b/Config/Manage/install.sh index 965b3c1..ddb6ae2 100644 --- a/Config/Manage/install.sh +++ b/Config/Manage/install.sh @@ -63,30 +63,30 @@ if ! [[ -d "${path}/linuxtool" ]];then exit fi -chmod +x "$path/linuxtool/Run.sh" &> /dev/null +chmod +x "$path/linuxtool/run.sh" &> /dev/null if [[ -e "${HOME}/.bashrc" ]];then 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 fi if [[ -e "${HOME}/.profile" ]];then 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 fi if [[ -e "${HOME}/.zshrc" ]];then 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 fi 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 "位置:${path}/linuxtool" diff --git a/Config/User/test.sh b/Config/User/test.sh new file mode 100644 index 0000000..cd2a835 --- /dev/null +++ b/Config/User/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash +if ! command -v ssh &> /dev/null; then + echo "ssh未安装" + exit +fi diff --git a/Config/Web/acme.sh b/Config/Web/acme/apply.sh similarity index 95% rename from Config/Web/acme.sh rename to Config/Web/acme/apply.sh index edbe0fe..68d8140 100644 --- a/Config/Web/acme.sh +++ b/Config/Web/acme/apply.sh @@ -24,7 +24,7 @@ if ! command -v socat &> /dev/null; then fi if [[ ! -f "${HOME}/.acme.sh/acme.sh" ]];then - rm -rf ${HOME}/.acme.sh + rm -rf ${HOME}/.apple.sh declare mail read -p "请输入用来申请域名的邮箱:" mail if [[ ! $mail =~ .*@.* ]];then @@ -103,7 +103,7 @@ EOF case ${mode_arr[$pick_mode]} in '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 txt_value=($(echo "$log_output" | grep "TXT value:" | awk -F ": " '{print $2}')) echo "请到dns系统解析TXT记录" diff --git a/Config/Web/nginx.sh b/Config/Web/nginx.sh index 65b6390..c72d2ad 100644 --- a/Config/Web/nginx.sh +++ b/Config/Web/nginx.sh @@ -1,7 +1,5 @@ #!/bin/bash -declare path_script=$1 - if ! command -v nginx &> /dev/null; then if [[ -f "/usr/bin/apt-get" ]];then apt-get update -y @@ -52,7 +50,7 @@ case $pick in else echo "1.nginx(默认)" 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_key="${HOME}/.acme.sh/${ssl_domain}_ecc/${ssl_domain}.key" fi diff --git a/Config/Software.sh b/Config/software.sh similarity index 99% rename from Config/Software.sh rename to Config/software.sh index bfec311..a924228 100644 --- a/Config/Software.sh +++ b/Config/software.sh @@ -38,7 +38,7 @@ soft_dick['zsh-beautify']=1 soft_dick['docker']=1 soft_dick['x-cmd']=1 -echo "======一键安装常用软件======" +echo "========$(basename $0 .sh)========" for i in "${!soft_dick[@]}" ; do soft_number=$(( soft_number+1 )) soft_array[$soft_number]=$i diff --git a/Menus/Sources.sh b/Config/sources.sh similarity index 97% rename from Menus/Sources.sh rename to Config/sources.sh index ce48efe..7d8b441 100644 --- a/Menus/Sources.sh +++ b/Config/sources.sh @@ -12,14 +12,13 @@ sources_dick['网易云']='https://mirrors.163.com' declare -a pcik_array declare pick=0 -echo "========Sources========" +echo "========$(basename $0 .sh)========" for i in "${!sources_dick[@]}"; do pick=$(( pick+1 )) pcik_array[$pick]=$i echo "${pick}.${i}" done -echo "========Sources========" read -p "请输入:" pick diff --git a/Menus/Docker.sh b/Menus/Docker.sh deleted file mode 100644 index 2b2c637..0000000 --- a/Menus/Docker.sh +++ /dev/null @@ -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 - - diff --git a/Menus/Other.sh b/Menus/Other.sh deleted file mode 100644 index 35b4420..0000000 --- a/Menus/Other.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Menus/User.sh b/Menus/User.sh deleted file mode 100644 index a0648d8..0000000 --- a/Menus/User.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Menus/Web.sh b/Menus/Web.sh deleted file mode 100644 index 09abe35..0000000 --- a/Menus/Web.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Run.sh b/run.sh similarity index 100% rename from Run.sh rename to run.sh