diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml index 106c9df..4929923 100644 --- a/.idea/dataSources.local.xml +++ b/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + #@ diff --git a/Public/dep/octopus-offline-nginx.conf b/Public/dep/octopus-offline-nginx.conf new file mode 100644 index 0000000..9964a90 --- /dev/null +++ b/Public/dep/octopus-offline-nginx.conf @@ -0,0 +1,35 @@ +server { + + listen 80; + + location /octopus-agent/ { + + root /data/github-action; + + autoindex on; # 开启目录浏览功能; + } + + + location /shell/ { + + root /data/github-action; + + autoindex on; # 开启目录浏览功能; + + } + + location /agent-config/ { + + root /data/github-action; + + autoindex on; # 开启目录浏览功能; + + } + + location /agent-version { + add_header Content-Type text/plain; + alias /data/github-action/agent-version; + } + + +} diff --git a/Public/init-script-wdd.sh b/Public/init-script-wdd.sh index d1ba575..217d02e 100644 --- a/Public/init-script-wdd.sh +++ b/Public/init-script-wdd.sh @@ -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_ # 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_ - 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 diff --git a/Public/sync-agent-for-offline.sh b/Public/sync-agent-for-offline.sh deleted file mode 100644 index 7233a9b..0000000 --- a/Public/sync-agent-for-offline.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash - -# set -o errexit -# set -o nounset -# set -o pipefail - - -octopus_agent_url=https://happybirthday.107421.xyz/octopus-agent -agent_config_url=https://happybirthday.107421.xyz/agent-config -default_octopus_agent_local_path=/data/github-action/octopus-agent/ -default_octopus_agent_config_local_path=/data/github-action/agent-config/ - - -sync_octopus_agent(){ - - local octopus_agent_html="octopus_agent.html" - - rm -rf ${octopus_agent_html} - wget "$octopus_agent_url/" -qO ${octopus_agent_html} - - if [[ ! -s $octopus_agent_html ]]; then - echo "[sync_octopus_agent] - download agent version file error ! return false !" - return 233 - fi - - echo "清除旧的Agnet内容" - rm -rf ${default_octopus_agent_local_path} - mkdir -p ${default_octopus_agent_local_path} - echo "" - - echo "开始同步最新版本的Octopus Agent !" - local octopus_agent_config_file_list="" - # shellcheck disable=SC2034 - octopus_agent_config_file_list=$(cat ${octopus_agent_html} | grep -v h1 | grep "a href=" | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | tr "\n" " ") - local octopus_agent_config_list - IFS=" " read -ra octopus_agent_config_list <<<"$octopus_agent_config_file_list" - echo "" - local octopus_agent_file - for octopus_agent_file in "${octopus_agent_config_list[@]}" - do - echo "[sync_octopus_agent] => start to download => ${octopus_agent_url}/${octopus_agent_file}" - wget "${octopus_agent_url}/${octopus_agent_file}" -qO "${default_octopus_agent_local_path}${octopus_agent_file}" - echo "" - - if [[ ! -s "${default_octopus_agent_local_path}${octopus_agent_file}" ]]; then - echo "" - echo "[sync_octopus_agent] - ERROR download file ${octopus_agent_url}/${octopus_agent_file} !" - echo "" - return 233 - fi - - done - - echo "[sync_octopus_agent] - check for octopus agent download .." - echo "" - ls ${default_octopus_agent_local_path} - echo "" - echo "" - -} - -sync_octopus_agent_config(){ - - local octopus_agent_config_html="octopus_agent_config.html" - - rm -rf ${octopus_agent_config_html} - wget "$agent_config_url/" -qO ${octopus_agent_config_html} - - if [[ ! -s $octopus_agent_config_html ]]; then - echo "[sync_octopus_agent_config] - download agent config file error ! return false !" - return 233 - fi - - echo "清除旧的Agnet Config内容" - rm -rf $default_octopus_agent_config_local_path - mkdir -p ${default_octopus_agent_config_local_path} - echo "" - echo "开始同步最新版本的Octopus Agent Config !" - - local octopus_agent_config_file_list="" - # shellcheck disable=SC2034 - octopus_agent_config_file_list=$(cat ${octopus_agent_config_html} | grep -v h1 | grep "a href=" | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | tr "\n" " ") - local octopus_agent_config_list - IFS=" " read -ra octopus_agent_config_list <<<"$octopus_agent_config_file_list" - echo "" - local octopus_agent_config_file - for octopus_agent_config_file in "${octopus_agent_config_list[@]}" - do - echo "[sync_octopus_agent_config] => start to download => ${agent_config_url}/${octopus_agent_config_file}" - wget "${agent_config_url}/${octopus_agent_config_file}" -qO "${default_octopus_agent_config_local_path}${octopus_agent_config_file}" - echo "" - - if [[ ! -s "${default_octopus_agent_config_local_path}${octopus_agent_config_file}" ]]; then - echo "" - echo "[sync_octopus_agent_config] - ERROR download file ${agent_config_url}/${octopus_agent_config_file} !" - echo "" - return 233 - fi - - done - - echo "[sync_octopus_agent_config] - check for octopus agent config download .." - echo "" - ls ${default_octopus_agent_config_local_path} - echo "" - echo "" - -} - -main(){ - - sync_octopus_agent - - sync_octopus_agent_config - -} - -main diff --git a/Public/sync-base-script.ps1 b/Public/sync-base-script.ps1 new file mode 100644 index 0000000..4e722eb --- /dev/null +++ b/Public/sync-base-script.ps1 @@ -0,0 +1,42 @@ +function SayHello +{ + param ( + [string]$Name + ) + Write-Host "Hello, $Name!" +} + +# 调用函数 +SayHello -Name "Test PowerShell" + +function SetMinioAlias +{ + mc.exe alias set local http://10.250.0.100:9000 cmii B#923fC7mk + mc.exe alias set tc-sh http://42.192.52.227:9000 cmii B#923fC7mk + mc.exe alias set seoul-1 https://cnk8d6fazu16.compat.objectstorage.ap-seoul-1.oraclecloud.com aed62d24d85e2da809ce02bf272420ba4ed74820 rQdEcn69K049+JkA1IGoQmC1k8zma8zfWvZvVS0h144= +} + +SetMinioAlias + +# 获取当前工作目录 +$currentDirectory = Get-Location +# 打印当前工作目录 +Write-Host "Current directory: $currentDirectory" +Write-Host "" + +# 获取当前目录的所有文件名 +$files = Get-ChildItem -Path $currentDirectory -Recurse -File -Name + +# 遍历并打印文件名 +foreach ($file in $files) +{ + Write-Output $currentDirectory\$file + Write-Host "" + mc.exe cp $currentDirectory\$file local/octopus/ + mc.exe cp $currentDirectory\$file tc-sh/octopus/ + mc.exe cp $currentDirectory\$file seoul-1/seoul/ + Write-Host "" +} + +Write-Host "" +Write-Host "Octopus Agent all dependency file has been synchronized!" \ No newline at end of file diff --git a/Public/sync-minio-to-target.sh b/Public/sync-minio-to-target.sh deleted file mode 100644 index f4b958b..0000000 --- a/Public/sync-minio-to-target.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -target_minio="http://42.192.52.227:9000" -local_minio="http://localhost:9000" -minio_user_name="cmii" -minio_user_pass="B#923fC7mk" -bucket_name="octopus" - - -main() { - # alies -# mc alias set local ${local_minio} ${minio_user_name} ${minio_user_pass} -# mc alias set public ${target_minio} ${minio_user_name} ${minio_user_pass} - - mc mb public/${bucket_name} - - echo "" - # ls - local file - for file in $(mc ls local/${bucket_name}/ | awk '{print$6}') - do - echo "the current file is ${file}" - mc cp local/$bucket_name/"$file" public/$bucket_name/"$file" - done - -} - -main diff --git a/v2ray示例/98-subscribe-clash.yaml b/v2ray示例/98-subscribe-clash.yaml index a09547f..0413f3d 100644 --- a/v2ray示例/98-subscribe-clash.yaml +++ b/v2ray示例/98-subscribe-clash.yaml @@ -12,6 +12,37 @@ allow-lan: true mode: Rule log-level: info external-controller: 0.0.0.0:9090 +dns: + enable: true + listen: 0.0.0.0:53 + ipv6: true + default-nameserver: + - 1.1.1.1 + - 223.5.5.5 + - 192.168.78.39 + nameserver: + - https://1.1.1.1/dns-query + - https://1.0.0.2/dns-query + - https://9.9.9.9/dns-query + fallback: + - 192.168.78.39 + - 192.168.34.40 + - https://dns.alidns.com/dns-query + - https://doh.pub/dns-query + fallback-filter: + geoip: true + geoip-code: CN + domain: + - oa.cdcyy.cn + - ir.hq.cmcc + - ywzc.cdcyy.cn + - "*.hq.cmcc" + - cps.hq.cmcc + ipcidr: + - 240.0.0.0/4 + - 192.168.78.0/24 + - 192.168.34.0/24 + - 192.168.35.0/24 proxies: - {"type":"vmess","name":"us-cente-free","ws-opts":{"path":"/vmess"},"server":"northflank.107421.xyz","port":443,"uuid":"de04add9-5c68-8bab-950c-08cd5320df18","alterId":0,"cipher":"auto","network":"ws","tls":true} - {"type":"trojan","name":"Seoul-Trojan","server":"140.238.14.103","port":443,"password":"V2ryStr0ngP0ss","udp":true,"skip-cert-verify":false,"sni":"xx.s4.cc.hh.107421.xyz","network":"tcp","ws-opts":{"headers":{"host":"xx.s4.cc.hh.107421.xyzh2,http/1.1"}}}