提交 b25924bb 编写于 作者: C cloudswave

脚本优化

上级 c4faf30a
#!/bin/bash #!/bin/bash
# 文件名和URL # 文件名和URL
extracted_dir="code-server-4.90.2-linux-amd64"
filename="code-server-4.90.2-linux-amd64.tar.gz" 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}" url="https://x.haod.me/https://github.com/coder/code-server/releases/download/v4.90.2/${filename}"
# 检查文件是否存在,如果不存在则下载 # 检查解压后的目录是否存在,如果不存在则下载并解压
if [ ! -f "${filename}" ]; then if [ ! -d "${extracted_dir}" ]; then
echo "Downloading ${filename}..." # 检查文件是否存在,如果不存在则下载
wget "$url" if [ ! -f "${filename}" ]; then
echo "Downloading ${filename}..."
wget "$url"
fi
echo "Extracting ${filename}..."
tar -zxvf "${filename}"
else
echo "Directory already exists, skipping extraction."
fi fi
# 解压文件
echo "Extracting ${filename}..."
tar -zxvf "${filename}"
# 清理压缩文件和解压后的目录 # 清理压缩文件和解压后的目录
#rm -rf "${filename}" #rm -rf "${filename}"
# 运行 code-server # 运行 code-server
echo "Starting code-server with config file..." 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册