From 70f2bef5d29c3c4acb4161d01c48f81feb875a91 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 29 May 2024 22:09:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20ql=20=E5=92=8C=20task=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/deps.ts | 7 +++++-- docker/docker-entrypoint.sh | 1 - shell/share.sh | 25 ------------------------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/back/loaders/deps.ts b/back/loaders/deps.ts index 34738f48..89e0ca35 100644 --- a/back/loaders/deps.ts +++ b/back/loaders/deps.ts @@ -23,18 +23,21 @@ async function linkCommand() { { src: 'update.sh', dest: 'ql', + tmp: 'ql_tmp', }, { src: 'task.sh', dest: 'task', + tmp: 'task_tmp', }, ]; for (const link of linkShell) { const source = path.join(config.rootPath, 'shell', link.src); const target = path.join(commandDir, link.dest); - await rmPath(target); - await fs.symlink(source, target); + const tmpTarget = path.join(commandDir, link.tmp); + await fs.symlink(source, tmpTarget); + await fs.rename(tmpTarget, target); } } diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index b2c108ed..78def676 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -3,7 +3,6 @@ dir_shell=/ql/shell . $dir_shell/env.sh . $dir_shell/share.sh -link_shell echo -e "======================1. 检测配置文件========================\n" make_dir /etc/nginx/conf.d diff --git a/shell/share.sh b/shell/share.sh index c435d232..f038ddd8 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -129,31 +129,6 @@ gen_random_num() { echo $((${RANDOM} % $divi)) } -link_shell_sub() { - local link_path="$1" - local original_path="$2" - if [[ ! -L $link_path ]] || [[ $(readlink -f $link_path) != $original_path ]]; then - rm -f $link_path 2>/dev/null - ln -sf $original_path $link_path - fi -} - -link_shell() { - if [[ $is_termux -eq 1 ]]; then - local path="/data/data/com.termux/files/usr/bin/" - elif [[ $PATH == */usr/local/bin* ]] && [[ -d /usr/local/bin ]]; then - local path="/usr/local/bin/" - else - local path="" - echo -e "脚本功能受限,请自行添加命令的软连接...\n" - fi - if [[ $path ]]; then - for ((i = 0; i < ${#link_name[*]}; i++)); do - link_shell_sub "$path${link_name[i]}" "$dir_shell/${original_name[i]}" - done - fi -} - define_cmd() { local cmd_prefix cmd_suffix if type task &>/dev/null; then