Created
September 13, 2015 10:27
-
-
Save zwetan/a3e3c35bc9d34d65c921 to your computer and use it in GitHub Desktop.
redbean bash script to place in the redtamarin-sdk bin folder (rename original redbean binary to "redbean-macintosh" for ex)
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 | |
| function follow_links() { | |
| file="$1" | |
| while [ -h "$file" ]; do | |
| # On Mac OS, readlink -f doesn't work. | |
| file="$(readlink "$file")" | |
| done | |
| echo "$file" | |
| } | |
| # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | |
| PROG_NAME="$(follow_links "$BASH_SOURCE")" | |
| # Handle the case where dart-sdk/bin has been symlinked to. | |
| CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | |
| UNAME="$(uname)" | |
| BITS="32" | |
| EXT="" | |
| # REDTAMARIN_SDK env var not found | |
| if [ -z "$REDTAMARIN_SDK" ]; then | |
| REDTAMARIN_SDK="$(dirname "$CUR_DIR")"; | |
| fi | |
| if [ $UNAME == "Darwin" ]; then | |
| OS="macintosh"; | |
| elif [ $UNAME == "Linux" ]; then | |
| OS="linux" | |
| elif [ "$(uname -o)" == "Cygwin" ]; then | |
| #elif [ "$(uname -s)" == CYGWIN* ]; then | |
| OS="windows" | |
| EXT=".exe" | |
| fi | |
| if [ "$(uname -m)" == "x86_64" ]; then | |
| BITS="64" | |
| fi | |
| BIN="$CUR_DIR/redbean-$OS$EXT" | |
| echo "PROG_NAME=$PROG_NAME"; | |
| echo "CUR_DIR=$CUR_DIR"; | |
| echo "REDTAMARIN_SDK=$REDTAMARIN_SDK"; | |
| echo "OS=$OS"; | |
| echo "BITS=$BITS" | |
| echo "BIN=$BIN"; | |
| exec "$BIN" -- "$@"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment