更新软件结构
This commit is contained in:
parent
8b5d304ec4
commit
db267ea0b9
@ -19,7 +19,7 @@ for item in "$web_path"/* ; do
|
||||
echo "${item_name}"
|
||||
done
|
||||
|
||||
echo "请输入需要屏蔽的目录用逗号隔开"
|
||||
echo "请输入需要屏蔽的目录用 空格 隔开"
|
||||
read -p "请输入:" ignore
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ declare print_number=0
|
||||
declare -a print_array
|
||||
for i in "${path_local}"/*;do
|
||||
file_name=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
|
||||
if [[ $file_name == "test" ]]; then
|
||||
if [[ $file_name == "test" || $file_name == "menu" ]]; then
|
||||
continue
|
||||
fi
|
||||
print_number=$((print_number + 1))
|
||||
|
57
Config/Docker/Software/menu.sh
Normal file
57
Config/Docker/Software/menu.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
declare path_local=$1
|
||||
declare pick
|
||||
declare file_name
|
||||
echo "========$(basename $0 .sh)========"
|
||||
declare print_number=0
|
||||
declare -a print_array
|
||||
for i in "${path_local}"/*;do
|
||||
file_name=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
|
||||
if [[ $file_name == "test" || $file_name == "menu" ]]; then
|
||||
continue
|
||||
fi
|
||||
print_number=$((print_number + 1))
|
||||
print_array[$print_number]=$file_name
|
||||
echo "${print_number}.${file_name}"
|
||||
done
|
||||
echo "输入其他任意返回主页"
|
||||
read -p "请输入:" pick
|
||||
|
||||
if [[ ! ${pick} =~ [1-$print_number] ]];then
|
||||
exit
|
||||
fi
|
||||
|
||||
declare file_path
|
||||
read -p "请输入软件储存位置,默认 /var/www/${print_array[${pick}]} :" file_path
|
||||
if [[ -z ${file_path} ]];then
|
||||
file_path="/var/www/${print_array[${pick}]}"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$file_path" ]];then
|
||||
sudo mkdir -p "$file_path" || { echo "目录创建失败"; exit 1; }
|
||||
elif [[ ! -z "$(find "$file_path" -mindepth 1 -print -quit)" ]];then
|
||||
echo "该目录存有文件"
|
||||
exit
|
||||
fi
|
||||
|
||||
declare dport=$(($RANDOM % 9000 + 1000))
|
||||
|
||||
while ss -tuln | grep $dport &> /dev/null
|
||||
do
|
||||
dport=$(($RANDOM % 9000 + 1000))
|
||||
done
|
||||
|
||||
declare port
|
||||
read -p "请输入访问端口,默认 $dport :" port
|
||||
|
||||
if [[ -z $port ]];then
|
||||
port=$dport
|
||||
fi
|
||||
|
||||
if ss -tuln | grep $port &> /dev/null;then
|
||||
echo "端口已被占用"
|
||||
exit
|
||||
fi
|
||||
|
||||
bash "${path_local}/${print_array[pick]}.sh" "$file_path" "$port"
|
||||
echo "${print_array[${pick}]}安装完成,访问端口${port}"
|
5
Config/Docker/test.sh
Normal file
5
Config/Docker/test.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "docker未安装"
|
||||
exit 1
|
||||
fi
|
@ -2,10 +2,6 @@
|
||||
|
||||
declare path_script=$1
|
||||
declare file_name=$(basename $0 .sh)
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "docker未安装"
|
||||
exit
|
||||
fi
|
||||
|
||||
declare pick_array
|
||||
declare pick_number=6
|
||||
@ -58,40 +54,7 @@ elif [[ $pick == '2' ]];then
|
||||
docker system prune -af
|
||||
echo "清理完成"
|
||||
elif [[ "${pick}" =~ [${pick_number}-${#pick_array[*]}] ]];then
|
||||
declare file_path
|
||||
read -p "请输入软件储存位置,默认 /var/www/${pick_array[${pick}]} :" file_path
|
||||
if [[ -z ${file_path} ]];then
|
||||
file_path="/var/www/${pick_array[${pick}]}"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$file_path" ]];then
|
||||
sudo mkdir -p "$file_path" || { echo "目录创建失败"; exit 1; }
|
||||
elif [[ ! -z "$(find "$file_path" -mindepth 1 -print -quit)" ]];then
|
||||
echo "该目录存有文件"
|
||||
exit
|
||||
fi
|
||||
|
||||
declare dport=$(($RANDOM % 9000 + 1000))
|
||||
|
||||
while ss -tuln | grep $dport &> /dev/null
|
||||
do
|
||||
dport=$(($RANDOM % 9000 + 1000))
|
||||
done
|
||||
|
||||
declare port
|
||||
read -p "请输入访问端口,默认 $dport :" port
|
||||
|
||||
if [[ -z $port ]];then
|
||||
port=$dport
|
||||
fi
|
||||
|
||||
if ss -tuln | grep $port &> /dev/null;then
|
||||
echo "端口已被占用"
|
||||
exit
|
||||
fi
|
||||
|
||||
bash "${path_script}/Config/${file_name}/${pick_array[${pick}]}.sh" "$file_path" "$port"
|
||||
echo "${pick_array[${pick}]}安装完成,访问端口${port}"
|
||||
fi
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user