🐉ql extra.sh 2021-07-29 02:41:02

This commit is contained in:
QL 2021-07-28 18:41:02 +00:00
parent 40f16eedd2
commit 8a94b627a3

View File

@ -1,11 +1,17 @@
#!/usr/bin/env bash
## Mod: Build20210726V1
## Mod: Build20210729V1
## 添加你需要重启自动执行的任意命令,比如 ql repo
## 使用方法定时任务→添加定时→命令【ql extra】→定时规则【15 0-23/4 * * *】-运行
## 推荐配置:如下。自行在需要的命令前注释和取消注释 ##,该文件最前的 # 勿动
## 安装node依赖使用 pnpm install -g xxx xxxBuild 20210728-002 及以上版本的 code.sh可忽略
## 安装python依赖使用 pip3 install xxxBuild 20210728-002 及以上版本的 code.sh可忽略
## 使用方法
## 1.拉取仓库
### 1定时任务→添加定时→命令【ql extra】→定时规则【15 0-23/4 * * *】extra】→运行
### 2若运行过 1custom 一键脚本,点击运行即可
### 3推荐配置如下。自行在需要的命令前注释和取消注释 ##,该文件最前的 # 勿动
## 2.安装依赖
### 1默认不安装因为Build 20210728-002 及以上版本的 code.sh 自动检查修复依赖
### 2若需要在此处使用请删除依赖附近的注释
## 预设仓库和参数u=urlp=pathk=blacklistd=dependenceb=branch如果懂得定义可以自行修改
## 1预设的 panghu999 仓库
@ -43,7 +49,6 @@ default6="$u6 $p6 $k6 $d6 $b6"
## 默认拉取仓库编号设置
default=$default4 ##此处修改,只改数字,默认 shufflewzc 仓库
# 单脚本
## 名称之后标注﹢的单脚本,若下面已拉取仓库的可以不拉。这里适用于只拉取部分脚本使用
# 1. curtinlv﹢
@ -56,18 +61,19 @@ default=$default4 ##此处修改,只改数字,默认 shufflewzc 仓库
## 京喜工厂瓜分电力开团 ID
## ql raw https://raw.githubusercontent.com/chiupam/JD_Diy/master/pys/activeId.py
# 3. Aaron-lv
## 财富岛
## ql raw https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_cfd.js
## ql repo https://github.com/Aaron-lv/sync.git "jd_cfd" "" "" "jd_scripts"
# 4. Wenmoux
## 口袋书店
## ql raw https://raw.githubusercontent.com/Wenmoux/scripts/wen/jd/chinnkarahoi_jd_bookshop.js
## ql repo https://github.com/Wenmoux/scripts.git "chinnkarahoi_jd_bookshop" "" "" "wen"
# 5. NobyDa
## 京东多合一签到脚本
## ql repo https://github.com/NobyDa/Script.git "JD-DailyBonus" "" "JD_DailyBonus" "master"
# 整库
# 1. Unknown 备份托管等(如上)
@ -107,7 +113,81 @@ ql repo $default ##此处勿动
## ql repo https://github.com/panghu999/panghu.git "jd_"
# 13. star261
## ql repo https://github.com/star261/jd.git "jd_|star" "" "MovementFaker"
## ql repo https://github.com/star261/jd.git "jd_|star" "" "code" "main"
# 14. Wenmoux
## ql repo https://github.com/Wenmoux/scripts.git "other|jd" "" "" "wen"
# 依赖
:<<\EOF #取消注释请删除该行和后面提到的一行
package_name="canvas png-js date-fns axios crypto-js ts-md5 tslib @types/node dotenv typescript fs require tslib"
install_dependencies_normal(){
for i in $@; do
case $i in
canvas)
cd /ql/scripts
if [[ "$(echo $(npm ls $i) | grep ERR)" != "" ]]; then
npm uninstall $i
fi
if [[ "$(npm ls $i)" =~ (empty) ]]; then
apk add --no-cache build-base g++ cairo-dev pango-dev giflib-dev && npm i $i --prefix /ql/scripts --build-from-source
fi
;;
*)
if [[ "$(npm ls $i)" =~ $i ]]; then
npm uninstall $i
elif [[ "$(echo $(npm ls $i -g) | grep ERR)" != "" ]]; then
npm uninstall $i -g
fi
if [[ "$(npm ls $i -g)" =~ (empty) ]]; then
[[ $i = "typescript" ]] && npm i $i -g --force || npm i $i -g
fi
;;
esac
done
}
install_dependencies_force(){
for i in $@; do
case $i in
canvas)
cd /ql/scripts
if [[ "$(npm ls $i)" =~ $i && "$(echo $(npm ls $i) | grep ERR)" != "" ]]; then
npm uninstall $i
rm -rf /ql/scripts/node_modules/$i
rm -rf /usr/local/lib/node_modules/lodash/*
fi
if [[ "$(npm ls $i)" =~ (empty) ]]; then
apk add --no-cache build-base g++ cairo-dev pango-dev giflib-dev && npm i $i --prefix /ql/scripts --build-from-source --force
fi
;;
*)
cd /ql/scripts
if [[ "$(npm ls $i)" =~ $i ]]; then
npm uninstall $i
rm -rf /ql/scripts/node_modules/$i
rm -rf /usr/local/lib/node_modules/lodash/*
elif [[ "$(npm ls $i -g)" =~ $i && "$(echo $(npm ls $i -g) | grep ERR)" != "" ]]; then
npm uninstall $i -g
rm -rf /ql/scripts/node_modules/$i
rm -rf /usr/local/lib/node_modules/lodash/*
fi
if [[ "$(npm ls $i -g)" =~ (empty) ]]; then
npm i $i -g --force
fi
;;
esac
done
}
install_dependencies_all(){
install_dependencies_normal $package_name
for i in $package_name; do
install_dependencies_force $i
done
}
install_dependencies_all &
EOF #取消注释请删除该行和前面提到的一行