-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAppRun
executable file
·69 lines (55 loc) · 2.24 KB
/
AppRun
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
#!/bin/bash
# Store the outer environment in a file, with variables, separated
# by null bytes to avoid issues with newlines inside definitions.
MYPAINT_ENV_CLEAN=$(mktemp)
echo "writing appimage env to $MYPAINT_ENV_CLEAN"
env --null > "$MYPAINT_ENV_CLEAN"
export MYPAINT_ENV_CLEAN
DIR="$(readlink -f "$(dirname "$0")")"
echo "DIR: $DIR"
# The name of this variable is significant - it is used by the patched
# mypaint startup script to strip out non-appimage module search paths.
export APPDIR=$DIR
# Set up environment
export PYTHONHOME=$DIR/usr/
export PATH="$APPDIR/usr/bin:${PATH}:/sbin:/usr/sbin"
export LD_LIBRARY_PATH="$APPDIR/usr/lib:/usr/lib:$LD_LIBRARY_PATH"
export GCONV_PATH="${APPDIR}/usr/lib/gconv"
# Prevent gio modules being loaded from the host system
export GIO_MODULE_DIR=$DIR
# Set up gdkpixbuf vars
export GDK_PIXBUF_MODULEDIR="${APPDIR}/usr/lib/gdk-pixbuf-2.0/loaders"
export GDK_PIXBUF_MODULE_FILE="${APPDIR}/usr/lib/gdk-pixbuf-2.0/loaders.cache"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GDK_PIXBUF_MODULEDIR"
# Set up user data locations and GObject introspection
export XDG_DATA_DIRS=$DIR/usr/share:$XDG_DATA_DIRS:/usr/local/share:/usr/share
export GI_TYPELIB_PATH=$DIR/usr/lib/girepository-1.0
if [ -e /etc/fonts/fonts.conf ]; then
export FONTCONFIG_PATH=/etc/fonts
fi
# Set Adwaita theme explicitly, but allow it to be overridden
# by setting GTK_THEME when starting the appimage, in which
# case it is up to the user to set light or dark themes directly.
#
# Setting the theme explicitly avoids css-compatibility
# problems with older gtk3 versions on the host systems.
if [ -z "$GTK_THEME" ]; then
echo "No explicit user theme set"
# Helper returns 0 for dark theme, 1 for ordinary theme.
# Set the path to let it find the required mypaint libs.
PP="$APPDIR/usr/lib/mypaint/:$PYTHONPATH"
if PYTHONPATH="$PP" python "$APPDIR/gtk-theme-helper.py" "$@"; then
export GTK_THEME="Adwaita:dark"
else
export GTK_THEME="Adwaita"
fi
else
echo "GTK_THEME already set explicitly, we respect that."
fi
# Set GTK_LOCALEDIR so our patched version of libgtk can
# pick up the bundled .mo files
export GTK_LOCALEDIR=$APPDIR/usr/share/locale
python "$DIR/usr/bin/mypaint" "$@"
EXIT_CODE=$?
rm -r "$MYPAINT_ENV_CLEAN"
exit $EXIT_CODE