Skip to content

Instantly share code, notes, and snippets.

@nmcspadden
Created September 24, 2015 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmcspadden/02ffc0fe9b3de4f27f08 to your computer and use it in GitHub Desktop.
Save nmcspadden/02ffc0fe9b3de4f27f08 to your computer and use it in GitHub Desktop.
#!/bin/sh
# preinstall
#
# Make sure that /Library exists. Bail if it does not.
# Also, make sure that Vertica driver can be found. Give error and quit if it can't.
# This runs as a pre-install step by the Vertica configuration installer
#
# Does /Library exist?
if [ ! -d "/Library" ]; then
# Its really bad news if this doesn't exist, so lets just quit the installer
/usr/bin/osascript <<-EOF
tell application "System Events"
activate
display dialog "The /Library folder was not found. Exiting..."
end tell
EOF
exit 1
fi
# Determine if Vertica drivers are installed
libs=`find /Library/ODBC/vertica -name "libverticaodbc.dylib.?.?.?"`
driver=`echo "$libs" | tail -n 1`
if [${driver} == ""]; then
# if no driver was found, then look in ~/Library
libs=`find $HOME/Library/ODBC/vertica -name "libverticaodbc.dylib.?.?.?"`
driver=`echo "$libs" | tail -n 1`
if [${driver} == ""]; then
# no driver found anywhere so exit with a failure
/usr/bin/osascript <<-EOF
tell application "System Events"
activate
display dialog "The Vertica drivers were not found. You must first unzip them into either the /Library/ODBC/Vertica or the ~/Library/ODBC/Vertica folder."
end tell
EOF
exit 1
fi
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment