diff --git a/vscode-web/run.sh b/vscode-web/run.sh index 1a10aff..6aacdce 100644 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -1,14 +1,21 @@ #!/usr/bin/env sh BOLD='\033[0;1m' -# check if -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 install -y /tmp/code.deb) -if [ $? -ne 0 ]; then - echo "Failed to install VS Code: $output" - exit 1 +# 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 install -y /tmp/code.deb) + if [ $? -ne 0 ]; then + echo "Failed to install VS Code: $output" + exit 1 + fi + printf "🥳 VS code has been installed.\n\n" +else + printf "🥳 VS code is already installed.\n\n" fi -printf "🥳 VS code has been installed.\n\n" echo "👷 Running code serve-web in the background..." echo "Check logs at ${LOG_PATH}!"