diff --git a/.devcontainer/features/spacefx-dev/postStart.sh b/.devcontainer/features/spacefx-dev/postStart.sh index 6abc142..651548f 100755 --- a/.devcontainer/features/spacefx-dev/postStart.sh +++ b/.devcontainer/features/spacefx-dev/postStart.sh @@ -42,6 +42,25 @@ run_a_script "touch /spacefx-dev/postStart.start" STAGE_SPACE_FX_CMD_EXTRAS="" +############################################################ +# Install Dotnet +############################################################ +function check_and_install_dotnet(){ + info_log "START: ${FUNCNAME[0]}" + + info_log "Checking for dotnet ('${DOTNET_INSTALL_DIR:?}/dotnet')..." + if [[ ! -f "${DOTNET_INSTALL_DIR:?}/dotnet" ]]; then + info_log "...dotnet not found. Downloading..." + run_a_script "wget -P /tmp -q https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh" --disable_log + run_a_script "chmod +x /tmp/dotnet-install.sh" --disable_log + run_a_script "/tmp/dotnet-install.sh --version ${DOTNET_SDK_VERSION:?}" --disable_log + fi + + info_log "...dotnet found at '${DOTNET_INSTALL_DIR:?}/dotnet'" + + info_log "END: ${FUNCNAME[0]}" +} + ############################################################ # Install VSDebugger ############################################################ @@ -72,7 +91,7 @@ function add_spacedev_nuget_source(){ create_directory "${SPACEFX_DIR}/nuget" - run_a_script "dotnet nuget list source" current_nuget_sources + run_a_script "${DOTNET_INSTALL_DIR:?}/dotnet nuget list source" current_nuget_sources if [[ $current_nuget_sources == *"${SPACEFX_DIR}/nuget"* ]]; then info_log "found nuget source '${SPACEFX_DIR}/nuget'. Nothing to do." @@ -81,7 +100,7 @@ function add_spacedev_nuget_source(){ fi info_log "Adding '${SPACEFX_DIR}/nuget' as a nuget source..." - run_a_script "dotnet nuget add source ${SPACEFX_DIR}/nuget" + run_a_script "${DOTNET_INSTALL_DIR:?}/dotnet nuget add source ${SPACEFX_DIR}/nuget" info_log "...successfully added '${SPACEFX_DIR}/nuget'" @@ -300,13 +319,15 @@ SPACEFX_UPDATE_END" --disable_log } function main() { + check_and_install_dotnet + check_and_install_vsdebugger + add_spacedev_nuget_source wipe_bin_and_obj_directories if [[ "${CLUSTER_ENABLED}" == true ]] && [[ "${DEBUG_SHIM_ENABLED}" == true ]]; then [[ ! -d "${CONTAINER_WORKING_DIR:?}/.git/spacefx-dev" ]] && run_a_script "mkdir -p ${CONTAINER_WORKING_DIR:?}/.git/spacefx-dev" --disable_log [[ ! -f "${CONTAINER_WORKING_DIR:?}/.git/spacefx-dev/debugShim_keepAlive.sh" ]] && run_a_script "cp /spacefx-dev/debugShim_keepAlive.sh ${CONTAINER_WORKING_DIR:?}/.git/spacefx-dev/debugShim_keepAlive.sh" --disable_log - check_and_install_vsdebugger generate_debugshims # run_user_requested_yamls fi diff --git a/README.md b/README.md index a3baa42..baae64e 100644 --- a/README.md +++ b/README.md @@ -114,8 +114,6 @@ oras push ${REGISTRY}/${FEATURE}:${VERSION} \ ``` - - ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a diff --git a/modules/m_100_collect_container_info.sh b/modules/m_100_collect_container_info.sh index 5c68323..b7949d2 100644 --- a/modules/m_100_collect_container_info.sh +++ b/modules/m_100_collect_container_info.sh @@ -86,6 +86,17 @@ export CONTAINER_WORKING_DIR=${CONTAINER_WORKING_DIR} SPACEFX_UPDATE_END" --disable_log fi + # Check and add the dotnet install dir to the app.env file + if [[ "$_spacefx_dev_env" != *"DOTNET_INSTALL_DIR"* ]]; then + run_a_script "tee -a ${SPACEFX_DEV_ENV} > /dev/null << SPACEFX_UPDATE_END +export DOTNET_INSTALL_DIR=${CONTAINER_WORKING_DIR:?}/.git/spacefx-dev/dotnet +SPACEFX_UPDATE_END" --disable_log + export DOTNET_INSTALL_DIR=${CONTAINER_WORKING_DIR:?}/.git/spacefx-dev/dotnet + export PATH="${CONTAINER_WORKING_DIR:?}/.git/spacefx-dev/dotnet:${PATH}" + fi + + + }