]> granicus.if.org Git - imagemagick/blob - AppRun
https://github.com/ImageMagick/ImageMagick/issues/1757
[imagemagick] / AppRun
1 #!/bin/bash
2
3 # The purpose of this custom AppRun script is
4 # to allow symlinking the AppImage and invoking
5 # the corresponding binary depending on which
6 # symlink was used to invoke the AppImage
7
8 HERE="$(dirname "$(readlink -f "${0}")")"
9
10 export MAGICK_HOME="$HERE/usr:$MAGICK_HOME" # https://imagemagick.org/QuickStart.txt
11 export MAGICK_CONFIGURE_PATH=$(readlink -f "$HERE/usr/lib/ImageMagick-7.0.7/config-Q16"):$(readlink -f "$HERE/usr/lib/ImageMagick-7.0.7/config-Q16HDRI"):$(readlink -f "$HERE/usr/share/ImageMagick-7"):$(readlink -f "$HERE/usr/etc/ImageMagick-7"):$MAGICK_CONFIGURE_PATH #Wildcards don't work
12
13 export LD_LIBRARY_PATH=$(readlink -f "$HERE/usr/lib"):$LD_LIBRARY_PATH
14 export LD_LIBRARY_PATH=${HERE}/usr/lib/ImageMagick-7.0.7/modules-Q16HDRI/coders:$LD_LIBRARY_PATH
15
16 if [ "$1" == "man" ] ; then
17   export MANPATH="$HERE/usr/share/man:$MANPATH" ; exec "$@" ; exit $?
18 elif [ "$1" == "info" ] ; then
19   export INFOPATH="$HERE/usr/share/info:$INFOPATH" ; exec "$@" ; exit $?
20 fi
21
22 if [ ! -z $APPIMAGE ] ; then
23   BINARY_NAME=$(basename "$ARGV0")
24   if [ -e "$HERE/usr/bin/$BINARY_NAME" ] ; then
25     exec "$HERE/usr/bin/$BINARY_NAME" "$@"
26   else
27     exec "$HERE/usr/bin/magick" "$@"
28   fi
29 else
30   exec "$HERE/usr/bin/magick" "$@"
31 fi