Thorsten Schöning wrote on Thu, Mar 18, 2021 at 14:27:30 +0100:
> #!/bin/bash
> 
> ##
> # Wrapper to make LD_LIBRARY_PATH easily available per invocation.
> #
> # This distribution of SVN is mostly self-contained, but it's own private 
> shared libs need to be made
> # available somehow. The easiest approach is to use the environment variable 
> LD_LIBRARY_PATH, so that
> # users don't need to care to much. Therefore this wrapper calculates the 
> necessary path on its own
> # and sets the environment variable accordingly.
> #
> # While users are only interested in the SVN-client most likely, the wrapper 
> is designed to calculate
> # the binary to forward all given arguments to based on the name of the 
> wrapper itself. So it can
> # simply be stored using the naming scheme "svn.sh", "svnadmin.sh" etc. using 
> symlinks and might be
> # used for other binaries as well this way.
> #
> # @param[in] ... All arguments are forwarded as-is to the binary of interest.
> #
> 
> APP_NAME=$(basename "$0" ".sh")
> APP_DIR=$( dirname  "$0")
> LIB_DIR=$( realpath "${APP_DIR}/../lib")
> 
> export LD_LIBRARY_PATH=${LIB_DIR}

Note that this discards any preëxisting value of $LD_LIBRARY_PATH.

(Also, might want to use #!/bin/sh.)

Cheers,

Daniel

> "${APP_DIR}/${APP_NAME}" "$@"

Reply via email to