From d701c45f67536a33b424a254737c0c2d438b1519 Mon Sep 17 00:00:00 2001 From: lsy Date: Thu, 26 Sep 2024 19:31:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Docker/{Softwares => Installs}/alist.sh | 0 .../Docker/{Softwares => Installs}/gitea.sh | 0 Config/Docker/{Softwares => Installs}/menu.sh | 0 .../nginx-proxy-manager.sh | 0 .../{Softwares => Installs}/safeline.sh | 0 .../Docker/{Softwares => Installs}/siyuan.sh | 0 .../Docker/{Softwares => Installs}/typecho.sh | 0 .../{Softwares => Installs}/vaultwarden.sh | 0 .../Docker/{Softwares => Installs}/xboard.sh | 0 Config/Docker/software.sh | 45 +++++++++++++++++++ Config/Manage/install.sh | 3 +- Config/Manage/unInstall.sh | 3 +- Config/software.sh | 8 ++-- 13 files changed, 53 insertions(+), 6 deletions(-) rename Config/Docker/{Softwares => Installs}/alist.sh (100%) rename Config/Docker/{Softwares => Installs}/gitea.sh (100%) rename Config/Docker/{Softwares => Installs}/menu.sh (100%) rename Config/Docker/{Softwares => Installs}/nginx-proxy-manager.sh (100%) rename Config/Docker/{Softwares => Installs}/safeline.sh (100%) rename Config/Docker/{Softwares => Installs}/siyuan.sh (100%) rename Config/Docker/{Softwares => Installs}/typecho.sh (100%) rename Config/Docker/{Softwares => Installs}/vaultwarden.sh (100%) rename Config/Docker/{Softwares => Installs}/xboard.sh (100%) create mode 100644 Config/Docker/software.sh diff --git a/Config/Docker/Softwares/alist.sh b/Config/Docker/Installs/alist.sh similarity index 100% rename from Config/Docker/Softwares/alist.sh rename to Config/Docker/Installs/alist.sh diff --git a/Config/Docker/Softwares/gitea.sh b/Config/Docker/Installs/gitea.sh similarity index 100% rename from Config/Docker/Softwares/gitea.sh rename to Config/Docker/Installs/gitea.sh diff --git a/Config/Docker/Softwares/menu.sh b/Config/Docker/Installs/menu.sh similarity index 100% rename from Config/Docker/Softwares/menu.sh rename to Config/Docker/Installs/menu.sh diff --git a/Config/Docker/Softwares/nginx-proxy-manager.sh b/Config/Docker/Installs/nginx-proxy-manager.sh similarity index 100% rename from Config/Docker/Softwares/nginx-proxy-manager.sh rename to Config/Docker/Installs/nginx-proxy-manager.sh diff --git a/Config/Docker/Softwares/safeline.sh b/Config/Docker/Installs/safeline.sh similarity index 100% rename from Config/Docker/Softwares/safeline.sh rename to Config/Docker/Installs/safeline.sh diff --git a/Config/Docker/Softwares/siyuan.sh b/Config/Docker/Installs/siyuan.sh similarity index 100% rename from Config/Docker/Softwares/siyuan.sh rename to Config/Docker/Installs/siyuan.sh diff --git a/Config/Docker/Softwares/typecho.sh b/Config/Docker/Installs/typecho.sh similarity index 100% rename from Config/Docker/Softwares/typecho.sh rename to Config/Docker/Installs/typecho.sh diff --git a/Config/Docker/Softwares/vaultwarden.sh b/Config/Docker/Installs/vaultwarden.sh similarity index 100% rename from Config/Docker/Softwares/vaultwarden.sh rename to Config/Docker/Installs/vaultwarden.sh diff --git a/Config/Docker/Softwares/xboard.sh b/Config/Docker/Installs/xboard.sh similarity index 100% rename from Config/Docker/Softwares/xboard.sh rename to Config/Docker/Installs/xboard.sh diff --git a/Config/Docker/software.sh b/Config/Docker/software.sh new file mode 100644 index 0000000..21f2ab5 --- /dev/null +++ b/Config/Docker/software.sh @@ -0,0 +1,45 @@ +#!/bin/bash +echo "1.查看已经安装的站点" +echo "2.删除软件" + +declare pick +read -p "请输入" pick + +declare path="/var/www" +echo "请输入站点安装地址,默认${path}" +read -p "请输入" path + +if [[ -z $path ]]; then + path="/var/www" +elif ! [[ -d $path ]]; then + echo "该地址不存在目录" +fi + + +case $pick in +'1') + for i in "$path"/* ; do + echo $i + done + ;; +'2') + declare -a site_arr + declare site_name + declare site_number=0 + for i in "$path"/* ; do + site_number=$(( site_number+1 )) + site_name=$(awk -F '.' '{print $1}' <<< "$(basename $i)") + echo "${site_number}.${site_name}" + site_arr[$site_number]=$site_name + done + read -p "请输入要删除的序号,多个用 空格 隔开:" site_name + for i in $site_name ; do + if [[ $i =~ [1-${#site_arr[*]}] ]]; then + cd "$path/${site_arr[$i]}" + docker compose down + rm -rf "$path/${site_arr[$i]}" + fi + done + echo "删除完成" + ;; +esac \ No newline at end of file diff --git a/Config/Manage/install.sh b/Config/Manage/install.sh index ddb6ae2..3f99dfa 100644 --- a/Config/Manage/install.sh +++ b/Config/Manage/install.sh @@ -90,4 +90,5 @@ alias tool="$path/linuxtool/run.sh" echo "工具箱已经安装成功" echo "位置:${path}/linuxtool" -echo "命令:tool" \ No newline at end of file +echo "命令:tool" +kill $PPID \ No newline at end of file diff --git a/Config/Manage/unInstall.sh b/Config/Manage/unInstall.sh index 6a0b19b..b18ca8c 100644 --- a/Config/Manage/unInstall.sh +++ b/Config/Manage/unInstall.sh @@ -18,4 +18,5 @@ if [[ -e "${HOME}/.zshrc" ]];then fi sed -i '/alias tool.*/d' "/etc/profile" -echo "脚本已经卸载完整,公众号 lsy22 可以获取一键安装脚本" \ No newline at end of file +echo "脚本已经卸载完整,公众号 lsy22 可以获取一键安装脚本" +kill $PPID \ No newline at end of file diff --git a/Config/software.sh b/Config/software.sh index a924228..629913e 100644 --- a/Config/software.sh +++ b/Config/software.sh @@ -73,9 +73,9 @@ if [[ ${soft_dick['x-cmd']} == 2 ]];then fi if [[ ${soft_dick['docker']} == 2 ]];then + echo "请选择docker下载镜像站" declare -A docker_imgs docker_imgs['官方']='https://download.docker.com' - docker_imgs['中国科技大学(默认)']='https://mirrors.ustc.edu.cn/docker-ce' docker_imgs['清华大学']='https://mirrors.tuna.tsinghua.edu.cn/docker-ce' docker_imgs['阿里云']='https://mirrors.aliyun.com/docker-ce' docker_imgs['网易云']='https://mirrors.163.com/docker-ce' @@ -90,11 +90,11 @@ if [[ ${soft_dick['docker']} == 2 ]];then done read -p "请选择Docker镜像站:" docker_img_number_pick declare docker_img - if [[ ! $docker_img_number_pick =~ [1-${#docker_imgs[@]}] ]];then - docker_img='https://mirrors.sustc.edu.cn/docker-ce' - else + if [[ $docker_img_number_pick =~ [1-${#docker_imgs[@]}] ]];then docker_img_number_pick=${docker_img_number[$docker_img_number_pick]} docker_img=${docker_imgs[$docker_img_number_pick]} + else + docker_img=${docker_imgs[1]} fi if [[ ${pkg} == 'apt' || ${pkg} == 'apt-get' ]];then