From 3838c1b40535eae56a33c2e73d24113ee562cb50 Mon Sep 17 00:00:00 2001 From: cloudswave Date: Mon, 24 Jun 2024 11:54:03 +0800 Subject: [PATCH] optimize --- ubuntu-debian/install.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ubuntu-debian/install.sh b/ubuntu-debian/install.sh index 0737924..dee49bf 100644 --- a/ubuntu-debian/install.sh +++ b/ubuntu-debian/install.sh @@ -1,8 +1,33 @@ #!/bin/bash # 参考:https://coder.com/docs/code-server/install +# curl -sSf https://gitcode.net/cloudswave/code-server/-/raw/master/ubuntu-debian/install.sh | bash +CONFIG_FILE=~/.config/code-server/config.yaml + echo -n "输入code-server版本(默认4.90.3): " read VERSION +echo -n "输入code-server端口(默认8080): " +read port +echo -n "输入code-server密码(默认123456): " +read password VERSION=${VERSION:-4.90.3} +port=${port:-8080} +password=${password:-123456} + +# 添加默认配置到config.yaml +if [[ ! -e $CONFIG_FILE ]]; then + echo 配置文件${CONFIG_FILE}不存在,正在创建... + touch $CONFIG_FILE +fi + +# 清空文件 +> $CONFIG_FILE +# 追加默认配置 +echo bind-addr: 0.0.0.0:${port} >> $CONFIG_FILE +echo 'auth: password' >> $CONFIG_FILE +echo password: ${password} >> $CONFIG_FILE +echo 'cert: false' >> $CONFIG_FILE +cat $CONFIG_FILE + echo 准备安装code-server:${VERSION} curl -fOL https://x.haod.me/https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb @@ -15,4 +40,4 @@ sleep 5 screen -ls echo "服务器配置信息:" -cat ~/.config/code-server/config.yaml +cat $CONFIG_FILE -- GitLab