|
|
|
@ -10,6 +10,9 @@ CODE_SERVER="${INSTALL_PREFIX}/bin/code-server"
|
|
|
|
|
EXTENSION_ARG=""
|
|
|
|
|
if [ -n "${EXTENSIONS_DIR}" ]; then
|
|
|
|
|
EXTENSION_ARG="--extensions-dir=${EXTENSIONS_DIR}"
|
|
|
|
|
EXTENSIONS_DIR="${EXTENSIONS_DIR}"
|
|
|
|
|
else
|
|
|
|
|
EXTENSIONS_DIR="${INSTALL_PREFIX}/extensions"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
function run_code_server() {
|
|
|
|
@ -27,7 +30,9 @@ fi
|
|
|
|
|
|
|
|
|
|
# Check if code-server is already installed for offline or cached mode
|
|
|
|
|
if [ -f "$CODE_SERVER" ]; then
|
|
|
|
|
if [ "${OFFLINE}" = true ] || [ "${USE_CACHED}" = true ]; then
|
|
|
|
|
if [ "${USE_CACHED}" = true ] && [ ! -d "$EXTENSIONS_DIR" ]; then
|
|
|
|
|
echo "No extensions have been installed yet..."
|
|
|
|
|
elif [ "${OFFLINE}" = true ] || [ "${USE_CACHED}" = true ]; then
|
|
|
|
|
echo "🥳 Found a copy of code-server"
|
|
|
|
|
run_code_server
|
|
|
|
|
exit 0
|
|
|
|
@ -39,22 +44,25 @@ if [ "${OFFLINE}" = true ]; then
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
printf "$${BOLD}Installing code-server!\n"
|
|
|
|
|
# If there is no cached install OR we don't want to use a cached install
|
|
|
|
|
if [ ! -f "$CODE_SERVER" ] || [ "${USE_CACHED}" != true ]; then
|
|
|
|
|
printf "$${BOLD}Installing code-server!\n"
|
|
|
|
|
|
|
|
|
|
ARGS=(
|
|
|
|
|
"--method=standalone"
|
|
|
|
|
"--prefix=${INSTALL_PREFIX}"
|
|
|
|
|
)
|
|
|
|
|
if [ -n "${VERSION}" ]; then
|
|
|
|
|
ARGS+=("--version=${VERSION}")
|
|
|
|
|
fi
|
|
|
|
|
ARGS=(
|
|
|
|
|
"--method=standalone"
|
|
|
|
|
"--prefix=${INSTALL_PREFIX}"
|
|
|
|
|
)
|
|
|
|
|
if [ -n "${VERSION}" ]; then
|
|
|
|
|
ARGS+=("--version=${VERSION}")
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
output=$(curl -fsSL https://code-server.dev/install.sh | sh -s -- "$${ARGS[@]}")
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
echo "Failed to install code-server: $output"
|
|
|
|
|
exit 1
|
|
|
|
|
output=$(curl -fsSL https://code-server.dev/install.sh | sh -s -- "$${ARGS[@]}")
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
echo "Failed to install code-server: $output"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
printf "🥳 code-server has been installed in ${INSTALL_PREFIX}\n\n"
|
|
|
|
|
fi
|
|
|
|
|
printf "🥳 code-server has been installed in ${INSTALL_PREFIX}\n\n"
|
|
|
|
|
|
|
|
|
|
# Install each extension...
|
|
|
|
|
IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}"
|
|
|
|
|