@@ -116,9 +116,8 @@ echo "Installing Oryx..."
116116# Ensure apt is in non-interactive to avoid prompts
117117export DEBIAN_FRONTEND=noninteractive
118118
119-
120119# Install dependencies
121- check_packages git sudo curl ca-certificates apt-transport-https gnupg2 dirmngr libc-bin
120+ check_packages git sudo curl ca-certificates apt-transport-https gnupg2 dirmngr libc-bin moreutils
122121
123122if ! cat /etc/group | grep -e " ^oryx:" > /dev/null 2>&1 ; then
124123 groupadd -r oryx
@@ -127,16 +126,23 @@ usermod -a -G oryx "${USERNAME}"
127126
128127# Required to decide if we want to clean up dotnet later.
129128DOTNET_INSTALLATION_PACKAGE=" "
129+ DOTNET_BINARY=" "
130+
131+ if dotnet --version > /dev/null ; then
132+ DOTNET_BINARY=$( which dotnet)
133+ fi
130134
131- # Install dotnet unless available
132- if ! dotnet --version > /dev/null ; then
133- echo " 'dotnet' was not detected. Attempting to install the latest version of the dotnet sdk to build oryx."
135+ # Oryx needs to be built with .NET 6
136+ if [[ " ${DOTNET_BINARY} " = " " ]] || [[ " $( dotnet --version) " != * " 6 " * ]] ; then
137+ echo " 'dotnet 6 ' was not detected. Attempting to install .NET 6 to build oryx."
134138 install_dotnet_using_apt
135139
136140 if ! dotnet --version > /dev/null ; then
137141 echo " (!) Please install Dotnet before installing Oryx"
138142 exit 1
139143 fi
144+
145+ DOTNET_BINARY=" /usr/bin/dotnet"
140146fi
141147
142148BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen
@@ -150,8 +156,8 @@ git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX
150156
151157$GIT_ORYX /build/buildSln.sh
152158
153- dotnet publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX /src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj
154- dotnet publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX /src/BuildServer/BuildServer.csproj
159+ ${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX /src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj
160+ ${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX /src/BuildServer/BuildServer.csproj
155161
156162chmod a+x ${BUILD_SCRIPT_GENERATOR} /GenerateBuildScript
157163
0 commit comments