Last active
January 4, 2016 18:39
-
-
Save X4/8661793 to your computer and use it in GitHub Desktop.
Generic LD_LIBRARY_PATH override wrapper used for https://github.com/oklai/koala/issues/161 to fix koala's nodewebkit issue complaining that libudev.so.0 is missing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # @author X4 | |
| # @date 2014-28-01 | |
| # This makes my life easier, when people use outdated shared libraries | |
| BIN="${BASH_SOURCE##*-}" | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| SHARED_LIB="libudev.so.0" | |
| SHARED_SOURCE="/opt/google/chrome/" | |
| msg() | |
| { | |
| printf '%b\n' "$1" >&2 | |
| } | |
| error() | |
| { | |
| msg "\e[31m[✘]\e[0m ${1}${2}" | |
| exit 1 | |
| } | |
| check_lib() | |
| { | |
| if [[ ! -e "$SHARED_LIB" ]]; then | |
| error "$1" | |
| fi | |
| } | |
| main() | |
| { | |
| if [[ -n "$LD_LIBRARY_PATH" ]]; then | |
| LD_LIBRARY_PATH="$DIR:$DIR/lib:$LD_LIBRARY_PATH" | |
| else | |
| LD_LIBRARY_PATH="$DIR:$DIR/lib" | |
| fi | |
| export LD_LIBRARY_PATH | |
| exec -a "$BASH_SOURCE" "$DIR/$BIN" "$@" | |
| } | |
| ############################ MAIN() | |
| check_lib "Copy the $SHARED_LIB symlink from $SHARED_SOURCE (or elsewhere) to $(pwd)." | |
| main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment