-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAppRun
executable file
·209 lines (178 loc) · 6.7 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash -e
HERE="$(dirname "$(readlink -f "${0}")")"
F11_APPIMAGE_TMP_DIR="${HERE}_tmp"
F11_APPIMAGE_CONF_DIR="${HOME}/.config/f11conf"
F11_APPIMAGE_VKCONF="${F11_APPIMAGE_CONF_DIR}/vulkan.conf"
#===================================================================
make_dir() { [ ! -d "${1}" ] && mkdir -p "${1}"; };
function cleanup {
# clean tmp files:
rm -rf "${F11_APPIMAGE_TMP_DIR}"
}
#------------------------------
# Configure AppImage:
if [ "${1}" = "f11conf" ] ; then
echo "Init Configuration:"
make_dir "${F11_APPIMAGE_CONF_DIR}"
#like: wine.appimage f11conf vulkan radeon:intel
if [ "${2}" = "vulkan" ] ; then
cat > "${F11_APPIMAGE_VKCONF}" << EOF
F11_VULKAN="${3}"
EOF
cat "${F11_APPIMAGE_VKCONF}"
fi
echo "Configuration done! "
exit 0
fi
# Create a tmp dir to some utils like vulkan (need one new, so remove the old):
if [ -d "${F11_APPIMAGE_TMP_DIR}" ]; then
rm -rf "${F11_APPIMAGE_TMP_DIR}"
fi
mkdir "${F11_APPIMAGE_TMP_DIR}"
trap cleanup EXIT
#===================================================================
# If not extract and overwrite, ${HERE}/lib is a link to ${HERE}/usr/lib, that link to ${HERE}/usr/lib64
export LD_LIBRARY_PATH="${HERE}/usr/lib:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="${HERE}/usr/lib32:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="${HERE}/lib:${LD_LIBRARY_PATH}"
export PATH="${HERE}/bin:${HERE}/usr/bin:${PATH}"
#----------------------------------------
#Sound Library
export LD_LIBRARY_PATH="${HERE}/usr/lib32/pulseaudio:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="${HERE}/usr/lib32/alsa-lib:${LD_LIBRARY_PATH}"
export LADSPA_PATH="${HERE}/usr/lib32/ladspa:${LADSPA_PATH}"
export AO_PLUGIN_PATH="${HERE}/usr/lib32/ao/plugins-4:${AO_PLUGIN_PATH}"
# For mpg123
export LD_LIBRARY_PATH="${HERE}/usr/lib32/mpg123:${LD_LIBRARY_PATH}"
# for libomxil-bellagio
export BELLAGIO_SEARCH_PATH="${HERE}/usr/lib32/bellagio:${HERE}/usr/lib32/omxloaders:${HERE}/usr/lib32"
# libGL drivers
export LIBGL_DRIVERS_PATH="${HERE}/usr/lib32/dri:${LIBGL_DRIVERS_PATH}"
# Gallium Nine
export D3D_MODULE_PATH="${HERE}/usr/lib32/d3d:${D3D_MODULE_PATH}"
#Font Config
export FONTCONFIG_PATH="${HERE}/etc/fonts:${FONTCONFIG_PATH}"
#LD
export MAIN32LDLIBRARY="${HERE}/usr/lib32/ld-linux.so.2"
#For webcam V4L (but only for v4l1, not for v4l2)
#export V4LCLDLIBRARY="${HERE}/usr/lib32/libv4l/v4l1compat.so"
#----------------------------------------
# GTK 3.0
export GTK_PATH="${HERE}/usr/lib32/gtk-3.0"
#------------------------------
# GStreamer environment variables
export GST_REGISTRY_REUSE_PLUGIN_SCANNER="no"
export GST_PLUGIN_SYSTEM_PATH_1_0="${HERE}/usr/lib32/gstreamer-1.0/"
export GST_PLUGIN_SCANNER_1_0="${HERE}/usr/lib32/gstreamer-1.0/gst-plugin-scanner"
export GST_PTP_HELPER_1_0="${HERE}/usr/lib32/gstreamer-1.0/gst-ptp-helper"
export GST_PLUGIN_PATH="${GST_PLUGIN_SYSTEM_PATH_1_0}"
export GST_PLUGIN_SYSTEM_PATH="${GST_PLUGIN_SYSTEM_PATH_1_0}"
export GST_PLUGIN_SCANNER="${GST_PLUGIN_SCANNER_1_0}"
#===================================================================
# Gdk Pixbuf
export GDK_PIXBUF_MODULE_FILE="${F11_APPIMAGE_TMP_DIR}/gdk_pixbuf_loaders.cache"
export GDK_PIXBUF_MODULEDIR="${HERE}/usr/lib32/gdk-pixbuf-2.0/2.10.0/loaders"
if [ -d "${F11_APPIMAGE_TMP_DIR}" ]; then
"${MAIN32LDLIBRARY}" "${HERE}/usr/bin/gdk-pixbuf-query-loaders-32" --update-cache
fi
#===================================================================
# For Vulkan drivers:
# Setting VK_ICD_FILENAMES... But the user can use his own variable for local drivers
if [ -n "${VK_ICD_FILENAMES}" ] && [ -d "${F11_APPIMAGE_TMP_DIR}" ]
then
echo "Using user VK_ICD_FILENAMES: ${VK_ICD_FILENAMES}"
elif [ -f "${F11_APPIMAGE_VKCONF}" ]; then
# shellcheck source=/dev/null
. "${F11_APPIMAGE_VKCONF}"
IFS_TMP="${IFS}"
IFS=:
for driver in ${F11_VULKAN}; do
#echo "${driver}"
if [ "${driver}" = "intel" ]; then
export VK_ICD_FILENAMES="${VK_ICD_FILENAMES}:${F11_APPIMAGE_TMP_DIR}/intel_icd.i686.json"
cat > "${F11_APPIMAGE_TMP_DIR}/intel_icd.i686.json" << EOF
{
"ICD": {
"api_version": "1.2.131",
"library_path": "${HERE}/usr/lib32/libvulkan_intel.so"
},
"file_format_version": "1.0.0"
}
EOF
elif [ "${driver}" = "radeon" ]; then
export VK_ICD_FILENAMES="${VK_ICD_FILENAMES}:${F11_APPIMAGE_TMP_DIR}/radeon_icd.i686.json"
cat > "${F11_APPIMAGE_TMP_DIR}/radeon_icd.i686.json" << EOF
{
"ICD": {
"api_version": "1.2.131",
"library_path": "${HERE}/usr/lib32/libvulkan_radeon.so"
},
"file_format_version": "1.0.0"
}
EOF
else
echo "ERROR: Driver \"${driver}\" unsupported yet!!!"
fi
done
IFS="${IFS_TMP}"
fi
#===================================================================
##Wine ENVs (see: https://wiki.winehq.org/Wine-Staging_Environment_Variables)
# arch and bottle first:
export WINEARCH=win32
if [ -z "${WINEPREFIX}" ]
then
export WINEPREFIX="${HOME}/.wine32"
fi
#export WINEVERPATH="${WINEVERPATH:-"${HERE}"}"
export WINEVERPATH="${HERE}"
export WINESERVER="${HERE}/bin/wineserver"
export WINELOADER="${HERE}/bin/wine"
export WINEPATH="${HERE}/bin:${HERE}/lib/wine:${WINEPATH}"
export WINEDLLPATH="${HERE}/lib/wine/fakedlls:${WINEDLLPATH}"
#export WINEDEBUG="${WINEDEBUG:-"-all"}"
#export WINEDEBUG=fixme-all
#export WINEDLLOVERRIDES="${WINEDLLOVERRIDES:-"mscoree,mshtml="}"
#export WINEESYNC=0
#export WINEESYNC="${WINEESYNC:-"1"}"
export LD_LIBRARY_PATH="${HERE}/lib/wine:${LD_LIBRARY_PATH}"
export WINELDLIBRARY="${MAIN32LDLIBRARY}"
#----------------------------------------
# Load winecfg if no arguments given
APPLICATION=""
if [ -z "${*}" ] ; then
APPLICATION="winecfg"
fi
# Allow the AppImage to be symlinked to e.g., /usr/bin/wineserver
if [ -n "${APPIMAGE}" ] ; then
BINARY_NAME="$(basename "${ARGV0}")"
else
BINARY_NAME="$(basename "${0}")"
fi
# change some scripts to exe executables
if [[ "${1}" =~ ^(winecfg|wineboot|regedit|regsvr32|msiexec|msidb|notepad|winefile|winemine)$ ]]; then
args=( "${@}" )
args[0]="${1}.exe"
set "${args[@]}"
fi
if [ -n "${1}" ] && [ -x "${HERE}/bin/${1}" ] ; then
MAIN="${HERE}/bin/${1}" ; shift
elif [ -n "${1}" ] && [ -x "${HERE}/usr/bin/${1}" ] ; then
MAIN="${HERE}/usr/bin/${1}" ; shift
elif [ -x "${HERE}/bin/${BINARY_NAME}" ] ; then
MAIN="${HERE}/bin/${BINARY_NAME}"
elif [ -x "${HERE}/usr/bin/${BINARY_NAME}" ] ; then
MAIN="${HERE}/usr/bin/${BINARY_NAME}"
else
MAIN="${HERE}/bin/wine"
fi
# Exec outside apps with inside environment (make the link name "ExternalExec")
if [ "${BINARY_NAME}" = "ExternalExec" ] && [ -n "${1}" ] && [ -x "${1}" ]; then
MAIN="${1}" ; shift
fi
#===================================================================
if [ -z "${APPLICATION}" ] ; then
LD_PRELOAD="${HERE}/bin/libhookexecv.so" "${WINELDLIBRARY}" "${MAIN}" "${@}" | cat
else
LD_PRELOAD="${HERE}/bin/libhookexecv.so" "${WINELDLIBRARY}" "${MAIN}" "${APPLICATION}" | cat
fi