Skip to content

Instantly share code, notes, and snippets.

@dragan
Forked from half-ogre/install-nuget.sh
Created May 5, 2012 21:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragan/2605772 to your computer and use it in GitHub Desktop.
Save dragan/2605772 to your computer and use it in GitHub Desktop.
A bash script to install nuget.exe and make it available in bash with a proxy script
#!/usr/bin/env sh
set -e
# Respect PREFIX if set, otherwise default to /usr/local
if [ -z "${PREFIX}" ]; then
PREFIX="/usr/local"
fi
# Respect TMPDIR if set, otherwise default to /tmp
if [ -z "$TMPDIR" ]; then
TMP="/tmp"
else
TMP="${TMPDIR%/}"
fi
BIN_PATH="${PREFIX}/bin"
LIB_PATH="${PREFIX}/lib/nuget"
SEED="$(date "+%Y%m%d%H%M%S").$$"
TEMP_PATH="${TMP}/nuget-curl.${SEED}"
CWD="$(pwd)"
# Create our TEMP_PATH directory
mkdir -p "$TEMP_PATH"
# Download nuget.exe to our temp path
echo "*** Downloading NuGet.exe..."
cd "$TEMP_PATH"
curl -s -O http://anglicangeek.com/nuget.exe
cd "$CWD"
# Remove old nuget
rm -rf "${LIB_PATH}/nuget.exe"
# Move downloaded nuget.exe to LIB_PATH
echo "*** Installing NuGet.exe..."
mkdir -p "$LIB_PATH"
mv "${TEMP_PATH}/nuget.exe" "${LIB_PATH}/nuget.exe"
# Remove old proxy script
rm -rf "${BIN_PATH}/nuget"
# Create new proxy script
echo "#!/bin/sh" >> "${BIN_PATH}/nuget"
echo "mono --runtime=v4.0.30319 ${LIB_PATH}/nuget.exe \"\$@\"" >> "${BIN_PATH}/nuget"
chmod a+x "${BIN_PATH}/nuget"
# Install Certificates
mozroots --import --ask-remove
# Clean Up
echo "*** Cleaning Up..."
rm -rf "$TEMP_PATH"
# All done
echo "*** Installed"
@dragan
Copy link
Author

dragan commented May 5, 2012

Wondering if installing certs call should be moved inside the proxy script, that way it gets called every time nuget is ran.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment