Skip to content

Instantly share code, notes, and snippets.

@diegobfernandez
Last active August 29, 2015 14:20
Show Gist options
  • Save diegobfernandez/e7f9a18663675c077169 to your computer and use it in GitHub Desktop.
Save diegobfernandez/e7f9a18663675c077169 to your computer and use it in GitHub Desktop.
Install NuGet on Mono
#!/bin/bash
# Tested on Mono 3.12.1
USER_HOME=~
NUGET_DIR=$USER_HOME/.nuget
NUGET_EXE_URL="https://nuget.org/nuget.exe"
NUGET_EXE_NAME=nuget.exe
NUGET_EXE_PATH=$NUGET_DIR/$NUGET_EXE_NAME
# Clean $NUGET_DIR in order to override previous versions installed
echo "Removing $NUGET_DIR"
rm -rf $NUGET_DIR
echo "Creating $NUGET_DIR"
mkdir -p $NUGET_DIR
echo "Downloading $NUGET_EXE_URL to $NUGET_EXE_PATH"
wget -O $NUGET_EXE_PATH $NUGET_EXE_URL
echo "Modifying $NUGET_EXE_PATH for execution permission"
chmod +x $NUGET_EXE_PATH
if ! type nuget > /dev/null; then
echo "Creating nuget function on $USER_HOME/.bashrc"
echo "function nuget() { mono $NUGET_EXE_PATH \"\$@\"; }" >> $USER_HOME/.bashrc
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment