From ae891f8e550bf7224742661d1330d74175d0f6e6 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 21 Sep 2022 17:42:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddocker=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-entrypoint.sh | 7 +---- shell/share.sh | 53 +++++++++++++++++++++++++++++++++++ shell/update.sh | 56 +------------------------------------ 3 files changed, 55 insertions(+), 61 deletions(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index c85f154e..b931cf11 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -14,12 +14,7 @@ cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf pm2 l &>/dev/null -if [[ $PipMirror ]]; then - pip3 config set global.index-url $PipMirror -fi -if [[ $NpmMirror ]]; then - npm config set registry $NpmMirror -fi +patch_version &>/dev/null echo echo -e "======================2. 安装依赖========================\n" diff --git a/shell/share.sh b/shell/share.sh index 73a37590..4bee2b35 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -423,6 +423,59 @@ format_timestamp() { fi } +patch_version() { + if [[ $PipMirror ]]; then + pip3 config set global.index-url $PipMirror + fi + if [[ $NpmMirror ]]; then + npm config set registry $NpmMirror + fi + + # 兼容pnpm@7 + pnpm setup &>/dev/null + source ~/.bashrc + pnpm install -g &>/dev/null + + if [[ -f "$dir_root/db/cookie.db" ]]; then + echo -e "检测到旧的db文件,拷贝为新db...\n" + mv $dir_root/db/cookie.db $dir_root/db/env.db + rm -rf $dir_root/db/cookie.db + echo + fi + + if ! type ts-node &>/dev/null; then + pnpm add -g ts-node typescript tslib + fi + + git config --global pull.rebase false + + cp -f $dir_root/.env.example $dir_root/.env + + if [[ -d "$dir_root/db" ]]; then + echo -e "检测到旧的db目录,拷贝到data目录...\n" + cp -rf $dir_root/config $dir_root/data + echo + fi + + if [[ -d "$dir_root/scripts" ]]; then + echo -e "检测到旧的scripts目录,拷贝到data目录...\n" + cp -rf $dir_root/scripts $dir_root/data + echo + fi + + if [[ -d "$dir_root/log" ]]; then + echo -e "检测到旧的log目录,拷贝到data目录...\n" + cp -rf $dir_root/log $dir_root/data + echo + fi + + if [[ -d "$dir_root/config" ]]; then + echo -e "检测到旧的config目录,拷贝到data目录...\n" + cp -rf $dir_root/config $dir_root/data + echo + fi +} + init_env detect_termux detect_macos diff --git a/shell/update.sh b/shell/update.sh index 8baff37b..d949a984 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -244,7 +244,7 @@ usage() { ## 更新qinglong update_qinglong() { - patch_version + patch_version &>/dev/null export isFirstStartServer=false @@ -296,60 +296,6 @@ update_qinglong() { } -patch_version() { - # 兼容pnpm@7 - pnpm setup &>/dev/null - source ~/.bashrc - pnpm install -g &>/dev/null - - if [[ -f "$dir_root/db/cookie.db" ]]; then - echo -e "检测到旧的db文件,拷贝为新db...\n" - mv $dir_root/db/cookie.db $dir_root/db/env.db - rm -rf $dir_root/db/cookie.db - echo - fi - - if ! type ts-node &>/dev/null; then - pnpm add -g ts-node typescript tslib - fi - - git config --global pull.rebase false - - cp -f $dir_root/.env.example $dir_root/.env - - if [[ -d "$dir_root/db" ]]; then - echo -e "检测到旧的db目录,拷贝到data目录...\n" - cp -rf $dir_root/config $dir_root/data - echo - fi - - if [[ -d "$dir_root/scripts" ]]; then - echo -e "检测到旧的scripts目录,拷贝到data目录...\n" - cp -rf $dir_root/scripts $dir_root/data - echo - fi - - if [[ -d "$dir_root/log" ]]; then - echo -e "检测到旧的log目录,拷贝到data目录...\n" - cp -rf $dir_root/log $dir_root/data - echo - fi - - if [[ -d "$dir_root/config" ]]; then - echo -e "检测到旧的config目录,拷贝到data目录...\n" - cp -rf $dir_root/config $dir_root/data - echo - fi - - if [[ $PipMirror ]]; then - pip3 config set global.index-url $PipMirror - fi - if [[ $NpmMirror ]]; then - npm config set registry $NpmMirror - fi - -} - ## 对比脚本 diff_scripts() { local dir_current=$(pwd)