This commit is contained in:
BIN
code-server/code-server-4.108.1-linux-amd64.7z
LFS
Normal file
BIN
code-server/code-server-4.108.1-linux-amd64.7z
LFS
Normal file
Binary file not shown.
1
code-server/code-server-4.108.1-linux-amd64.7z.sha256
Normal file
1
code-server/code-server-4.108.1-linux-amd64.7z.sha256
Normal file
@@ -0,0 +1 @@
|
||||
45c057ed0e7eec1c3f2d4dc7a3a5e01b53987a51907ec32ee94e57d9784be85c *code-server-4.108.1-linux-amd64.7z
|
||||
BIN
code-server/code-server-4.108.1-linux-arm64.7z
LFS
Normal file
BIN
code-server/code-server-4.108.1-linux-arm64.7z
LFS
Normal file
Binary file not shown.
1
code-server/code-server-4.108.1-linux-arm64.7z.sha256
Normal file
1
code-server/code-server-4.108.1-linux-arm64.7z.sha256
Normal file
@@ -0,0 +1 @@
|
||||
fd0ae85527fff548996d70c15031fed8adc76aa78825b988840e6d12d9c85bfc *code-server-4.108.1-linux-arm64.7z
|
||||
90
code-server/install.sh
Normal file
90
code-server/install.sh
Normal file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
source <(curl -f -s --connect-timeout 10 --retry 3 https://dl.acepanel.net/public.sh)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Download public.sh failed, please check the network or try again later."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
channel=${1}
|
||||
version=${2}
|
||||
code_server_path="${setup_path}/server/code-server"
|
||||
|
||||
if [ ! -d "${code_server_path}" ]; then
|
||||
mkdir -p ${code_server_path}
|
||||
fi
|
||||
|
||||
# 架构判断
|
||||
if [ ${ARCH} == "x86_64" ]; then
|
||||
code_server_file="code-server-${version}-linux-amd64.7z"
|
||||
elif [ ${ARCH} == "aarch64" ]; then
|
||||
code_server_file="code-server-${version}-linux-arm64.7z"
|
||||
else
|
||||
error "Unsupported architecture"
|
||||
fi
|
||||
|
||||
# 下载
|
||||
cd ${code_server_path}
|
||||
dl "${code_server_path}" "/code-server/${code_server_file}"
|
||||
|
||||
# 解压
|
||||
cd ${code_server_path}
|
||||
7z x ${code_server_file}
|
||||
rm -f ${code_server_file}
|
||||
if [ ! -f "${code_server_path}/bin/code-server" ]; then
|
||||
rm -rf ${code_server_path}
|
||||
error "code-server extraction failed"
|
||||
fi
|
||||
|
||||
# 初始化目录
|
||||
chown -R root:root ${code_server_path}
|
||||
chmod -R 700 ${code_server_path}
|
||||
ln -sf ${code_server_path}/bin/code-server /usr/local/bin/code-server
|
||||
|
||||
# 写入配置
|
||||
password=$(cat /dev/urandom | head -n 16 | sha256sum | head -c 16)
|
||||
cat >/root/.config/code-server/config.yaml <<EOF
|
||||
bind-addr: 0.0.0.0:9999
|
||||
auth: password
|
||||
password: ${password}
|
||||
cert: true
|
||||
EOF
|
||||
chmod 600 /root/.config/code-server/config.yaml
|
||||
|
||||
# 配置systemd
|
||||
cat >/etc/systemd/system/code-server.service <<EOF
|
||||
[Unit]
|
||||
Description=VS Code in the browser
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
|
||||
WorkingDirectory=${code_server_path}
|
||||
ExecStart=/usr/local/bin/code-server --disable-telemetry
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
chmod 644 /etc/systemd/system/code-server.service
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now code-server
|
||||
if [ "$?" != "0" ]; then
|
||||
error "Failed to start"
|
||||
fi
|
||||
|
||||
# 防火墙
|
||||
firewall-cmd --zone=public --add-port=9999/tcp --permanent
|
||||
firewall-cmd --reload
|
||||
|
||||
acepanel app write codeserver ${channel} ${version}
|
||||
|
||||
echo -e $HR
|
||||
echo "Installation successful"
|
||||
echo "默认端口 9999,密码见配置文件"
|
||||
echo "Default port 9999, password in config file"
|
||||
echo -e $HR
|
||||
1
code-server/install.sh.sha256
Normal file
1
code-server/install.sh.sha256
Normal file
@@ -0,0 +1 @@
|
||||
2393bb4f7f2604f9018c5803b2ad78a66ec6a0c0bf7330d947b081ce96083593 *install.sh
|
||||
23
code-server/uninstall.sh
Normal file
23
code-server/uninstall.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
source <(curl -f -s --connect-timeout 10 --retry 3 https://dl.acepanel.net/public.sh)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Download public.sh failed, please check the network or try again later."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
code_server_path="${setup_path}/server/code-server"
|
||||
|
||||
systemctl stop code-server
|
||||
systemctl disable code-server
|
||||
|
||||
rm -f /usr/local/bin/code-server
|
||||
rm -rf ${code_server_path}
|
||||
rm -f /etc/systemd/system/code-server.service
|
||||
systemctl daemon-reload
|
||||
|
||||
acepanel app remove codeserver
|
||||
echo -e $HR
|
||||
echo "Uninstall successful"
|
||||
echo -e $HR
|
||||
1
code-server/uninstall.sh.sha256
Normal file
1
code-server/uninstall.sh.sha256
Normal file
@@ -0,0 +1 @@
|
||||
cc73a6f78be813051aba09d1fc407ead37e22a4e30e50de75847b1d0b74498cf *uninstall.sh
|
||||
54
code-server/update.sh
Normal file
54
code-server/update.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
source <(curl -f -s --connect-timeout 10 --retry 3 https://dl.acepanel.net/public.sh)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Download public.sh failed, please check the network or try again later."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
channel=${1}
|
||||
version=${2}
|
||||
code_server_path="${setup_path}/server/code-server"
|
||||
|
||||
if [ ! -d "${code_server_path}" ]; then
|
||||
mkdir -p ${code_server_path}
|
||||
fi
|
||||
|
||||
# 架构判断
|
||||
if [ ${ARCH} == "x86_64" ]; then
|
||||
code_server_file="code-server-${version}-linux-amd64.7z"
|
||||
elif [ ${ARCH} == "aarch64" ]; then
|
||||
code_server_file="code-server-${version}-linux-arm64.7z"
|
||||
else
|
||||
error "Unsupported architecture"
|
||||
fi
|
||||
|
||||
# 下载
|
||||
systemctl stop code-server
|
||||
cd ${code_server_path}
|
||||
rm -rf ${code_server_path}/*
|
||||
dl "${code_server_path}" "/code-server/${code_server_file}"
|
||||
|
||||
# 解压
|
||||
cd ${code_server_path}
|
||||
7z x ${code_server_file}
|
||||
rm -f ${code_server_file}
|
||||
if [ ! -f "${code_server_path}/bin/code-server" ]; then
|
||||
rm -rf ${code_server_path}
|
||||
error "code-server extraction failed"
|
||||
fi
|
||||
|
||||
# 初始化目录
|
||||
chown -R root:root ${code_server_path}
|
||||
chmod -R 700 ${code_server_path}
|
||||
systemctl start code-server
|
||||
if [ "$?" != "0" ]; then
|
||||
error "Failed to start"
|
||||
fi
|
||||
|
||||
acepanel app write codeserver ${channel} ${version}
|
||||
|
||||
echo -e $HR
|
||||
echo "Upgrade successful"
|
||||
echo -e $HR
|
||||
1
code-server/update.sh.sha256
Normal file
1
code-server/update.sh.sha256
Normal file
@@ -0,0 +1 @@
|
||||
d4a4263ebecf90138ca492250444b408f60cbbfdd1df1b418b73947660f2fbed *update.sh
|
||||
Reference in New Issue
Block a user