diff --git a/docker-builder-data/build/script/packet/opentoonz-appimage.files/launch-opentoonz-appimage.sh b/docker-builder-data/build/script/packet/opentoonz-appimage.files/launch-opentoonz-appimage.sh new file mode 100755 index 0000000..e4d93b2 --- /dev/null +++ b/docker-builder-data/build/script/packet/opentoonz-appimage.files/launch-opentoonz-appimage.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +OLDDIR=`pwd` +cd `dirname "$0"` +SCRIPT_DIR=`pwd` +BASE_DIR=`dirname "$SCRIPT_DIR"` + +export LD_LIBRARY_PATH="$BASE_DIR/lib:$BASE_DIR/lib/opentoonz:$BASE_DIR/lib64:$LD_LIBRARY_PATH" +export QT_XKB_CONFIG_ROOT=$QT_XKB_CONFIG_ROOT:/usr/local/share/X11/xkb:/usr/share/X11/xkb + +if [ "$1" = "--appimage-exec" ]; then + if ! "${@:2}"; then + cd "$OLDDIR" + exit 1 + fi +else + if ! "./launch-opentoonz.sh.wrapper" "$@"; then + cd "$OLDDIR" + exit 1 + fi +fi +cd "$OLDDIR" diff --git a/docker-builder-data/build/script/packet/opentoonz-appimage.files/opentoonz.desktop b/docker-builder-data/build/script/packet/opentoonz-appimage.files/opentoonz.desktop index 2599544..cc37ef0 100644 --- a/docker-builder-data/build/script/packet/opentoonz-appimage.files/opentoonz.desktop +++ b/docker-builder-data/build/script/packet/opentoonz-appimage.files/opentoonz.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Type=Application Name=OpenToonz -Exec=launch-opentoonz.sh.wrapper +Exec=launch-opentoonz-appimage.sh Icon=opentoonz Categories=Graphics diff --git a/docker-builder-data/build/script/packet/opentoonz-appimage.sh b/docker-builder-data/build/script/packet/opentoonz-appimage.sh index 9bb4b72..dce0ae2 100644 --- a/docker-builder-data/build/script/packet/opentoonz-appimage.sh +++ b/docker-builder-data/build/script/packet/opentoonz-appimage.sh @@ -12,6 +12,7 @@ pkinstall() { mkdir -p "$APPDIR/usr/lib" cp --remove-destination "$ENVDEPS_PACKET_DIR/bin/AppRun" "$APPDIR/" || return 1 cp --remove-destination "$ENVDEPS_PACKET_DIR/bin/desktopintegration" "$APPDIR/usr/bin/launch-opentoonz.sh.wrapper" || return 1 + cp --remove-destination "$FILES_PACKET_DIR/launch-opentoonz-appimage.sh" "$APPDIR/usr/bin" || return 1 cp --remove-destination "$FILES_PACKET_DIR/opentoonz.desktop" "$APPDIR/" || return 1 cp --remove-destination "$FILES_PACKET_DIR/opentoonz.png" "$APPDIR/" || return 1 diff --git a/docker-builder-data/build/script/packet/opentoonz-master.files/launch-opentoonz.sh b/docker-builder-data/build/script/packet/opentoonz-master.files/launch-opentoonz.sh index d28148f..437b790 100755 --- a/docker-builder-data/build/script/packet/opentoonz-master.files/launch-opentoonz.sh +++ b/docker-builder-data/build/script/packet/opentoonz-master.files/launch-opentoonz.sh @@ -5,9 +5,12 @@ SCRIPT_DIR=$(cd `dirname "$0"`; pwd) cd "$OLDDIR" BASE_DIR=`dirname "$SCRIPT_DIR"` -export LD_LIBRARY_PATH="$BASE_DIR/lib:$BASE_DIR/lib64:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$BASE_DIR/lib:$BASE_DIR/lib/opentoonz:$BASE_DIR/lib64:$LD_LIBRARY_PATH" export QT_XKB_CONFIG_ROOT=$QT_XKB_CONFIG_ROOT:/usr/local/share/X11/xkb:/usr/share/X11/xkb cd "$BASE_DIR/bin" -./opentoonz "$@" +if ! ./opentoonz "$@"; then + cd "$OLDDIR" + exit 1 +fi cd "$OLDDIR" diff --git a/docker-builder-data/build/script/packet/synfigstudio-appimage.files/launch.sh b/docker-builder-data/build/script/packet/synfigstudio-appimage.files/launch.sh index 431760d..237da48 100755 --- a/docker-builder-data/build/script/packet/synfigstudio-appimage.files/launch.sh +++ b/docker-builder-data/build/script/packet/synfigstudio-appimage.files/launch.sh @@ -39,10 +39,21 @@ if [ -e ${BASE_DIR}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache.in ]; then 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 fi -if [ "$1" = "run" ]; then - "${@:2}" +cd "$BASE_DIR/bin" +if [ "$1" = "--appimage-exec" ]; then + if ! "${@:2}"; then + cd "$OLDDIR" + exit 1 + fi elif [ -z "$2" ]; then - "${BASE_DIR}/bin/synfigstudio.wrapper" "$@" + if ! "$BASE_DIR/bin/synfigstudio.wrapper" "$@"; then + cd "$OLDDIR" + exit 1 + fi else - "${BASE_DIR}/bin/synfig" "$@" + if ! "$BASE_DIR/bin/synfig" "$@"; then + cd "$OLDDIR" + exit 1 + fi fi +cd "$OLDDIR"