update install_dir

pull/42/head
Muhammad Atif Ali 2 years ago
parent d93934a006
commit 7f3708f306
No known key found for this signature in database

@ -32,6 +32,12 @@ variable "log_path" {
default = "/tmp/vscode-web.log"
}
variable "install_dir" {
type = string
description = "The directory to install VS Code"
default = "~/.vscodeweb"
}
variable "accept_license" {
type = bool
description = "Accept the VS Code license. https://code.visualstudio.com/license"
@ -56,6 +62,7 @@ resource "coder_script" "vscode-web" {
PORT : var.port,
LOG_PATH : var.log_path,
VERSION : var.custom_version,
INSTALL_DIR : var.install_dir,
})
run_on_start = true
}

@ -1,13 +1,14 @@
#!/usr/bin/env sh
BOLD='\033[0;1m'
# check if VS Code is installed
if
! command -v code &
>/dev/null
then
printf "$${BOLD}Installing VS Code!\n"
output=$(curl -L "https://update.code.visualstudio.com/${VERSION}/linux-deb-x64/stable" -o /tmp/code.deb && sudo apt-get update && sudo apt-get install -y /tmp/code.deb)
# Check if VS Code is installed
if [ ! -d "${INSTALL_DIR}" ]; then
printf "${BOLD}Installing VS Code!\n"
# Download and extract VS Code tarball
output=$(curl -L "https://update.code.visualstudio.com/latest/linux-x64/stable" -o /tmp/code.tar.gz &&
mkdir -p ${INSTALL_DIR} &&
tar -xzf /tmp/code.tar.gz -C ${INSTALL_DIR} --strip-components=1)
if [ $? -ne 0 ]; then
echo "Failed to install VS Code: $output"
exit 1

Loading…
Cancel
Save