Skip to content

Commit 1757e6e

Browse files
committed
Failing to remove .net runtimes installed with pinned sdk
1 parent cb2cb42 commit 1757e6e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/oryx/install.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ DOTNET_BINARY=""
149149

150150
if dotnet --version > /dev/null ; then
151151
DOTNET_BINARY=$(which dotnet)
152+
RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq)
152153
fi
153154

154155
MAJOR_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 1)
@@ -233,12 +234,11 @@ fi
233234
if [[ "${PINNED_SDK_VERSION}" != "" ]]; then
234235
rm -f ${GIT_ORYX}/global.json
235236
rm -rf /usr/share/dotnet/sdk/$PINNED_SDK_VERSION
236-
237-
# Extract the major, minor version and the first digit of the patch version
238-
MAJOR_MINOR_PATCH1_VERSION=${PINNED_SDK_VERSION%??}
239-
rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$MAJOR_MINOR_PATCH1_VERSION
240-
rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$MAJOR_MINOR_PATCH1_VERSION
241-
rm -rf /usr/share/dotnet/templates/$MAJOR_MINOR_PATCH1_VERSION
237+
NEW_RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq)
238+
SDK_INSTALLED_RUNTIME=$(echo "$NEW_RUNTIME_VERSIONS" | grep -vxFf <(echo "$RUNTIME_VERSIONS"))
239+
rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$SDK_INSTALLED_RUNTIME
240+
rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$SDK_INSTALLED_RUNTIME
241+
rm -rf /usr/share/dotnet/templates/$SDK_INSTALLED_RUNTIME
242242
fi
243243

244244

0 commit comments

Comments
 (0)