Update extra.sh
This commit is contained in:
parent
7cf45e681c
commit
45bb272b46
@ -1,9 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
## Mod: Build20210825V2
|
## Mod: Build20220529V1
|
||||||
## 添加你需要重启自动执行的任意命令,比如 ql repo
|
## 添加你需要重启自动执行的任意命令,比如 ql repo
|
||||||
## 安装node依赖使用 pnpm install -g xxx xxx(Build 20210728-002 及以上版本的 code.sh,可忽略)
|
## 安装node依赖使用 pnpm install -g xxx xxx(Build 20210728-002 及以上版本的 code.sh,可忽略)
|
||||||
## 安装python依赖使用 pip3 install xxx(Build 20210728-002 及以上版本的 code.sh,可忽略)
|
## 安装python依赖使用 pip3 install xxx(Build2021125V1 及以上版本的 extra.sh,可忽略)
|
||||||
|
|
||||||
|
|
||||||
#------ 说明区 ------#
|
#------ 说明区 ------#
|
||||||
## 1. 拉取仓库
|
## 1. 拉取仓库
|
||||||
@ -11,34 +10,41 @@
|
|||||||
### (2)若运行过 1custom 一键脚本,点击运行即可
|
### (2)若运行过 1custom 一键脚本,点击运行即可
|
||||||
### (3)推荐配置:如下。自行在设置区填写编号
|
### (3)推荐配置:如下。自行在设置区填写编号
|
||||||
## 2. 安装依赖
|
## 2. 安装依赖
|
||||||
### (1)默认不安装,因为 Build 20210728-002 及以上版本的 code.sh 自动检查修复依赖
|
### (1)默认不安装nodejs依赖,因为 Build 20210728-002 及以上版本的 code.sh 自动检查修复依赖
|
||||||
### (2)若需要在此处使用,请在设置区设置
|
### (2)若需要在此处使用,请在设置区设置
|
||||||
## 3. Ninja
|
## 3. Ninja
|
||||||
### (1)默认启动并自动更新
|
### (1)默认启动并自动更新
|
||||||
### (2)⚠未修改容器映射的请勿运行,否则会出现青龙打不开或者设备死机等不良后果,映射参考 https://github.com/MoonBegonia/ninja#%E5%AE%B9%E5%99%A8%E5%86%85
|
### (2)⚠未修改容器映射的请勿运行,否则会出现青龙打不开或者设备死机等不良后果,映射参考 https://github.com/MoonBegonia/ninja#%E5%AE%B9%E5%99%A8%E5%86%85
|
||||||
|
|
||||||
|
|
||||||
#------ 设置区 ------#
|
#------ 设置区 ------#
|
||||||
## 1. 拉取仓库编号设置,默认 Faker2 仓库
|
# shellcheck disable=SC2005
|
||||||
CollectedRepo=() ##示例:CollectedRepo=(2 4 6)
|
## 1. 拉取仓库或脚本编号设置,默认 shufflewzc 仓库
|
||||||
OtherRepo=() ##示例:OtherRepo=(1 3)
|
CollectedRepo=(2 5 10) ##示例:CollectedRepo=(2 6)
|
||||||
|
OtherRepo=(3) ##示例:OtherRepo=(1 3 0)
|
||||||
|
RawScript=(2) ##示例:RawScript=(1 2)
|
||||||
## 2. 是否安装依赖和安装依赖包的名称设置
|
## 2. 是否安装依赖和安装依赖包的名称设置
|
||||||
dependencies="no" ##yes为安装,no为不安装
|
dependencies="yes" ##yes为全部安装,no为不安装,al为安装alpine依赖,py为安装python依赖,js为安装nodejs依赖,pl为安装perl依赖
|
||||||
package_name="canvas png-js date-fns axios crypto-js ts-md5 tslib @types/node dotenv typescript fs require tslib"
|
alpine_pkgs="bash curl gcc git jq libffi-dev make musl-dev openssl-dev perl perl-app-cpanminus perl-dev py3-pip python3 python3-dev wget"
|
||||||
|
py_reqs="bs4 cryptography pyaes requests rsa tomli "
|
||||||
|
js_pkgs="@iarna/toml axios crypto-js got"
|
||||||
|
pl_mods="File::Slurp JSON5 TOML::Dumper"
|
||||||
## 3. Ninja 是否需要启动和更新设置
|
## 3. Ninja 是否需要启动和更新设置
|
||||||
Ninja="down" ##up为更新,on为启动,down为不运行
|
Ninja="down" ##up为更新,on为启动,down为不运行
|
||||||
|
|
||||||
|
|
||||||
#------ 编号区 ------#
|
#------ 编号区 ------#
|
||||||
:<<\EOF
|
: <<\EOF
|
||||||
一、集成仓库(Collected Repositories)
|
一、集成仓库(Collected Repositories)
|
||||||
2-JDHelloWorld
|
2-JDHelloWorld
|
||||||
3-he1pu
|
3-he1pu
|
||||||
4-Faker2
|
4-Faker2
|
||||||
5-Faker3
|
5-Faker3
|
||||||
6-yuannian1112
|
6-Aaron-lv
|
||||||
|
7-yuannian1112
|
||||||
|
8-zero205
|
||||||
|
9-yyds
|
||||||
|
10-KingRan
|
||||||
|
11-gys619
|
||||||
二、其他仓库(Other Repositories)
|
二、其他仓库(Other Repositories)
|
||||||
1-passerby-b
|
|
||||||
2-curtinlv
|
2-curtinlv
|
||||||
3-smiek2221
|
3-smiek2221
|
||||||
4-cdle
|
4-cdle
|
||||||
@ -48,112 +54,171 @@ Ninja="down" ##up为更新,on为启动,down为不运行
|
|||||||
8-Ariszy (Zhiyi-N)
|
8-Ariszy (Zhiyi-N)
|
||||||
9-photonmang
|
9-photonmang
|
||||||
10-jiulan
|
10-jiulan
|
||||||
12-star261
|
11-star261
|
||||||
13-Wenmoux
|
13-Tsukasa007
|
||||||
14-Tsukasa007
|
14-mmnvnmm
|
||||||
|
15-X1a0He
|
||||||
|
16-chianPLA
|
||||||
|
17-hyzaw
|
||||||
|
18-Zy143L/wskey
|
||||||
|
19-Mashiro2000/HeyTapTask
|
||||||
|
20-ccwav
|
||||||
|
三、单拉脚本(Raw Scripts)
|
||||||
|
1-禁用重复任务 by Oreomeow
|
||||||
|
2-修复脚本依赖文件 by spiritLHL
|
||||||
|
3-互助研究院 extra2.sh
|
||||||
|
4-互助研究院 ckck2.sh
|
||||||
|
5-互助研究院 notify2.sh
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
#------ 代码区 ------#
|
#------ 代码区 ------#
|
||||||
# 🌱拉取仓库
|
# 🌱拉取仓库或脚本
|
||||||
CR2(){
|
CR2() {
|
||||||
ql repo https://github.com/shufflewzc/faker3.git "jd_|jx_|gua_|jddj_|getJDCookie" "activity|backUp|Coupon|update" "^jd[^_]|USER|utils|^JS|^TS|^JDJRValidator_|^ZooFaker|^sign|ql|sentNotify|JDSignValidator|magic" "main"
|
ql repo https://gh.fakev.cn/JDHelloWorld/jd_scripts.git ""jd_|jx_|getJDCookie"" ""backUp"" ""^jd[^_]|USER|utils|sendNotify|^TS|JD_""
|
||||||
}
|
}
|
||||||
CR3(){
|
CR3() {
|
||||||
ql repo https://github.com/he1pu/JDHelp.git "jd_|jx_|getJDCookie" "Coupon|update" "^jd[^_]|USER|^sign|^ZooFaker|utils"
|
ql repo https://gh.fakev.cn/he1pu/JDHelp.git ""jd_|jx_|getJDCookie"" ""activity|backUp|Coupon"" ""^jd[^_]|USER|utils|sendNotify|ZooFaker|JDJRValidator_|^sign""
|
||||||
}
|
}
|
||||||
CR4(){
|
CR4() {
|
||||||
ql repo https://github.com/shufflewzc/faker2.git "jd_|jx_|gua_|jddj_|jdCookie" "activity|backUp" "^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate|ql|JDSignValidator|magic" "main"
|
ql repo https://gh.fakev.cn/shufflewzc/faker2.git ""jd_|jx_|gua_|jddj_|jdCookie"" ""activity|backUp"" ""^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate| ql|JDSignValidator|magic"" ""main""
|
||||||
}
|
}
|
||||||
CR5(){
|
CR5() {
|
||||||
ql repo https://github.com/shufflewzc/faker3.git "jd_|jx_|gua_|jddj_|jdCookie" "activity|backUp" "^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate|ql|JDSignValidator|magic" "main"
|
ql repo https://gh.fakev.cn/shufflewzc/faker3.git ""jd_|jx_|gua_|jddj_|getJDCookie"" ""activity|backUp|Coupon|update"" ""^jd[^_]|USER|utils|^JS|^TS|^JDJRValidator_|^ZooFaker|^sign| ql|sentNotify|JDSignValidator|magic"" ""main""
|
||||||
}
|
}
|
||||||
CR6(){
|
CR6() {
|
||||||
ql repo https://github.com/yuannian1112/jd_scripts.git "jd_|jx_|getJDCookie" "activity|backUp" "^jd[^_]|USER|utils"
|
ql repo https://gh.fakev.cn/Aaron-lv/sync.git ""jd_|jx_|getJDCookie"" ""activity|backUp|Coupon"" ""^jd[^_]|USER|utils|sendNotify|JD_"" ""jd_scripts""
|
||||||
}
|
}
|
||||||
for i in ${CollectedRepo[@]}; do
|
CR7() {
|
||||||
CR$i
|
ql repo https://gh.fakev.cn/yuannian1112/jd_scripts.git ""jd_|jx_|getJDCookie"" ""activity|backUp"" ""^jd[^_]|USER|utils""
|
||||||
|
}
|
||||||
|
CR8() {
|
||||||
|
ql repo https://gh.fakev.cn/zero205/JD_tencent_scf.git ""jd_|jx_|getJDCookie"" ""backUp|icon"" ""^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign"" ""main""
|
||||||
|
}
|
||||||
|
CR9() {
|
||||||
|
ql repo https://gh.fakev.cn/okyyds/yyds.git ""jd_|jx_|gua_|jddj_|jdCookie"" ""activity|backUp"" ""^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate| ql|JDSignValidator"" ""master""
|
||||||
|
}
|
||||||
|
CR10() {
|
||||||
|
ql repo https://gh.fakev.cn/KingRan/KR.git ""jd_|jx_|jdCookie"" ""activity|backUp"" ""^jd[^_]|USER|utils|function|sign|sendNotify| ql|JDJR""
|
||||||
|
}
|
||||||
|
CR11() {
|
||||||
|
ql repo https://gh.fakev.cn/gys619/jdd.git ""jd_|jx_|jddj_|gua_|jddj_|getJDCookie|wskey"" ""activity|backUp"" ""^jd[^_]|USER|utils|ZooFaker_Necklace|JDJRValidator_Pure|sign_graphics_validate|jddj_cookie|function| ql""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for i in "${CollectedRepo[@]}"; do
|
||||||
|
CR"$i"
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
|
|
||||||
OR1(){
|
|
||||||
ql repo https://github.com/passerby-b/JDDJ.git "jddj_" "scf_test_event|jddj_fruit_code.js|jddj_getck.js|jd_|jddj_cookie"
|
OR2() {
|
||||||
|
ql repo https://gh.fakev.cn/curtinlv/JD-Script.git ""jd_"" ""jd_cookie"" ""^jd[^_]|sendNotify|OpenCard|getFollowGifts|getJDCookie""
|
||||||
}
|
}
|
||||||
OR2(){
|
OR3() {
|
||||||
ql repo https://github.com/curtinlv/JD-Script.git "jd_"
|
ql repo https://gh.fakev.cn/smiek2121/scripts.git ""jd_|gua_"" """" ""^jd[^_]|USER|utils|sendNotify|ZooFaker|JDJRValidator_|^sign|cleancart_""
|
||||||
}
|
}
|
||||||
OR3(){
|
OR4() {
|
||||||
ql repo https://github.com/smiek2221/scripts.git "jd_|gua_" "" "^MovementFaker|^JDJRValidator|^ZooFaker|^sign"
|
ql repo https://gh.fakev.cn/cdle/xdd.git ""jd_"" ""disposable|expired|jdc""
|
||||||
}
|
}
|
||||||
OR4(){
|
OR5() {
|
||||||
ql repo https://github.com/cdle/xdd.git "jd_" "disposable|expired|jdc"
|
ql repo https://gh.fakev.cn/ZCY01/daily_scripts.git ""jd_""
|
||||||
}
|
}
|
||||||
OR5(){
|
OR6() {
|
||||||
ql repo https://github.com/ZCY01/daily_scripts.git "jd_"
|
ql repo https://gh.fakev.cn/whyour/hundun.git ""quanx"" ""tokens|caiyun|didi|donate|fold|Env""
|
||||||
}
|
}
|
||||||
OR6(){
|
OR7() {
|
||||||
ql repo https://github.com/whyour/hundun.git "quanx" "tokens|caiyun|didi|donate|fold|Env"
|
ql repo https://gh.fakev.cn/moposmall/Script.git ""Me""
|
||||||
}
|
}
|
||||||
OR7(){
|
OR8() {
|
||||||
ql repo https://github.com/moposmall/Script.git "Me"
|
ql repo https://gh.fakev.cn/Ariszy/Private-Script.git ""JD""
|
||||||
}
|
}
|
||||||
OR8(){
|
OR9() {
|
||||||
ql repo https://github.com/Ariszy/Private-Script.git "JD"
|
ql repo https://gh.fakev.cn/photonmang/quantumultX.git ""JDscripts""
|
||||||
}
|
}
|
||||||
OR9(){
|
OR10() {
|
||||||
ql repo https://github.com/photonmang/quantumultX.git "JDscripts"
|
ql repo https://gh.fakev.cn/jiulan/platypus.git ""jd_|jx_"" """" "Overdue"" ""main""
|
||||||
}
|
}
|
||||||
OR10(){
|
OR11() {
|
||||||
ql repo https://github.com/jiulan/platypus.git "jd_|jx_" "" "overdue" "main"
|
ql repo https://gh.fakev.cn/star261/jd.git ""jd_|star"" """" ""code"" ""main""
|
||||||
}
|
}
|
||||||
OR11(){
|
OR13() {
|
||||||
ql repo https://github.com/panghu999/panghu.git "jd_"
|
ql repo https://gh.fakev.cn/Tsukasa007/my_script.git ""jd_|jx_"" ""jdCookie|USER_AGENTS|sendNotify|backup"" """" ""master""
|
||||||
}
|
}
|
||||||
OR12(){
|
OR14() {
|
||||||
ql repo https://github.com/star261/jd.git "jd_|star" "" "code" "main"
|
ql repo https://gh.fakev.cn/mmnvnmm/omo.git ""jd_|rush_|bean_""
|
||||||
}
|
}
|
||||||
OR13(){
|
OR15() {
|
||||||
ql repo https://github.com/Wenmoux/scripts.git "other|jd" "" "" "wen"
|
ql repo https://gh.fakev.cn/X1a0He/jd_scripts_fixed.git ""jd_"" """" ""^jd[^_]""
|
||||||
}
|
}
|
||||||
OR14(){
|
OR16() {
|
||||||
ql repo https://github.com/Tsukasa007/my_script.git "jd_|jx_" "jdCookie|USER_AGENTS|sendNotify|backup" "" "master"
|
ql repo https://gh.fakev.cn/chianPLA/xiaoshou.git
|
||||||
}
|
}
|
||||||
for i in ${OtherRepo[@]}; do
|
OR17() {
|
||||||
OR$i
|
ql repo https://gh.fakev.cn/hyzaw/scripts.git ""jd_|ql_""
|
||||||
|
}
|
||||||
|
OR18() {
|
||||||
|
ql repo https://gh.fakev.cn/Zy143L/wskey.git ""wskey""
|
||||||
|
}
|
||||||
|
OR19() {
|
||||||
|
ql repo https://gh.fakev.cn/Mashiro2000/HeyTapTask.git """" ""Backup|index|HT.*|sendNotify"" ""HT_config|sendNotify""
|
||||||
|
}
|
||||||
|
OR20() {
|
||||||
|
ql repo https://gh.fakev.cn/ccwav/QLScript2.git ""jd_"" ""NoUsed"" ""ql|sendNotify|utils|USER|jdCookie""
|
||||||
|
}
|
||||||
|
|
||||||
|
for i in "${OtherRepo[@]}"; do
|
||||||
|
OR"$i"
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
RS1() {
|
||||||
|
ql raw https://raw.githubusercontent.com/Oreomeow/VIP/main/Scripts/py/disable.py
|
||||||
|
}
|
||||||
|
RS2() {
|
||||||
|
ql raw https://raw.githubusercontent.com/spiritLHL/qinglong_auto_tools/master/scripts_check_dependence.py
|
||||||
|
}
|
||||||
|
RS3() {
|
||||||
|
ql raw https://raw.githubusercontent.com/Oreomeow/VIP/main/Scripts/sh/Helpcode2.8/extra2.sh
|
||||||
|
}
|
||||||
|
RS4() {
|
||||||
|
ql raw https://raw.githubusercontent.com/Oreomeow/VIP/main/Scripts/sh/Helpcode2.8/ckck2.sh
|
||||||
|
}
|
||||||
|
RS5() {
|
||||||
|
ql raw https://raw.githubusercontent.com/Oreomeow/VIP/main/Scripts/sh/Helpcode2.8/notify2.sh
|
||||||
|
}
|
||||||
|
for i in "${RawScript[@]}"; do
|
||||||
|
RS"$i"
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
# 🍪Ninja
|
# 🍪Ninja
|
||||||
update_Ninja_normal(){
|
update_Ninja_normal() {
|
||||||
cd /ql/ninja/backend && git checkout . && git pull
|
cd /ql/ninja/backend && git checkout . && git pull
|
||||||
pnpm install && pm2 start
|
pnpm install && pm2 start
|
||||||
cp sendNotify.js /ql/scripts/sendNotify.js
|
cp sendNotify.js /ql/scripts/sendNotify.js
|
||||||
}
|
}
|
||||||
|
|
||||||
check_Ninja_normal(){
|
check_Ninja_normal() {
|
||||||
NOWTIME=$(date +%Y-%m-%d-%H-%M-%S)
|
NOWTIME=$(date +%Y-%m-%d-%H-%M-%S)
|
||||||
i=0
|
i=0
|
||||||
while ((i<=0)); do
|
while ((i <= 0)); do
|
||||||
echo "扫描 Ninja 是否在线"
|
echo "扫描 Ninja 是否在线"
|
||||||
ps -fe|grep ninja|grep -v grep
|
if [ -z "$(pgrep -f ninja)" ]; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
i=0
|
i=0
|
||||||
echo $NOWTIME" 扫描结束!Ninja 掉线了不用担心马上重启!"
|
echo "$NOWTIME"" 扫描结束!Ninja 掉线了不用担心马上重启!"
|
||||||
cd /ql
|
cd /ql || exit
|
||||||
ps -ef|grep ninja|grep -v grep|awk '{print $1}'|xargs kill -9
|
pgrep -f ninja | xargs kill -9
|
||||||
cd /ql/ninja/backend
|
cd /ql/ninja/backend || exit
|
||||||
pnpm install
|
pnpm install
|
||||||
pm2 start
|
pm2 start
|
||||||
ps -fe|grep Daemon |grep -v grep
|
if [ -n "$(pgrep -f Daemon)" ]; then
|
||||||
if [ $? -ne 1 ]; then
|
|
||||||
i=1
|
i=1
|
||||||
echo $NOWTIME" Ninja 重启完成!"
|
echo "$NOWTIME"" Ninja 重启完成!"
|
||||||
curl "https://api.telegram.org/bot$TG_BOT_TOKEN/sendMessage?chat_id=$TG_USER_ID&text=Ninja 已重启完成"
|
curl "https://api.telegram.org/bot$TG_BOT_TOKEN/sendMessage?chat_id=$TG_USER_ID&text=Ninja 已重启完成"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
i=1
|
i=1
|
||||||
echo $NOWTIME" 扫描结束!Ninja 还在!"
|
echo "$NOWTIME"" 扫描结束!Ninja 还在!"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -164,74 +229,138 @@ elif [ "$Ninja" = "on" ]; then
|
|||||||
check_Ninja_normal
|
check_Ninja_normal
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# 📦依赖
|
# 📦依赖
|
||||||
install_dependencies_normal(){
|
# shellcheck disable=SC2015
|
||||||
for i in $@; do
|
install() {
|
||||||
case $i in
|
count=0
|
||||||
canvas)
|
flag=$1
|
||||||
cd /ql/scripts
|
while true; do
|
||||||
if [[ "$(echo $(npm ls $i) | grep ERR)" != "" ]]; then
|
echo ".......... $2 begin .........."
|
||||||
npm uninstall $i
|
result=$3
|
||||||
fi
|
if [ "$result" -gt 0 ]; then
|
||||||
if [[ "$(npm ls $i)" =~ (empty) ]]; then
|
flag=0
|
||||||
apk add --no-cache build-base g++ cairo-dev pango-dev giflib-dev && npm i $i --prefix /ql/scripts --build-from-source
|
else
|
||||||
fi
|
flag=1
|
||||||
;;
|
fi
|
||||||
*)
|
if [ $flag -eq "$1" ]; then
|
||||||
if [[ "$(npm ls $i)" =~ $i ]]; then
|
echo "---------- $2 succeed ----------"
|
||||||
npm uninstall $i
|
break
|
||||||
elif [[ "$(echo $(npm ls $i -g) | grep ERR)" != "" ]]; then
|
else
|
||||||
npm uninstall $i -g
|
count=$((count + 1))
|
||||||
fi
|
if [ $count -eq 6 ]; then
|
||||||
if [[ "$(npm ls $i -g)" =~ (empty) ]]; then
|
echo "!! 自动安装失败,请尝试进入容器后执行 $2 !!"
|
||||||
[[ $i = "typescript" ]] && npm i $i -g --force || npm i $i -g
|
break
|
||||||
fi
|
fi
|
||||||
;;
|
echo ".......... retry in 5 seconds .........."
|
||||||
esac
|
sleep 5
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dependencies_force(){
|
install_alpine_pkgs() {
|
||||||
for i in $@; do
|
apk update
|
||||||
case $i in
|
apk_info=" $(apk info) "
|
||||||
canvas)
|
for i in $alpine_pkgs; do
|
||||||
cd /ql/scripts
|
if expr "$apk_info" : ".*\s${i}\s.*" >/dev/null; then
|
||||||
if [[ "$(npm ls $i)" =~ $i && "$(echo $(npm ls $i) | grep ERR)" != "" ]]; then
|
echo "$i 已安装"
|
||||||
npm uninstall $i
|
else
|
||||||
rm -rf /ql/scripts/node_modules/$i
|
install 0 "apk add $i" "$(apk add --no-cache "$i" | grep -c 'OK')"
|
||||||
rm -rf /usr/local/lib/node_modules/lodash/*
|
fi
|
||||||
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
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dependencies_all(){
|
install_py_reqs() {
|
||||||
install_dependencies_normal $package_name
|
pip3 install --upgrade pip
|
||||||
for i in $package_name; do
|
pip3_freeze="$(pip3 freeze)"
|
||||||
install_dependencies_force $i
|
for i in $py_reqs; do
|
||||||
|
if expr "$pip3_freeze" : ".*${i}" >/dev/null; then
|
||||||
|
echo "$i 已安装"
|
||||||
|
else
|
||||||
|
install 0 "pip3 install $i" "$(pip3 install "$i" | grep -c 'Successfully')"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$dependencies" = "yes" ]; then
|
install_js_pkgs_initial() {
|
||||||
install_dependencies_all &
|
if [ -d "/ql/scripts" ] && [ ! -f "/ql/scripts/package.bak.json" ]; then
|
||||||
fi
|
cd /ql/scripts || exit
|
||||||
|
rm -rf node_modules
|
||||||
|
rm -rf .pnpm-store
|
||||||
|
mv package-lock.json package-lock.bak.json
|
||||||
|
mv package.json package.bak.json
|
||||||
|
mv pnpm-lock.yaml pnpm-lock.bak.yaml
|
||||||
|
install 1 "npm install -g package-merge" "$(echo "$(npm install -g package-merge && npm ls -g package-merge)" | grep -cE '(empty)|ERR')" &&
|
||||||
|
export NODE_PATH="/usr/local/lib/node_modules" &&
|
||||||
|
node -e \
|
||||||
|
"const merge = require('package-merge');
|
||||||
|
const fs = require('fs');
|
||||||
|
const dst = fs.readFileSync('/ql/repo/Oreomeow_checkinpanel_master/package.json');
|
||||||
|
const src = fs.readFileSync('/ql/scripts/package.bak.json');
|
||||||
|
fs.writeFile('/ql/scripts/package.json', merge(dst, src), function (err) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
console.log('package.json merged successfully!');
|
||||||
|
});"
|
||||||
|
fi
|
||||||
|
npm install
|
||||||
|
}
|
||||||
|
install_js_pkgs_each() {
|
||||||
|
is_empty=$(npm ls "$1" | grep empty)
|
||||||
|
has_err=$(npm ls "$1" | grep ERR)
|
||||||
|
if [ "$is_empty" = "" ] && [ "$has_err" = "" ]; then
|
||||||
|
echo "$1 已正确安装"
|
||||||
|
elif [ "$has_err" != "" ]; then
|
||||||
|
uninstall_js_pkgs "$1"
|
||||||
|
else
|
||||||
|
install 1 "npm install $1" "$(echo "$(npm install --force "$1" && npm ls --force "$1")" | grep -cE '(empty)|ERR')"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
uninstall_js_pkgs() {
|
||||||
|
npm uninstall "$1"
|
||||||
|
rm -rf "$(pwd)"/node_modules/"$1"
|
||||||
|
rm -rf /usr/local/lib/node_modules/lodash/*
|
||||||
|
npm cache clear --force
|
||||||
|
}
|
||||||
|
install_js_pkgs_all() {
|
||||||
|
install_js_pkgs_initial
|
||||||
|
for i in $js_pkgs; do
|
||||||
|
install_js_pkgs_each "$i"
|
||||||
|
done
|
||||||
|
npm ls --depth 0
|
||||||
|
}
|
||||||
|
|
||||||
|
install_pl_mods() {
|
||||||
|
if command -v cpm >/dev/null 2>&1; then
|
||||||
|
echo "App::cpm 已安装"
|
||||||
|
else
|
||||||
|
install 1 "cpanm -fn App::cpm" "$(cpanm -fn App::cpm | grep -c "FAIL")"
|
||||||
|
if ! command -v cpm >/dev/null 2>&1; then
|
||||||
|
if [ -f ./cpm ]; then
|
||||||
|
chmod +x cpm && ./cpm --version
|
||||||
|
else
|
||||||
|
cp -f /ql/repo/Oreomeow_checkinpanel_master/cpm ./ && chmod +x cpm && ./cpm --version
|
||||||
|
if [ ! -f ./cpm ]; then
|
||||||
|
curl -fsSL https://cdn.jsdelivr.net/gh/Oreomeow/checkinpanel/cpm >cpm && chmod +x cpm && ./cpm --version
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
for i in $pl_mods; do
|
||||||
|
if [ -f "$(perldoc -l "$i")" ]; then
|
||||||
|
echo "$i 已安装"
|
||||||
|
else
|
||||||
|
install 1 "cpm install -g $i" "$(cpm install -g "$i" | grep -c "FAIL")"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
[[ $dependencies == yes ]] && {
|
||||||
|
install_alpine_pkgs
|
||||||
|
install_py_reqs
|
||||||
|
install_js_pkgs_all
|
||||||
|
install_pl_mods
|
||||||
|
}
|
||||||
|
[[ $dependencies == *al* ]] && install_alpine_pkgs
|
||||||
|
[[ $dependencies == *py* ]] && install_py_reqs
|
||||||
|
[[ $dependencies == *js* ]] && install_js_pkgs_all
|
||||||
|
[[ $dependencies == *pl* ]] && install_pl_mods
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user