diff --git a/Config/Automation/acme_update.sh b/Config/Automation/Installs/acme_update.sh similarity index 100% rename from Config/Automation/acme_update.sh rename to Config/Automation/Installs/acme_update.sh diff --git a/Config/Automation/backup.sh b/Config/Automation/Installs/backup.sh similarity index 100% rename from Config/Automation/backup.sh rename to Config/Automation/Installs/backup.sh diff --git a/Config/Automation/menu.sh b/Config/Automation/Installs/menu.sh similarity index 100% rename from Config/Automation/menu.sh rename to Config/Automation/Installs/menu.sh diff --git a/Config/Automation/up-docker_compose.sh b/Config/Automation/Installs/up-docker_compose.sh similarity index 100% rename from Config/Automation/up-docker_compose.sh rename to Config/Automation/Installs/up-docker_compose.sh diff --git a/Config/Automation/update.sh b/Config/Automation/Installs/update.sh similarity index 100% rename from Config/Automation/update.sh rename to Config/Automation/Installs/update.sh diff --git a/Config/Docker/Software/Alist.sh b/Config/Docker/Softwares/alist.sh similarity index 100% rename from Config/Docker/Software/Alist.sh rename to Config/Docker/Softwares/alist.sh diff --git a/Config/Docker/Software/Gitea.sh b/Config/Docker/Softwares/gitea.sh similarity index 100% rename from Config/Docker/Software/Gitea.sh rename to Config/Docker/Softwares/gitea.sh diff --git a/Config/Docker/Software/menu.sh b/Config/Docker/Softwares/menu.sh similarity index 100% rename from Config/Docker/Software/menu.sh rename to Config/Docker/Softwares/menu.sh diff --git a/Config/Docker/Software/Nginx-proxy-manager.sh b/Config/Docker/Softwares/nginx-proxy-manager.sh similarity index 100% rename from Config/Docker/Software/Nginx-proxy-manager.sh rename to Config/Docker/Softwares/nginx-proxy-manager.sh diff --git a/Config/Docker/Software/Safeline.sh b/Config/Docker/Softwares/safeline.sh similarity index 100% rename from Config/Docker/Software/Safeline.sh rename to Config/Docker/Softwares/safeline.sh diff --git a/Config/Docker/Software/Siyuan.sh b/Config/Docker/Softwares/siyuan.sh similarity index 100% rename from Config/Docker/Software/Siyuan.sh rename to Config/Docker/Softwares/siyuan.sh diff --git a/Config/Docker/Software/Typecho.sh b/Config/Docker/Softwares/typecho.sh similarity index 100% rename from Config/Docker/Software/Typecho.sh rename to Config/Docker/Softwares/typecho.sh diff --git a/Config/Docker/Software/Vaultwarden.sh b/Config/Docker/Softwares/vaultwarden.sh similarity index 100% rename from Config/Docker/Software/Vaultwarden.sh rename to Config/Docker/Softwares/vaultwarden.sh diff --git a/Config/Docker/Software/Xboard.sh b/Config/Docker/Softwares/xboard.sh similarity index 100% rename from Config/Docker/Software/Xboard.sh rename to Config/Docker/Softwares/xboard.sh diff --git a/Config/Docker/image.sh b/Config/Docker/image.sh new file mode 100644 index 0000000..4b77560 --- /dev/null +++ b/Config/Docker/image.sh @@ -0,0 +1,31 @@ +#!/bin/bash +echo "1.查看当前运行中的镜像" +echo "2.停止镜像" +echo "3.删除没有使用的镜像" + +declare pick +read -p "请输入:" pick + +case $pick in +'1') + docker ps --format "{{.Names}}" + ;; +'2') + declare -a deocker_arr=($(docker ps --format "{{.Names}}")) + declare deocker_number=0 + for i in "${!deocker_arr[@]}" ; do + deocker_number=$(( deocker_number+1 )) + echo "${deocker_number}.${i}" + done + echo "要删除的镜像序号,多个镜像用 空格 隔开" + read -p "请输入:" pick + for i in $pick ; do + if [[ $i =~ [1-$deocker_number] ]]; then + docker rmi "${deocker_arr[$i]}" + fi + done + ;; +'3') + docker system prune -af + echo "清理完成" +esac \ No newline at end of file diff --git a/Config/Docker/source.sh b/Config/Docker/source.sh new file mode 100644 index 0000000..4490317 --- /dev/null +++ b/Config/Docker/source.sh @@ -0,0 +1,42 @@ +#!/bin/bash +echo "========$(basename $0 .sh)========" +echo "1.查看当前源" +echo "2.换源" +declare pick +read -p "请输入:" pick + +case $pick in +'1') + grep -oP '(https?://[^\"]+)' /etc/docker/daemon.json + ;; +'2') + declare -A img_dick + declare -a img_number + declare img_pick=0 + img_dick['Daocloud(默认)']='https://docker.m.daocloud.io' + img_dick['官方']='docker.io' + + for i in "${!img_dick[@]}"; + do + img_pick=$(( img_pick+1 )) + img_number[$img_pick]=$i + echo "${img_pick}.${i}" + done + read -p "请输入要选择的镜像,也可直接输入镜像网站:" img_pick + if [[ -z $img_pick ]];then + declare url='https://docker.m.daocloud.io' + elif [[ $img_pick =~ [\w\.]+ ]];then + declare url=$img_pick + elif [[ ${img_pick} =~ [1-${!img_dick[*]}] ]];then + img_pick=${img_number[$img_pick]} + declare url=${img_dick[$img_pick]} + else + echo "输入错误" + exit + fi + echo "{\"registry-mirrors\": [\"${url}\"]}" > "/etc/docker/daemon.json" + systemctl restart docker 2>> /dev/null|| echo "docker 重启失败"&&exit + echo "换源成功" + + ;; +esac \ No newline at end of file diff --git a/Config/Manage/Install.sh b/Config/Manage/install.sh similarity index 100% rename from Config/Manage/Install.sh rename to Config/Manage/install.sh diff --git a/Config/Other/Language_set.sh b/Config/Other/language.sh similarity index 100% rename from Config/Other/Language_set.sh rename to Config/Other/language.sh diff --git a/Config/Other/Reinstall.sh b/Config/Other/reinstall.sh similarity index 100% rename from Config/Other/Reinstall.sh rename to Config/Other/reinstall.sh diff --git a/Menus/Software.sh b/Config/Software.sh similarity index 100% rename from Menus/Software.sh rename to Config/Software.sh diff --git a/Config/Vpn.sh b/Config/vpn.sh similarity index 100% rename from Config/Vpn.sh rename to Config/vpn.sh diff --git a/Menus/Docker.sh b/Menus/Docker.sh index f653539..2b2c637 100644 --- a/Menus/Docker.sh +++ b/Menus/Docker.sh @@ -23,36 +23,10 @@ read -p "请输入要使用的功能:" pick clear if [[ $pick == '1' ]];then - declare -A img_dick - declare -a img_number - declare img_pick=0 - img_dick['Daocloud(默认)']='https://docker.m.daocloud.io' - for i in "${!img_dick[@]}"; - do - img_pick=$(( img_pick+1 )) - img_number[$img_pick]=$i - echo "${img_pick}.${i}" - done - read -p "请输入要选择的镜像,也可直接输入镜像网站:" img_pick - if [[ -z $img_pick ]];then - declare url='https://docker.m.daocloud.io' - elif [[ $img_pick =~ [\w\.]+ ]];then - declare url=$img_pick - elif [[ ${img_pick} =~ [1-${!img_dick[*]}] ]];then - img_pick=${img_number[$img_pick]} - declare url=${img_dick[$img_pick]} - else - echo "输入错误" - exit - fi - echo "{\"registry-mirrors\": [\"${url}\"]}" > "/etc/docker/daemon.json" - systemctl restart docker 2>> /dev/null|| echo "docker 重启失败"&&exit - echo "换源成功" elif [[ $pick == '2' ]];then - docker system prune -af - echo "清理完成" + elif [[ "${pick}" =~ [${pick_number}-${#pick_array[*]}] ]];then fi diff --git a/Run.sh b/Run.sh index 4ad3337..14e76a2 100644 --- a/Run.sh +++ b/Run.sh @@ -27,6 +27,7 @@ if [[ -e "${path_local}/menu.sh" ]]; then path_local=$path_script fi pick_number=0 +pick_array=() echo "======$(basename $path_local .sh)======" for i in "${path_local}"/* do