scripts/wrapper.in
author Titus von Boxberg <titus@v9g.de>
Wed May 19 18:08:23 2010 +0200 (2010-05-19)
changeset 1955 7d3e9e91dd9a
parent 1402 146c62142e1b
child 1960 8307ceabe5c0
permissions -rw-r--r--
build/internals.sh: Replace nonportable call to stat

The call to stat to find out if a file is a symlink works only on GNU systems,
and the replacing portable call to readlink is also shorter and more concise code.

yann.morin.1998@anciens.enib.fr:
Apply simpler test, after discussion with author and Arnaud LACOMBE on the ML.
     1 #!/bin/sh
     2 
     3 canonicalizedname=$(readlink -nm "${0}")
     4 dirname="$(dirname "${canonicalizedname}")"
     5 basename="$(basename "${canonicalizedname}")"
     6 
     7 ld_lib_path="$(dirname "${dirname}")/lib"
     8 
     9 case ":${LD_LIBRARY_PATH}:" in
    10     *":${ld_lib_path}:"*)   ;;
    11     *)  LD_LIBRARY_PATH="${ld_lib_path}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}";;
    12 esac
    13 
    14 export LD_LIBRARY_PATH
    15 exec "${dirname}/.${basename}" "$@"