From a6d59106ba469850c362ebb898f7fd8bea9e82b7 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 25 Sep 2023 16:21:38 +0300 Subject: [PATCH] check if vscode is already installed. --- vscode-web/run.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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}!"