[video] 新增video线管的内容

This commit is contained in:
zeaslity
2023-12-20 11:34:58 +08:00
parent 57b95e3610
commit 152aa80fe6
10 changed files with 402 additions and 14 deletions

View File

@@ -0,0 +1,118 @@
#!/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