blob: fda1e16e922cc69c70f651d195fe2036128b87aa (
plain)
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
|
#!/usr/bin/env sh
# vim: syntax=sh
if [ -n "${SH_TRACE}" ]; then
# shellcheck disable=2016
PS4="$(printf '%b%s%b:\n' '\033[31m' 'L${LINENO}' '\033[0m')"
export PS4
set -x
fi
readonly appName='notepadpp'
readonly exeName='notepad++.exe'
readonly pkgDir="/usr/share/${appName}"
readonly localDir="${HOME}/.local/share/${appName}"
readonly configDir="${HOME}/.config/${appName}"
readonly cacheDir="${HOME}/.cache/${appName}"
# shellcheck disable=2155
readonly uid="$(id -u)"
# shellcheck disable=2155
readonly gid="$(id -g)"
cleanup() {
while umount "${localDir}" 2>&1 | grep -q 'busy\.$' ; do
sleep 2
done
}
# Create necessary directories
for appDir in "${localDir}" "${cacheDir}" "${configDir}"; do
if [ ! -d "${appDir}" ]; then
mkdir -p "${appDir}"
fi
done
# Unmount fuse-overlayfs just in case
if mount | grep -q "${localDir}"; then
cleanup
fi
# Mount the necessary directories with id mapping
if ! fuse-overlayfs -o squash_to_uid="${uid}" -o squash_to_gid="${gid}" \
-o lowerdir="${pkgDir}" -o upperdir="${configDir}" -o workdir="${cacheDir}" \
"${localDir}"; then
print 'Mount failed: cannot mount fuse-overlayfs\n' >&2
exit 1
fi
trap 'cleanup' INT TERM EXIT
# Use default WINEPREFIX - usually ~/.wine
unset WINEPREFIX
# Don't prompt to wine-mono and wine-gecko install - neither is needed
WINEDLLOVERRIDES="${WINEDLLOVERRIDES};mscoree=d;mshtml=d"
# If WINEDEBUG is explicitly set as env var use it
if [ -z "${WINEDEBUG}" ]; then
WINEDEBUG=-all
fi
export WINEPREFIX WINEDLLOVERRIDES WINEDEBUG
wine "${localDir}/${exeName}" "${@}"
|