Browse files

Fix package restore on unix platforms.

The NuGet bootstrapper downloads the real NuGet.exe but does not
make it executable. This is required for proper invocation on
unix platforms.
  • Loading branch information...
1 parent 2020df5 commit e497e5e410e036b03c82f5bd101824c1285bf6d6 @jgoz jgoz committed Nov 4, 2012
Showing with 17 additions and 1 deletion.
  1. +17 −1 nuget.sh
View
18 nuget.sh
@@ -3,4 +3,20 @@
NUGET_EXE=src/.nuget/NuGet.exe
PACKAGE_DIR=src/packages
-find . -name 'packages.config' -exec mono --runtime=v4.0 $NUGET_EXE install '{}' -o $PACKAGE_DIR \;
+# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+if [ -z "$XDG_DATA_HOME" ]; then XDG_DATA_HOME=$HOME/.local/share ; fi
+REAL_NUGET_EXE=$XDG_DATA_HOME/NuGet/NuGet.exe
+
+if [ ! -x $REAL_NUGET_EXE ]; then
+ # Ensure real NuGet.exe gets downloaded with this no-op call
+ EnableNuGetPackageRestore=true mono $NUGET_EXE config > /dev/null 2>&1
+
+ if [ ! -e $REAL_NUGET_EXE ]; then
+ echo "ERROR: NuGet.exe bootstrapper did not download the real NuGet.exe" >&2
+ fi
+
+ # Real NuGet must be executable for package restore to work
+ chmod +x $REAL_NUGET_EXE
+fi
+
+EnableNuGetPackageRestore=true find . -name 'packages.config' -exec mono --runtime=v4.0 $NUGET_EXE install '{}' -o $PACKAGE_DIR \;

0 comments on commit e497e5e

Please sign in to comment.