Blame env-builder-data/build/script/packet/synfigstudio-appimage.files/launch.sh

1d4d1c
#!/bin/bash
1d4d1c
1d4d1c
SCRIPT_DIR=$(cd `dirname "$0"`; pwd)
1d4d1c
BASE_DIR=`dirname "$SCRIPT_DIR"`
1d4d1c
ce4b23
# Check if this system have JACK installed
1bf3b3
if ! (which jackd &>/dev/null); then
ce4b23
	# No JACK, so disable this functionality.
ce4b23
	# (The bundled libjack won't work correctly anyway).
ce4b23
	export SYNFIG_DISABLE_JACK=1
1bf3b3
	export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${BASE_DIR}/lib.extra/jack"
ce4b23
fi
ce4b23
ce4b23
export USER_CONFIG_DIR=$HOME/.config/synfig
ce4b23
ce4b23
export LD_LIBRARY_PATH="${BASE_DIR}/lib:${BASE_DIR}/lib64:$LD_LIBRARY_PATH"
ce4b23
export XDG_DATA_DIRS="${BASE_DIR}/share:$XDG_DATA_DIRS:/usr/local/share/:/usr/share/"
ce4b23
export XDG_CONFIG_DIRS="$HOME/.config/synfig:$XDG_CONFIG_DIRS"
caca5f
export XCURSOR_PATH="${BASE_DIR}/share/icons:$XCURSOR_PATH:/usr/local/share/icons:/usr/share/icons"
ce4b23
export GSETTINGS_SCHEMA_DIR="${BASE_DIR}/share/glib-2.0/schemas/"
1d4d1c
export QT_XKB_CONFIG_ROOT=$QT_XKB_CONFIG_ROOT:/usr/local/share/X11/xkb:/usr/share/X11/xkb
e78b89
export FONTCONFIG_PATH=/etc/fonts
1d4d1c
ce4b23
export SYNFIG_ROOT="${BASE_DIR}"
ce4b23
export SYNFIG_GTK_THEME="Adwaita"
ce4b23
export SYNFIG_MODULE_LIST="${BASE_DIR}/etc/synfig_modules.cfg"
ce4b23
export MLT_DATA="${BASE_DIR}/share/mlt/"
ce4b23
export MLT_REPOSITORY="${BASE_DIR}/lib/mlt/"
b03c24
b03c24
MAGICK_DIR="$(cd .. && ls -1d "${BASE_DIR}/lib/ImageMagick-"*)"
b03c24
export MAGICK_CONFIGURE_PATH="${MAGICK_DIR}/config-Q16/"
b03c24
export MAGICK_CODER_MODULE_PATH="${MAGICK_DIR}/modules-Q16/coders/"
b03c24
export MAGICK_CODER_FILTER_PATH="${MAGICK_DIR}/modules-Q16/filters/"
ce4b23
ce4b23
# Create install-location-dependent config files for Pango and GDK image loaders
ce4b23
# We have to do this every time because its possible that SYSPREFIX has changed
ce4b23
ce4b23
[ -e "$USER_CONFIG_DIR" ] || mkdir -p "$USER_CONFIG_DIR"
ce4b23
ce4b23
#sed "s?@ROOTDIR@/modules?${BASE_DIR}/lib/pango/1.6.0/modules?" < $ETC_DIR/pango/pango.modules.in > $USER_CONFIG_DIR/pango/pango.modules
ce4b23
if [ -e ${BASE_DIR}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache.in ]; then
ce4b23
	export GDK_PIXBUF_MODULE_FILE="${USER_CONFIG_DIR}/gdk-pixbuf.loaders"
ce4b23
	sed "s?@ROOTDIR@/loaders?${BASE_DIR}/lib/gdk-pixbuf-2.0/2.10.0/loaders?" < ${BASE_DIR}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache.in > $GDK_PIXBUF_MODULE_FILE
ce4b23
fi
1d4d1c
290cd6
export APPIMAGE_ROOT="$BASE_DIR"
290cd6
if [ ! -z "$APPIMAGE_WORKDIR" ]; then
290cd6
	if ! cd "$APPIMAGE_WORKDIR"; then
290cd6
		echo "Cannot change directory to \"$APPIMAGE_WORKDIR\" (APPIMAGE_WORKDIR)"
290cd6
		exit 1
290cd6
	fi
290cd6
fi
290cd6
abfde6
if [ "$1" = "--appimage-exec" ]; then
abfde6
	if ! "${@:2}"; then
abfde6
		exit 1
abfde6
	fi
1d4d1c
elif [ -z "$2" ]; then
abfde6
	if ! "$BASE_DIR/bin/synfigstudio.wrapper" "$@"; then
abfde6
		exit 1
abfde6
	fi
1d4d1c
else
abfde6
	if ! "$BASE_DIR/bin/synfig" "$@"; then
abfde6
		exit 1
abfde6
	fi
1d4d1c
fi