[ clash ] 新增clash-sub

This commit is contained in:
zeaslity
2024-04-14 15:27:48 +08:00
parent 7883ddeba5
commit 714ff01639
7 changed files with 164 additions and 179 deletions

View File

@@ -7,11 +7,14 @@
docker_version=20.10.10
#oss_url_prefix="http://10.250.0.100:9000/octopus"
#oss_url_prefix="http://42.192.52.227:9000/octopus"
oss_url_prefix="https://oss-s1.107421.xyz"
modify_ssh_port=22333
octopus_agent_path=/usr/local/etc/octpus-agent
octopus_agent_url=https://happybirthday.107421.xyz/octopus-agent
agent_config_url=https://happybirthday.107421.xyz/agent-config
agent_version_url=https://happybirthday.107421.xyz/agent-version
octopus_latest_version=123
offline_host_ip="https://oss-s1.107421.xyz"
# 脚本执行内容
@@ -497,24 +500,24 @@ EOF
if [[ $deploy_in_cn -eq 1 ]]; then
log "开始从 Gitee 下载 自动补全 插件…………"
git clone https://gitee.com/wangl-cc/zsh-autosuggestions.git ~/.oh-my-zsh/plugins/zsh-autosuggestions
git clone https://gitee.com/wangl-cc/zsh-autosuggestions.git ~/.oh-my-zsh/plugins/zsh-autosuggestions
else
log "开始从 GitHub 下载 自动补全 插件…………"
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
fi
SplitGreen
if [[ $deploy_in_cn -eq 1 ]]; then
log "开始从 Gitee 下载 命令高亮 插件…………"
git clone https://gitee.com/xiaoqqya/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
git clone https://gitee.com/xiaoqqya/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
else
log "开始从 GitHub 下载 命令高亮 插件…………"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
fi
SplitGreen
log "开始从JSDeliver下载插件…………"
wget -c -i ~/oh-my-zsh-plugins-list.txt -P ~/.oh-my-zsh/plugins/
wget --timeout=3 -c -i ~/oh-my-zsh-plugins-list.txt -P ~/.oh-my-zsh/plugins/
SplitGreen
colorEchoGreen "插件已经下载完毕现在开始修改zsh的配置文件…………"
@@ -907,7 +910,7 @@ SyslogIdentifier=octopus-agent
User=root
Type=simple
WorkingDirectory=$octopus_agent_path
ExecStart=$octopus_agent_path/octopus-agent -agentServerInfoConf=$octopus_agent_path/octopus-agent.conf -version=standard
ExecStart=$octopus_agent_path/octopus-agent -agentServerInfoConfFile=$octopus_agent_path/octopus-agent.conf -version=standard
ExecStop=/bin/kill -15 \$MAINPID
[Install]
@@ -927,6 +930,21 @@ EOF
FunctionEnd
}
get_octopus_agent_latest_version(){
# 2024年4月8日
FunctionStart "查询 Octopus Agent 最新的版本!"
octopus_latest_version=$(curl -s -timeout=5 "${agent_version_url}")
if [[ $octopus_latest_version -eq "123" ]]; then
echo "find_octopus_latest_version error ! "
return 233
else
echo "find_octopus_latest_version is => $octopus_latest_version"
fi
ColorEchoGreen "Octopus Agent 最新的版本为 => $octopus_latest_version"
}
#######################################
# description
# Globals:
@@ -948,26 +966,28 @@ install_octopus_agent() {
if [[ $is_offline -eq 1 ]]; then
octopus_agent_url="http://${offline_host_ip}/octopus-agent"
agent_config_url="http://${offline_host_ip}/agent-config"
agent_version_url="http://${offline_host_ip}/agent-version"
colorEchoBlue "[install_octopus_agent] - offline agent url are => $octopus_agent_url"
fi
local latest_version=""
latest_version=$(curl "$octopus_agent_url/" | grep -v h1 | grep "a href=" | head -1 | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | cut -d"_" -f4-)
# local octopus_latest_version=""
# octopus_latest_version=$(curl "$octopus_agent_url/" | grep -v h1 | grep "a href=" | head -1 | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | cut -d"_" -f4-)
#
# if [[ $latest_version == "" ]]; then
# echo ""
# colorEchoRed "[install_octopus_agent] - get agent version error ! break !"
# colorEchoRed "[install_octopus_agent] - get agent version error ! break !"
# echo ""
# return 233
# fi
get_octopus_agent_latest_version
if [[ $latest_version == "" ]]; then
echo ""
colorEchoRed "[install_octopus_agent] - get agent version error ! break !"
colorEchoRed "[install_octopus_agent] - get agent version error ! break !"
echo ""
return 233
fi
log "查询得到的Octopus Agent的最新版本为 => ${latest_version}"
log "查询得到的Octopus Agent的最新版本为 => ${octopus_latest_version}"
SplitBlue
# Agent二进制文件的命名规则为 octopus-agent_linux_amd64_<version>
# shellcheck disable=SC2154
local agent_latest_version="octopus-agent_linux_${linux_release}_${latest_version}"
local agent_latest_version="octopus-agent_linux_${linux_release}_${octopus_latest_version}"
colorEchoBlue "octopus agent latest version is => [ $agent_latest_version ]"
log "开始下载最新版本的Octopus Agent !"
@@ -1046,8 +1066,8 @@ EOF
update_octopus_agent(){
FunctionStart "更新 Octopus Agent"
# find octopus agent by service path
local systemd_config_path=("/lib/systemd/system/" "/etc/systemd/system/")
local systemd_config_file
local agent_installed=0
# shellcheck disable=SC2068
@@ -1074,28 +1094,30 @@ EOF
colorEchoBlue "开始检查最新的版本!"
# add for ofline version
# add for offline version
if [[ $is_offline -eq 1 ]]; then
octopus_agent_url="http://$offline_host_ip/octopus-agent"
agent_config_url="http://$offline_host_ip/agent-config"
agent_version_url="http://${offline_host_ip}/agent-version"
colorEchoBlue "[install_octopus_agent] - offline agent url are => $octopus_agent_url"
fi
local latest_version=""
latest_version=$(curl "$octopus_agent_url/" | grep -v h1 | grep "a href=" | head -1 | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | cut -d"_" -f4-)
log "查询得到的Octopus Agent的最新版本为 => ${latest_version}"
if [[ $latest_version == "" ]]; then
echo ""
colorEchoRed "[update_octopus_agent] - get agent version error ! break !"
colorEchoRed "[update_octopus_agent] - get agent version error ! break !"
echo ""
return 233
fi
# local octopus_latest_version=""
# octopus_latest_version=$(curl "$octopus_agent_url/" | grep -v h1 | grep "a href=" | head -1 | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | cut -d"_" -f4-)
#
# log "查询得到的Octopus Agent的最新版本为 => ${octopus_latest_version}"
# if [[ $latest_version == "" ]]; then
# echo ""
# colorEchoRed "[update_octopus_agent] - get agent version error ! break !"
# colorEchoRed "[update_octopus_agent] - get agent version error ! break !"
# echo ""
# return 233
# fi
get_octopus_agent_latest_version
SplitBlue
# Agent二进制文件的命名规则为 octopus-agent_linux_amd64_<version>
local agent_latest_version="octopus-agent_linux_${linux_release}_${latest_version}"
local agent_latest_version="octopus-agent_linux_${linux_release}_${octopus_latest_version}"
colorEchoBlue "octopus agent latest version is => [ $agent_latest_version ]"
log "开始下载最新版本的Octopus Agent !"
@@ -1107,6 +1129,7 @@ EOF
colorEchoBlue "---------------- ls the ${octopus_agent_path} ----------------------"
ls ${octopus_agent_path} | grep octopus-agent
echo ""
echo ""
log "开始下载 Octopus Agent Config !"
rm -rf index.html