Matthew_Cline

Crea Linux wrapper script

Aug 2nd, 2019
103
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  4. command="Crea"
  5. export LD_LIBRARY_PATH="$root/lib:$LD_LIBRARY_PATH"
  6.  
  7. VERSION=8
  8. CURRENT_VERSION=0
  9. if [[ -f "$root/lib/version" ]]
  10.    then
  11.        read -r CURRENT_VERSION<"$root/lib/version"
  12. fi
  13.  
  14. if [[ $CURRENT_VERSION != $VERSION ]]
  15.    then
  16.    find "$root/lib/" -type l | xargs rm
  17.    echo $VERSION > "$root/lib/version"
  18. fi
  19.  
  20. if [[ ! -f "$root/lib/libsfml-system.so" ]]; then
  21.    pushd $root/lib > /dev/null
  22.  
  23.    # Start over with the symbolic links
  24.    rm -f $(find . -type l)
  25.  
  26.    # For each libfoobar.so.x.y.z, provide libfoobar.so.x.y, libfoobar.so.x,
  27.    # and libfoobar.so
  28.    for file in $(find . -type f -name '*.so.*'); do
  29.        while true; do
  30.            chomped=$(echo $file | sed -e 's/\.[^.]*$//')
  31.            ln -s $file $chomped
  32.            if [[ $chomped =~ \.so$ ]]; then
  33.                break
  34.            fi
  35.            file="$chomped"
  36.        done
  37.    done
  38.  
  39.    popd > /dev/null
  40. fi
  41.  
  42. exec "$root/bin/Crea" "$@"
RAW Paste Data