SHARE
TWEET

cataclysm starter

a guest Mar 5th, 2014 301 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. TARGET_FILE=$0
  3.  
  4. cd `dirname $TARGET_FILE`
  5. TARGET_FILE=`basename $TARGET_FILE`
  6.  
  7. # Iterate down a (possible) chain of symlinks
  8. while [ -L "$TARGET_FILE" ]
  9. do
  10.     TARGET_FILE=`readlink $TARGET_FILE`
  11.     cd `dirname $TARGET_FILE`
  12.     TARGET_FILE=`basename $TARGET_FILE`
  13. done
  14.  
  15. # Compute the canonicalized name by finding the physical path
  16. # for the directory we're in and appending the target file.
  17. PHYS_DIR=`pwd -P`
  18. RESULT=$PHYS_DIR/$TARGET_FILE
  19. echo $RESULT
  20.  
  21. DIR=$(dirname $RESULT)
  22. BIN=$(basename $RESULT)
  23.  
  24. cd "$DIR" || exit $?
  25.  
  26. # If name does not match a binary or is this same script, find the right one
  27. if [ ! -f "$BIN" ] || [ "$BIN" = "$(basename $RESULT)" ]
  28. then
  29.     BIN=
  30.     for bin in cataclysm-tiles cataclysm
  31.     do
  32.         [ -f "$bin" ] && BIN="$bin" && break
  33.     done
  34. fi
  35.  
  36. if [ "$BIN" ]
  37. then
  38.     exec "./$BIN"
  39. else
  40.     echo "Couldn't find cataclysm game binary in $DIR/"
  41.     exit 1
  42. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top