Skip to content

Instantly share code, notes, and snippets.

Created May 28, 2013 20:05
Show Gist options
  • Save anonymous/5665670 to your computer and use it in GitHub Desktop.
Save anonymous/5665670 to your computer and use it in GitHub Desktop.
Light table launcher script
#!/bin/bash
LT=LightTable
# adapted from http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
HERE="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$HERE/$SOURCE"
done
HERE="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# adapted from http://github.com/Kodowa/Light-Table-Playground/issues/161#issuecomment-12392465
warn() {
echo "Make sure you have libudev.so.0 symlinked in $HERE to your version of libudev"
exit 2
}
[[ -e "$HERE/libudev.so.0" ]] || warn
if [[ -n "$LD_LIBRARY_PATH" ]]; then
LD_LIBRARY_PATH="$HERE:/lib:$LD_LIBRARY_PATH"
else
LD_LIBRARY_PATH="$HERE:/lib"
fi
export LD_LIBRARY_PATH
exec -a "$0" "$HERE/$LT" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment