添加重置ql reset命令,支持批量操作ck

This commit is contained in:
hanhh
2021-06-07 21:54:49 +08:00
parent 64aadb7eb8
commit 9e666f4348
11 changed files with 166 additions and 39 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# 导入通用变量与函数
dir_shell=/ql/shell
. $dir_shell/share.sh
echo -e "1. 开始安装青龙依赖\n"
npm_install_2 $dir_root
echo -e "青龙依赖安装完成\n"
echo -e "2. 开始安装脚本依赖\n"
cp -f $dir_sample/package.json $dir_scripts/package.json
npm_install_2 $dir_scripts
echo -e "脚本依赖安装完成\n"
exit 0
+5 -3
View File
@@ -56,7 +56,7 @@ import_config() {
user_sum=0
for line in $(cat $file_cookie); do
let user_sum+=1
eval Cookie${user_sum}="\"$line\""
eval Cookie${user_sum}="\"${line}\""
done
command_timeout_time=${CommandTimeoutTime:-"1h"}
@@ -247,8 +247,10 @@ diff_and_copy() {
update_depend() {
local dir_current=$(pwd)
cp -f $dir_sample/package.json $dir_scripts/package.json
npm_install_2 $dir_scripts
if [ ! -s $dir_scripts/package.json ] || [[ $(diff $dir_sample/package.json $dir_scripts/package.json) ]]; then
cp -f $dir_sample/package.json $dir_scripts/package.json
npm_install_2 $dir_scripts
fi
if [ ! -s $dir_scripts/requirements.txt ] || [[ $(diff $dir_sample/requirements.txt $dir_scripts/requirements.txt) ]]; then
cp -f $dir_sample/requirements.txt $dir_scripts/requirements.txt
+7 -1
View File
@@ -242,11 +242,13 @@ usage() {
echo -e "5. $cmd_update rmlog <days> # 删除旧日志"
echo -e "6. $cmd_update code # 获取互助码"
echo -e "6. $cmd_update bot # 启动tg-bot"
echo -e "7. $cmd_update reset # 重置青龙基础环境"
}
## 更新qinglong
update_qinglong() {
echo -e "--------------------------------------------------------------\n"
[ -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
@@ -256,7 +258,8 @@ update_qinglong() {
detect_config_version
update_depend
npm_install_2 $dir_root
[ -f $dir_root/package.json ] && ql_depend_new=$(cat $dir_root/package.json)
[[ "$ql_depend_old" != "$ql_depend_new" ]] && npm_install_2 $dir_root
else
echo -e "\n更新$dir_root失败,请检查原因...\n"
fi
@@ -417,6 +420,9 @@ main() {
bot)
. $dir_shell/bot.sh
;;
reset)
. $dir_shell/reset.sh
;;
*)
echo -e "命令输入错误...\n"
usage