Compare commits

...

2 Commits

Author SHA1 Message Date
Slaviša Arežina
8b1165e713 Apply suggestion from @tremor021 2026-03-11 08:20:14 +01:00
Michel Roegl-Brunner
bd093e428b Check if config file exists 2026-03-11 08:06:41 +01:00

View File

@@ -89,17 +89,25 @@ VERSION=$(curl -fsSL https://api.github.com/repos/coder/code-server/releases/lat
awk '{print substr($2, 3, length($2)-4) }') awk '{print substr($2, 3, length($2)-4) }')
msg_info "Installing Code-Server v${VERSION}" msg_info "Installing Code-Server v${VERSION}"
if [ -f ~/.config/code-server/config.yaml ]; then
existing_config = true
fi
curl -fOL https://github.com/coder/code-server/releases/download/v"$VERSION"/code-server_"${VERSION}"_amd64.deb &>/dev/null curl -fOL https://github.com/coder/code-server/releases/download/v"$VERSION"/code-server_"${VERSION}"_amd64.deb &>/dev/null
dpkg -i code-server_"${VERSION}"_amd64.deb &>/dev/null dpkg -i code-server_"${VERSION}"_amd64.deb &>/dev/null
rm -rf code-server_"${VERSION}"_amd64.deb rm -rf code-server_"${VERSION}"_amd64.deb
mkdir -p ~/.config/code-server/ mkdir -p ~/.config/code-server/
systemctl enable -q --now code-server@"$USER" systemctl enable -q --now code-server@"$USER"
if [ $existing_config = false ]; then
cat <<EOF >~/.config/code-server/config.yaml cat <<EOF >~/.config/code-server/config.yaml
bind-addr: 0.0.0.0:8680 bind-addr: 0.0.0.0:8680
auth: none auth: none
password: password:
cert: false cert: false
EOF EOF
fi
systemctl restart code-server@"$USER" systemctl restart code-server@"$USER"
msg_ok "Installed Code-Server v${VERSION} on $hostname" msg_ok "Installed Code-Server v${VERSION} on $hostname"