This repository has been archived by the owner on Sep 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAppRun
executable file
·84 lines (73 loc) · 2.25 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
set -e
if [ -n "$DEBUG" ]; then
env
set -x
fi
THIS="$0"
if [ -z "$APPDIR" ]; then
# Find the AppDir. It is the directory that contains AppRun.
# This assumes that this script resides inside the AppDir or a subdirectory.
# If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR
path="$(dirname "$(readlink -f "${THIS}")")"
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
path=${path%/*}
done
export APPDIR="$path"
fi
path="$(dirname "$(readlink -f "${THIS}")")"
export APPDIR="$path"
echo "$APPDIR"
export PATH="${APPDIR}:${APPDIR}/usr/sbin:${PATH}"
export XDG_DATA_DIRS="./share/:/usr/share/gnome:/usr/local/share/:/usr/share/:${XDG_DATA_DIRS}"
export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}"
export XDG_DATA_DIRS="${APPDIR}"/usr/share/:"${XDG_DATA_DIRS}":/usr/share/gnome/:/usr/local/share/:/usr/share/
export GSETTINGS_SCHEMA_DIR="${APPDIR}/usr/share/glib-2.0/schemas:${GSETTINGS_SCHEMA_DIR}"
BIN="$APPDIR/pocketcasts-electron"
if [ -z "$APPIMAGE_EXIT_AFTER_INSTALL" ]; then
trap atexit EXIT
fi
atexit() {
if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
exec "$BIN" "--enable-features=UseOzonePlatform" "--ozone-platform=wayland"
else
exec "$BIN"
fi
}
error() {
if [ -x /usr/bin/zenity ]; then
LD_LIBRARY_PATH="" zenity --error --text "${1}" 2>/dev/null
elif [ -x /usr/bin/kdialog ]; then
LD_LIBRARY_PATH="" kdialog --msgbox "${1}" 2>/dev/null
elif [ -x /usr/bin/Xdialog ]; then
LD_LIBRARY_PATH="" Xdialog --msgbox "${1}" 2>/dev/null
else
echo "${1}"
fi
exit 1
}
yesno() {
TITLE=$1
TEXT=$2
if [ -x /usr/bin/zenity ]; then
LD_LIBRARY_PATH="" zenity --question --title="$TITLE" --text="$TEXT" 2>/dev/null || exit 0
elif [ -x /usr/bin/kdialog ]; then
LD_LIBRARY_PATH="" kdialog --title "$TITLE" --yesno "$TEXT" || exit 0
elif [ -x /usr/bin/Xdialog ]; then
LD_LIBRARY_PATH="" Xdialog --title "$TITLE" --clear --yesno "$TEXT" 10 80 || exit 0
else
echo "zenity, kdialog, Xdialog missing. Skipping ${THIS}."
exit 0
fi
}
check_dep() {
DEP=$1
if [ -z "$(which "$DEP")" ]; then
echo "$DEP is missing. Skipping ${THIS}."
exit 0
fi
}
if [ -z "$APPIMAGE" ]; then
APPIMAGE="$APPDIR/AppRun"
# not running from within an AppImage; hence using the AppRun for Exec=
fi