From 66f6349389c84ded8d4c3645de143f34891b5724 Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Sun, 23 Feb 2025 23:05:54 +0800 Subject: [PATCH 01/14] Update run.sh --- vscode-web/run.sh | 93 ++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index 588cec56..bab4a71d 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -3,6 +3,7 @@ BOLD='\033[0;1m' EXTENSIONS=("${EXTENSIONS}") VSCODE_WEB="${INSTALL_PREFIX}/bin/code-server" +VSCODE_CLI="${INSTALL_PREFIX}/code" # Set extension directory EXTENSION_ARG="" @@ -17,9 +18,9 @@ if [ -n "${SERVER_BASE_PATH}" ]; then fi run_vscode_web() { - echo "👷 Running $VSCODE_WEB serve-local $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..." + echo "👷 Running $VSCODE_CLI serve-web $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." echo "Check logs at ${LOG_PATH}!" - "$VSCODE_WEB" serve-local "$EXTENSION_ARG" "$SERVER_BASE_PATH_ARG" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level "${TELEMETRY_LEVEL}" > "${LOG_PATH}" 2>&1 & + "$VSCODE_CLI" serve-web "$EXTENSION_ARG" "$SERVER_BASE_PATH_ARG" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists... @@ -30,18 +31,18 @@ if [ ! -f ~/.vscode-server/data/Machine/settings.json ]; then fi # Check if vscode-server is already installed for offline or cached mode -if [ -f "$VSCODE_WEB" ]; then - if [ "${OFFLINE}" = true ] || [ "${USE_CACHED}" = true ]; then - echo "🥳 Found a copy of VS Code Web" - run_vscode_web - exit 0 - fi -fi +#if [ -f "$VSCODE_WEB" ]; then +# if [ "${OFFLINE}" = true ] || [ "${USE_CACHED}" = true ]; then +# echo "🥳 Found a copy of VS Code Web" +# run_vscode_web +# exit 0 +# fi +#fi # Offline mode always expects a copy of vscode-server to be present -if [ "${OFFLINE}" = true ]; then - echo "Failed to find a copy of VS Code Web" - exit 1 -fi +#if [ "${OFFLINE}" = true ]; then +# echo "Failed to find a copy of VS Code Web" +# exit 1 +#fi # Create install prefix mkdir -p ${INSTALL_PREFIX} @@ -67,7 +68,8 @@ else fi printf "$${BOLD}VS Code Web commit id version $HASH.\n" -output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode-server-linux-$ARCH-web.tar.gz" | tar -xz -C "${INSTALL_PREFIX}" --strip-components 1) +# Todo: Support download for other OS +output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode_cli_alpine_x64_cli.tar.gz" | tar -xz -C "${INSTALL_PREFIX}" --strip-components 1) if [ $? -ne 0 ]; then echo "Failed to install Microsoft Visual Studio Code Server: $output" @@ -75,37 +77,38 @@ if [ $? -ne 0 ]; then fi printf "$${BOLD}VS Code Web has been installed.\n" +# Todo: Support download extension later # Install each extension... -IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}" -for extension in "$${EXTENSIONLIST[@]}"; do - if [ -z "$extension" ]; then - continue - fi - printf "🧩 Installing extension $${CODE}$extension$${RESET}...\n" - output=$($VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force) - if [ $? -ne 0 ]; then - echo "Failed to install extension: $extension: $output" - fi -done - -if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then - if ! command -v jq > /dev/null; then - echo "jq is required to install extensions from a workspace file." - else - WORKSPACE_DIR="$HOME" - if [ -n "${FOLDER}" ]; then - WORKSPACE_DIR="${FOLDER}" - fi - - if [ -f "$WORKSPACE_DIR/.vscode/extensions.json" ]; then - printf "🧩 Installing extensions from %s/.vscode/extensions.json...\n" "$WORKSPACE_DIR" - # Use sed to remove single-line comments before parsing with jq - extensions=$(sed 's|//.*||g' "$WORKSPACE_DIR"/.vscode/extensions.json | jq -r '.recommendations[]') - for extension in $extensions; do - $VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force - done - fi - fi -fi +#IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}" +#for extension in "$${EXTENSIONLIST[@]}"; do +# if [ -z "$extension" ]; then +# continue +# fi +# printf "🧩 Installing extension $${CODE}$extension$${RESET}...\n" +# output=$($VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force) +# if [ $? -ne 0 ]; then +# echo "Failed to install extension: $extension: $output" +# fi +#done + +#if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then +# if ! command -v jq > /dev/null; then +# echo "jq is required to install extensions from a workspace file." +# else +# WORKSPACE_DIR="$HOME" +# if [ -n "${FOLDER}" ]; then +# WORKSPACE_DIR="${FOLDER}" +# fi +# +# if [ -f "$WORKSPACE_DIR/.vscode/extensions.json" ]; then +# printf "🧩 Installing extensions from %s/.vscode/extensions.json...\n" "$WORKSPACE_DIR" +# # Use sed to remove single-line comments before parsing with jq +# extensions=$(sed 's|//.*||g' "$WORKSPACE_DIR"/.vscode/extensions.json | jq -r '.recommendations[]') +# for extension in $extensions; do +# $VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force +# done +# fi +# fi +#fi run_vscode_web From 1a06957a26b8d26913518d294e012aa906b10921 Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Sun, 23 Feb 2025 23:23:04 +0800 Subject: [PATCH 02/14] Update run.sh --- vscode-web/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index bab4a71d..f5297e74 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -69,7 +69,7 @@ fi printf "$${BOLD}VS Code Web commit id version $HASH.\n" # Todo: Support download for other OS -output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode_cli_alpine_x64_cli.tar.gz" | tar -xz -C "${INSTALL_PREFIX}" --strip-components 1) +output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode_cli_alpine_x64_cli.tar.gz" | tar -xz -C "${INSTALL_PREFIX}") if [ $? -ne 0 ]; then echo "Failed to install Microsoft Visual Studio Code Server: $output" From 787c0582d7adaa3cd981c69fd2e925c54bd19871 Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Sun, 23 Feb 2025 23:30:05 +0800 Subject: [PATCH 03/14] Update run.sh --- vscode-web/run.sh | 77 +++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index f5297e74..02264ec9 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -77,38 +77,49 @@ if [ $? -ne 0 ]; then fi printf "$${BOLD}VS Code Web has been installed.\n" -# Todo: Support download extension later -# Install each extension... -#IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}" -#for extension in "$${EXTENSIONLIST[@]}"; do -# if [ -z "$extension" ]; then -# continue -# fi -# printf "🧩 Installing extension $${CODE}$extension$${RESET}...\n" -# output=$($VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force) -# if [ $? -ne 0 ]; then -# echo "Failed to install extension: $extension: $output" -# fi -#done - -#if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then -# if ! command -v jq > /dev/null; then -# echo "jq is required to install extensions from a workspace file." -# else -# WORKSPACE_DIR="$HOME" -# if [ -n "${FOLDER}" ]; then -# WORKSPACE_DIR="${FOLDER}" -# fi -# -# if [ -f "$WORKSPACE_DIR/.vscode/extensions.json" ]; then -# printf "🧩 Installing extensions from %s/.vscode/extensions.json...\n" "$WORKSPACE_DIR" -# # Use sed to remove single-line comments before parsing with jq -# extensions=$(sed 's|//.*||g' "$WORKSPACE_DIR"/.vscode/extensions.json | jq -r '.recommendations[]') -# for extension in $extensions; do -# $VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force -# done -# fi -# fi -#fi +VSCODE_WEB="~/.vscode/cli/serve-web/$HASH/bin/code-server" +install_extension() { + while true; do + if [ -f "$VSCODE_WEB" ]; then + echo "$VSCODE_WEB exists." + break + fi + sleep 5 + done + + # Install each extension... + IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}" + for extension in "$${EXTENSIONLIST[@]}"; do + if [ -z "$extension" ]; then + continue + fi + printf "🧩 Installing extension $${CODE}$extension$${RESET}...\n" + output=$($VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force) + if [ $? -ne 0 ]; then + echo "Failed to install extension: $extension: $output" + fi + done + + if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then + if ! command -v jq > /dev/null; then + echo "jq is required to install extensions from a workspace file." + else + WORKSPACE_DIR="$HOME" + if [ -n "${FOLDER}" ]; then + WORKSPACE_DIR="${FOLDER}" + fi + + if [ -f "$WORKSPACE_DIR/.vscode/extensions.json" ]; then + printf "🧩 Installing extensions from %s/.vscode/extensions.json...\n" "$WORKSPACE_DIR" + # Use sed to remove single-line comments before parsing with jq + extensions=$(sed 's|//.*||g' "$WORKSPACE_DIR"/.vscode/extensions.json | jq -r '.recommendations[]') + for extension in $extensions; do + $VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force + done + fi + fi + fi +} run_vscode_web +install_extension From e7af502492fcd76df153c5956ce70b6776a0280a Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Sun, 23 Feb 2025 23:40:31 +0800 Subject: [PATCH 04/14] Update run.sh --- vscode-web/run.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index 02264ec9..c23b02f6 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -20,7 +20,8 @@ fi run_vscode_web() { echo "👷 Running $VSCODE_CLI serve-web $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." echo "Check logs at ${LOG_PATH}!" - "$VSCODE_CLI" serve-web "$EXTENSION_ARG" "$SERVER_BASE_PATH_ARG" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & + # Todo: Add EXTENSION_ARG and SERVER_BASE_PATH_ARG + "$VSCODE_CLI" serve-web --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists... From b17d169363f27c200995d322dded7f99a9fd5fa8 Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 00:01:21 +0800 Subject: [PATCH 05/14] Update run.sh --- vscode-web/run.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index c23b02f6..dbb2b597 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -80,11 +80,14 @@ printf "$${BOLD}VS Code Web has been installed.\n" VSCODE_WEB="~/.vscode/cli/serve-web/$HASH/bin/code-server" install_extension() { + echo "Wait for $VSCODE_WEB." + while true; do if [ -f "$VSCODE_WEB" ]; then echo "$VSCODE_WEB exists." break fi + echo "Wait for $VSCODE_WEB." sleep 5 done From d29075bd2acba302e46f885897033391c8770fce Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 00:11:12 +0800 Subject: [PATCH 06/14] Update run.sh --- vscode-web/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index dbb2b597..7c9cd044 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -78,7 +78,7 @@ if [ $? -ne 0 ]; then fi printf "$${BOLD}VS Code Web has been installed.\n" -VSCODE_WEB="~/.vscode/cli/serve-web/$HASH/bin/code-server" +VSCODE_WEB=~/.vscode/cli/serve-web/$HASH/bin/code-server install_extension() { echo "Wait for $VSCODE_WEB." From 0249439bda26eb77a8dbee3a12f2e989aaa4f38f Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 00:18:31 +0800 Subject: [PATCH 07/14] Update run.sh --- vscode-web/run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index 7c9cd044..a12ff780 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -123,6 +123,7 @@ install_extension() { fi fi fi + printf "✅ VSCode Web Extension installed.\n" } run_vscode_web From ee978517c03b16eecab421c085cb015e5d96211c Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 00:35:41 +0800 Subject: [PATCH 08/14] Update run.sh --- vscode-web/run.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index a12ff780..1292d226 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -80,7 +80,8 @@ printf "$${BOLD}VS Code Web has been installed.\n" VSCODE_WEB=~/.vscode/cli/serve-web/$HASH/bin/code-server install_extension() { - echo "Wait for $VSCODE_WEB." + # code serve-web auto download code-server by health check trigger. + echo "Download code-server to $VSCODE_WEB." while true; do if [ -f "$VSCODE_WEB" ]; then @@ -88,7 +89,7 @@ install_extension() { break fi echo "Wait for $VSCODE_WEB." - sleep 5 + sleep 30 done # Install each extension... @@ -123,8 +124,8 @@ install_extension() { fi fi fi - printf "✅ VSCode Web Extension installed.\n" } run_vscode_web install_extension +printf "✅ VSCode Web installed.\n" From 829a05552050d18585ea4c549afc9adcae741bc7 Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 00:55:28 +0800 Subject: [PATCH 09/14] Update run.sh --- vscode-web/run.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index 1292d226..9fa6583a 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -2,7 +2,6 @@ BOLD='\033[0;1m' EXTENSIONS=("${EXTENSIONS}") -VSCODE_WEB="${INSTALL_PREFIX}/bin/code-server" VSCODE_CLI="${INSTALL_PREFIX}/code" # Set extension directory @@ -20,8 +19,7 @@ fi run_vscode_web() { echo "👷 Running $VSCODE_CLI serve-web $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." echo "Check logs at ${LOG_PATH}!" - # Todo: Add EXTENSION_ARG and SERVER_BASE_PATH_ARG - "$VSCODE_CLI" serve-web --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & + "$VSCODE_CLI" serve-web ${EXTENSION_ARG} ${SERVER_BASE_PATH_ARG} --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists... @@ -65,12 +63,11 @@ esac if [ -n "${COMMIT_ID}" ]; then HASH="${COMMIT_ID}" else - HASH=$(curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH-web | cut -d '"' -f 2) + HASH=$(curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux-${ARCH}-web | cut -d '"' -f 2) fi -printf "$${BOLD}VS Code Web commit id version $HASH.\n" +printf "$${BOLD}VS Code Web commit id version ${HASH}.\n" -# Todo: Support download for other OS -output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode_cli_alpine_x64_cli.tar.gz" | tar -xz -C "${INSTALL_PREFIX}") +output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/${HASH}/vscode_cli_alpine_${ARCH}_cli.tar.gz" | tar -xz -C "${INSTALL_PREFIX}") if [ $? -ne 0 ]; then echo "Failed to install Microsoft Visual Studio Code Server: $output" @@ -78,10 +75,10 @@ if [ $? -ne 0 ]; then fi printf "$${BOLD}VS Code Web has been installed.\n" -VSCODE_WEB=~/.vscode/cli/serve-web/$HASH/bin/code-server +VSCODE_WEB=~/.vscode/cli/serve-web/${HASH}/bin/code-server install_extension() { # code serve-web auto download code-server by health check trigger. - echo "Download code-server to $VSCODE_WEB." + echo "Download code-server to ${VSCODE_WEB}." while true; do if [ -f "$VSCODE_WEB" ]; then From 09411d21720c853d32118a47d948a6d4d21edbd9 Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 01:13:06 +0800 Subject: [PATCH 10/14] Update run.sh --- vscode-web/run.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index 9fa6583a..39d88a54 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -4,22 +4,21 @@ BOLD='\033[0;1m' EXTENSIONS=("${EXTENSIONS}") VSCODE_CLI="${INSTALL_PREFIX}/code" +ARGS=() # Set extension directory -EXTENSION_ARG="" if [ -n "${EXTENSIONS_DIR}" ]; then - EXTENSION_ARG="--extensions-dir=${EXTENSIONS_DIR}" + ARGS+=("--extensions-dir=${EXTENSIONS_DIR}") fi # Set extension directory -SERVER_BASE_PATH_ARG="" if [ -n "${SERVER_BASE_PATH}" ]; then - SERVER_BASE_PATH_ARG="--server-base-path=${SERVER_BASE_PATH}" + ARGS+=("--server-base-path=${SERVER_BASE_PATH}") fi run_vscode_web() { echo "👷 Running $VSCODE_CLI serve-web $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." echo "Check logs at ${LOG_PATH}!" - "$VSCODE_CLI" serve-web ${EXTENSION_ARG} ${SERVER_BASE_PATH_ARG} --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & + "$VSCODE_CLI" serve-web "${ARGS[@]}" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists... From 86f14c1e71a3a5cde25c49d0620d9727e7e5ba26 Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 01:17:18 +0800 Subject: [PATCH 11/14] Update run.sh --- vscode-web/run.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index 39d88a54..a244bb01 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -4,21 +4,22 @@ BOLD='\033[0;1m' EXTENSIONS=("${EXTENSIONS}") VSCODE_CLI="${INSTALL_PREFIX}/code" -ARGS=() # Set extension directory +EXTENSION_ARG="" if [ -n "${EXTENSIONS_DIR}" ]; then - ARGS+=("--extensions-dir=${EXTENSIONS_DIR}") + EXTENSION_ARG="--extensions-dir=${EXTENSIONS_DIR}" fi # Set extension directory +SERVER_BASE_PATH_ARG="" if [ -n "${SERVER_BASE_PATH}" ]; then - ARGS+=("--server-base-path=${SERVER_BASE_PATH}") + SERVER_BASE_PATH_ARG="--server-base-path=${SERVER_BASE_PATH}" fi run_vscode_web() { echo "👷 Running $VSCODE_CLI serve-web $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." echo "Check logs at ${LOG_PATH}!" - "$VSCODE_CLI" serve-web "${ARGS[@]}" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & + "$VSCODE_CLI" serve-web ${EXTENSION_ARG:+$EXTENSION_ARG} ${SERVER_BASE_PATH_ARG:+$SERVER_BASE_PATH_ARG} --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists... From 1eebdd494ef3a6700f7a50a2bd5d81e33c5c0914 Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 01:20:54 +0800 Subject: [PATCH 12/14] Update run.sh --- vscode-web/run.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index a244bb01..c11d2844 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -5,21 +5,19 @@ EXTENSIONS=("${EXTENSIONS}") VSCODE_CLI="${INSTALL_PREFIX}/code" # Set extension directory -EXTENSION_ARG="" if [ -n "${EXTENSIONS_DIR}" ]; then - EXTENSION_ARG="--extensions-dir=${EXTENSIONS_DIR}" + EXTENSIONS_DIR="--extensions-dir=${EXTENSIONS_DIR}" fi # Set extension directory -SERVER_BASE_PATH_ARG="" if [ -n "${SERVER_BASE_PATH}" ]; then - SERVER_BASE_PATH_ARG="--server-base-path=${SERVER_BASE_PATH}" + SERVER_BASE_PATH="--server-base-path=${SERVER_BASE_PATH}" fi run_vscode_web() { - echo "👷 Running $VSCODE_CLI serve-web $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." + echo "👷 Running $VSCODE_CLI serve-web $EXTENSIONS_DIR $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." echo "Check logs at ${LOG_PATH}!" - "$VSCODE_CLI" serve-web ${EXTENSION_ARG:+$EXTENSION_ARG} ${SERVER_BASE_PATH_ARG:+$SERVER_BASE_PATH_ARG} --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & + "$VSCODE_CLI" serve-web ${EXTENSIONS_DIR} ${SERVER_BASE_PATH} --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists... @@ -96,7 +94,7 @@ install_extension() { continue fi printf "🧩 Installing extension $${CODE}$extension$${RESET}...\n" - output=$($VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force) + output=$($VSCODE_WEB $EXTENSIONS_DIR --install-extension "$extension" --force) if [ $? -ne 0 ]; then echo "Failed to install extension: $extension: $output" fi @@ -116,7 +114,7 @@ install_extension() { # Use sed to remove single-line comments before parsing with jq extensions=$(sed 's|//.*||g' "$WORKSPACE_DIR"/.vscode/extensions.json | jq -r '.recommendations[]') for extension in $extensions; do - $VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force + $VSCODE_WEB $EXTENSIONS_DIR --install-extension "$extension" --force done fi fi From d8f633240d61b3e3a871f1480c68a992683d80be Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 01:24:38 +0800 Subject: [PATCH 13/14] Update run.sh --- vscode-web/run.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index c11d2844..110c3856 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -61,11 +61,11 @@ esac if [ -n "${COMMIT_ID}" ]; then HASH="${COMMIT_ID}" else - HASH=$(curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux-${ARCH}-web | cut -d '"' -f 2) + HASH=$(curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH-web | cut -d '"' -f 2) fi -printf "$${BOLD}VS Code Web commit id version ${HASH}.\n" +printf "$${BOLD}VS Code Web commit id version $HASH.\n" -output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/${HASH}/vscode_cli_alpine_${ARCH}_cli.tar.gz" | tar -xz -C "${INSTALL_PREFIX}") +output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode_cli_alpine_"$ARCH"_cli.tar.gz" | tar -xz -C "${INSTALL_PREFIX}") if [ $? -ne 0 ]; then echo "Failed to install Microsoft Visual Studio Code Server: $output" @@ -73,10 +73,10 @@ if [ $? -ne 0 ]; then fi printf "$${BOLD}VS Code Web has been installed.\n" -VSCODE_WEB=~/.vscode/cli/serve-web/${HASH}/bin/code-server +VSCODE_WEB=~/.vscode/cli/serve-web/$HASH/bin/code-server install_extension() { # code serve-web auto download code-server by health check trigger. - echo "Download code-server to ${VSCODE_WEB}." + echo "Download code-server to $VSCODE_WEB." while true; do if [ -f "$VSCODE_WEB" ]; then From 020325fcb49711dce6c4f519634ebc41f2b7871e Mon Sep 17 00:00:00 2001 From: Hao <14084342+Ricky-Hao@users.noreply.github.com> Date: Mon, 24 Feb 2025 01:31:16 +0800 Subject: [PATCH 14/14] Update run.sh --- vscode-web/run.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vscode-web/run.sh b/vscode-web/run.sh index 110c3856..1c7b268c 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -5,19 +5,21 @@ EXTENSIONS=("${EXTENSIONS}") VSCODE_CLI="${INSTALL_PREFIX}/code" # Set extension directory +EXTENSION_ARG="" if [ -n "${EXTENSIONS_DIR}" ]; then - EXTENSIONS_DIR="--extensions-dir=${EXTENSIONS_DIR}" + EXTENSION_ARG="--extensions-dir=${EXTENSIONS_DIR}" fi # Set extension directory +SERVER_BASE_PATH_ARG="" if [ -n "${SERVER_BASE_PATH}" ]; then - SERVER_BASE_PATH="--server-base-path=${SERVER_BASE_PATH}" + SERVER_BASE_PATH_ARG="--server-base-path=${SERVER_BASE_PATH}" fi run_vscode_web() { - echo "👷 Running $VSCODE_CLI serve-web $EXTENSIONS_DIR $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." + echo "👷 Running $VSCODE_CLI serve-web $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token in the background..." echo "Check logs at ${LOG_PATH}!" - "$VSCODE_CLI" serve-web ${EXTENSIONS_DIR} ${SERVER_BASE_PATH} --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & + "$VSCODE_CLI" serve-web $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists...