Check if config file exists

This commit is contained in:
Michel Roegl-Brunner
2026-03-11 08:06:41 +01:00
parent f9cb07ee4c
commit bd093e428b

View File

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