1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#!/bin/sh
#/***************************************************************************
# * The FreeMedForms project is a set of free, open source medical *
# * applications. *
# * (C) 2008-2013 by Eric MAEKER, MD (France) <eric.maeker@gmail.com> *
# * All rights reserved. *
# * License of this file: BSD-3 clause *
# ***************************************************************************/
#/***************************************************************************
# * Main developers : Eric MAEKER, <eric.maeker@gmail.com> *
# * Contributors: *
# * NAME <MAIL@ADDRESS.COM> *
# * NAME <MAIL@ADDRESS.COM> *
# ***************************************************************************/
#
#/***************************************************************************
# * This code was adapted from the QtCreator source *
# ***************************************************************************
# * The wrapper sets the LD_LIBRARY_PATH to the correct path when running *
# * linux-integrated release build on a linux system. *
# ***************************************************************************/
BINARY="freemedforms.bin"
PLUGINS_PATH="freemedforms"
APPLICATION_NAME="FreeMedForms"
# Check if the freemedforms binary is a linux-integrated & a release build
checkFreeMedFormsBuild()
{
if `/usr/bin/$BINARY -v` | grep -q "Release (Linux Integrated)"; then
echo "Found $APPLICATION_NAME binary"
else
echo "The installed $APPLICATION_NAME binary (in /usr/bin) is not a correct version. You cannot use this wrapper to run your version of $APPLICATION_NAME"
return 1;
fi
}
# If the binary is a link, follow it
makeAbsolute() {
case $1 in
/*)
# already absolute, return it
echo "$1"
;;
*)
# relative, prepend $2 made absolute
echo `makeAbsolute "$2" "$PWD"`/"$1" | sed 's,/\.$,,'
;;
esac
}
me=`which "$0"` # Search $PATH if necessary
if test -L "$me"; then
# Try readlink(1)
readlink=`type readlink 2>/dev/null` || readlink=
if test -n "$readlink"; then
# We have readlink(1), so we can use it. Assuming GNU readlink (for -f).
me=`readlink -nf "$me"`
else
# No readlink(1), so let's try ls -l
me=`ls -l "$me" | sed 's/^.*-> //'`
base=`dirname "$me"`
me=`makeAbsolute "$me" "$base"`
fi
fi
checkFreeMedFormsBuild
# Prepare paths
bindir=`dirname "$me"`
LIB_DIR="/usr/lib/freemedforms-common"
PLUG_DIR="/usr/lib/$PLUGINS_PATH"
# Define the LD_LIBRARY_PATH
LD_LIBRARY_PATH=$LIB_DIR:$PLUG_DIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
# Launch application
exec "/usr/bin/$BINARY" ${1+"$@"}
|