mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 22:56:07 +08:00
Merge branch 'whyour:master' into master
This commit is contained in:
commit
0c5136539d
|
@ -1,6 +1,6 @@
|
||||||
FROM node:lts-alpine
|
FROM node:lts-alpine
|
||||||
LABEL maintainer="whyour"
|
LABEL maintainer="whyour"
|
||||||
ARG QL_URL=https://ghproxy.com/https://github.com/whyour/qinglong.git
|
ARG QL_URL=https://github.com/whyour/qinglong.git
|
||||||
ARG QL_BRANCH=master
|
ARG QL_BRANCH=master
|
||||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||||
LANG=zh_CN.UTF-8 \
|
LANG=zh_CN.UTF-8 \
|
||||||
|
@ -16,6 +16,7 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
moreutils \
|
moreutils \
|
||||||
git \
|
git \
|
||||||
curl \
|
curl \
|
||||||
|
wget \
|
||||||
tzdata \
|
tzdata \
|
||||||
perl \
|
perl \
|
||||||
openssl \
|
openssl \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
## Version: v2.0.0-05302045
|
## Version: v2.0.0-05302045
|
||||||
## Date: 2021-05-30
|
## Date: 2021-05-30
|
||||||
## Update Content: 增加ql bot命令所需文件提示
|
## Update Content: 增加GithubProxyUrl参数,访问github链接不需要代理时,可移除此参数
|
||||||
|
|
||||||
## 上面版本号中,如果第2位数字有变化,那么代表增加了新的参数,如果只有第3位数字有变化,仅代表更新了注释,没有增加新的参数,可更新可不更新
|
## 上面版本号中,如果第2位数字有变化,那么代表增加了新的参数,如果只有第3位数字有变化,仅代表更新了注释,没有增加新的参数,可更新可不更新
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@ AutoDelCron="true"
|
||||||
## 在运行 ql repo 命令时,是否自动增加新的本地定时任务
|
## 在运行 ql repo 命令时,是否自动增加新的本地定时任务
|
||||||
AutoAddCron="true"
|
AutoAddCron="true"
|
||||||
|
|
||||||
|
## 由于github仓库拉取较慢,所以会默认添加代理前缀,如不需要请移除
|
||||||
|
GithubProxyUrl="https://ghproxy.com/"
|
||||||
|
|
||||||
## 设置定时任务执行的超时时间,默认1h,后缀"s"代表秒(默认值), "m"代表分, "h"代表小时, "d"代表天
|
## 设置定时任务执行的超时时间,默认1h,后缀"s"代表秒(默认值), "m"代表分, "h"代表小时, "d"代表天
|
||||||
CommandTimeoutTime="1h"
|
CommandTimeoutTime="1h"
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ import_config() {
|
||||||
done
|
done
|
||||||
|
|
||||||
command_timeout_time=${CommandTimeoutTime:-"1h"}
|
command_timeout_time=${CommandTimeoutTime:-"1h"}
|
||||||
|
github_proxy_url=${GithubProxyUrl:-""}
|
||||||
}
|
}
|
||||||
|
|
||||||
## 创建目录,$1:目录的绝对路径
|
## 创建目录,$1:目录的绝对路径
|
||||||
|
|
3
shell/test.sh
Normal file
3
shell/test.sh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
url="https://ghproxy.com/https://github.com/zooPanda/zoo.git"
|
||||||
|
github_proxy_url="https://ghproxy.com/"
|
||||||
|
echo "${github_proxy_url}${url/https:\/\/ghproxy.com\//}"
|
|
@ -96,7 +96,7 @@ del_cron() {
|
||||||
fi
|
fi
|
||||||
cron_file="$dir_scripts/${cron}"
|
cron_file="$dir_scripts/${cron}"
|
||||||
if [[ -f $cron_file ]]; then
|
if [[ -f $cron_file ]]; then
|
||||||
cron_name=$(grep "new Env" $cron_file | awk -F "'|\"" '{print $2}' | head -1)
|
cron_name=$(grep "new Env" $cron_file | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1)
|
||||||
rm -f $cron_file
|
rm -f $cron_file
|
||||||
fi
|
fi
|
||||||
[[ -z $cron_name ]] && cron_name="$cron"
|
[[ -z $cron_name ]] && cron_name="$cron"
|
||||||
|
@ -125,14 +125,15 @@ add_cron() {
|
||||||
if [ -f $file ]; then
|
if [ -f $file ]; then
|
||||||
cron_line=$(
|
cron_line=$(
|
||||||
perl -ne "{
|
perl -ne "{
|
||||||
print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*$file_name/
|
print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*/
|
||||||
}" $file |
|
}" $file |
|
||||||
perl -pe "{
|
perl -pe "{
|
||||||
s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*/?$file_name.*|\1|g;
|
s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*|\1|g;
|
||||||
s| | |g
|
s|\*([\d\*])(.*)|\1\2|g;
|
||||||
}" | sort -u | head -1
|
s| | |g;
|
||||||
|
}" | sort -u | head -1
|
||||||
)
|
)
|
||||||
cron_name=$(grep "new Env" $file | awk -F "'|\"" '{print $2}' | head -1)
|
cron_name=$(grep "new Env" $file | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1)
|
||||||
[[ -z $cron_name ]] && cron_name="$file_name"
|
[[ -z $cron_name ]] && cron_name="$file_name"
|
||||||
[[ -z $cron_line ]] && cron_line="0 6 * * *"
|
[[ -z $cron_line ]] && cron_line="0 6 * * *"
|
||||||
result=$(add_cron_api "$cron_line:$cmd_task $file:$cron_name")
|
result=$(add_cron_api "$cron_line:$cmd_task $file:$cron_name")
|
||||||
|
@ -164,7 +165,7 @@ update_repo() {
|
||||||
|
|
||||||
local repo_path="${dir_repo}/${author}_${repo}"
|
local repo_path="${dir_repo}/${author}_${repo}"
|
||||||
if [ -d ${repo_path}/.git ]; then
|
if [ -d ${repo_path}/.git ]; then
|
||||||
reset_romote_url ${repo_path} ${url}
|
reset_romote_url ${repo_path} "${github_proxy_url}${url/https:\/\/ghproxy.com\//}"
|
||||||
git_pull_scripts ${repo_path}
|
git_pull_scripts ${repo_path}
|
||||||
else
|
else
|
||||||
git_clone_scripts ${url} ${repo_path}
|
git_clone_scripts ${url} ${repo_path}
|
||||||
|
@ -193,14 +194,15 @@ update_raw() {
|
||||||
cp -f $raw_file_name $dir_scripts/${filename}
|
cp -f $raw_file_name $dir_scripts/${filename}
|
||||||
cron_line=$(
|
cron_line=$(
|
||||||
perl -ne "{
|
perl -ne "{
|
||||||
print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*$raw_file_name/
|
print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*/
|
||||||
}" $raw_file_name |
|
}" $raw_file_name |
|
||||||
perl -pe "{
|
perl -pe "{
|
||||||
s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*/?$raw_file_name.*|\1|g;
|
s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*|\1|g;
|
||||||
s| | |g
|
s|\*([\d\*])(.*)|\1\2|g;
|
||||||
|
s| | |g;
|
||||||
}" | sort -u | head -1
|
}" | sort -u | head -1
|
||||||
)
|
)
|
||||||
cron_name=$(grep "new Env" $raw_file_name | awk -F "'|\"" '{print $2}' | head -1)
|
cron_name=$(grep "new Env" $raw_file_name | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1)
|
||||||
[[ -z $cron_name ]] && cron_name="$raw_file_name"
|
[[ -z $cron_name ]] && cron_name="$raw_file_name"
|
||||||
[[ -z $cron_line ]] && cron_line="0 6 * * *"
|
[[ -z $cron_line ]] && cron_line="0 6 * * *"
|
||||||
if [[ -z $cron_id ]]; then
|
if [[ -z $cron_id ]]; then
|
||||||
|
@ -244,6 +246,7 @@ usage() {
|
||||||
update_qinglong() {
|
update_qinglong() {
|
||||||
echo -e "--------------------------------------------------------------\n"
|
echo -e "--------------------------------------------------------------\n"
|
||||||
[ -f $dir_root/package.json ] && ql_depend_old=$(cat $dir_root/package.json)
|
[ -f $dir_root/package.json ] && ql_depend_old=$(cat $dir_root/package.json)
|
||||||
|
reset_romote_url ${dir_root} "${github_proxy_url}https://github.com/whyour/qinglong.git"
|
||||||
git_pull_scripts $dir_root
|
git_pull_scripts $dir_root
|
||||||
|
|
||||||
if [[ $exit_status -eq 0 ]]; then
|
if [[ $exit_status -eq 0 ]]; then
|
||||||
|
@ -258,7 +261,7 @@ update_qinglong() {
|
||||||
echo -e "\n更新$dir_root失败,请检查原因...\n"
|
echo -e "\n更新$dir_root失败,请检查原因...\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local url="https://ghproxy.com/https://github.com/whyour/qinglong-static.git"
|
local url="${github_proxy_url}https://github.com/whyour/qinglong-static.git"
|
||||||
if [ -d ${ql_static_repo}/.git ]; then
|
if [ -d ${ql_static_repo}/.git ]; then
|
||||||
reset_romote_url ${ql_static_repo} ${url}
|
reset_romote_url ${ql_static_repo} ${url}
|
||||||
cd ${ql_static_repo}
|
cd ${ql_static_repo}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user