From b25924bbd9de96381ba37cf42833b7dc833c8b43 Mon Sep 17 00:00:00 2001 From: cloudswave Date: Tue, 18 Jun 2024 18:15:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/install.sh b/install.sh index bb10a32..4a4c472 100644 --- a/install.sh +++ b/install.sh @@ -1,23 +1,27 @@ #!/bin/bash # 文件名和URL +extracted_dir="code-server-4.90.2-linux-amd64" filename="code-server-4.90.2-linux-amd64.tar.gz" url="https://x.haod.me/https://github.com/coder/code-server/releases/download/v4.90.2/${filename}" -# 检查文件是否存在,如果不存在则下载 -if [ ! -f "${filename}" ]; then - echo "Downloading ${filename}..." - wget "$url" +# 检查解压后的目录是否存在,如果不存在则下载并解压 +if [ ! -d "${extracted_dir}" ]; then + # 检查文件是否存在,如果不存在则下载 + if [ ! -f "${filename}" ]; then + echo "Downloading ${filename}..." + wget "$url" + fi + echo "Extracting ${filename}..." + tar -zxvf "${filename}" +else + echo "Directory already exists, skipping extraction." fi -# 解压文件 -echo "Extracting ${filename}..." -tar -zxvf "${filename}" - # 清理压缩文件和解压后的目录 #rm -rf "${filename}" # 运行 code-server echo "Starting code-server with config file..." -./code-server-4.90.2-linux-amd64/bin/code-server --config ./config.yaml +./$extracted_dir/bin/code-server --config ./config.yaml -- GitLab