blob: be7ed86edb6330a0103987ebcacab06834600700 (
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
64
65
66
67
68
69
70
71
|
#!/bin/bash
### Wrapper for the windows-software "Entfernungsrechner für Fahrvergünstigungen".
# This wrapper does start the software with 'wine' from the correct
# directory (where it can find it's data files), and does some
# command line argument reformatting so that filenames can be
# specified both absolutely and relatively to the directory the user
# starts this wrapper from.
#
# Also, it starts with a German locale, if available, in order to make
# diacritical characters display correctly.
#
# Content taken from idos-timetable-browser.sh from the Arch Linux AUR package
# 'idos-timetable-browser-latest'. See there if command line argument parsing
# and rebasing is needed here.
### Global variables:
# Where this wrapper is started from:
_cwd="$(pwd)"
# Where the software is installed:
_installdir="/opt/entfernungsrechner"
# What the executable of the software is:
_executable="${_installdir}/PFFEB.exe"
# Print some debug messages? Can be controlled via environment; if not
# specified in the environment, set it here:
if [ -z "${DEBUG}" ]; then
DEBUG="true"
fi
### Some helper functions
debug() {
case "${DEBUG}" in
"1"|[yY][eE][sS]|[tT][rR][uU][eE])
echo "DEBUG info: $@" > /dev/stderr
;;
esac
}
### Check for locale, and if present, set German locale:
if locale -a | grep -qE '^de_DE'; then
if locale -a | grep -qE '^de_DE' | grep -qi utf8; then
LC_CTYPE="$(locale -a | grep -E '^de_DE' | grep -i utf8 | head -n 1)"
else
LC_CTYPE="$(locale -a | grep -E '^de_DE' | tail -n 1)"
fi
export LC_CTYPE
fi
### Launch the software with the parsed and maybe reformatted arguments:
cd "${_installdir}"
debug '$LC_CTYPE is set to: '"'${LC_CTYPE}' (if it does not begin with 'de_DE', try to enable German locale on your system to display diacritical characters correctly)."
debug "We are running from the directory: '$(pwd)'."
debug "Executing the following command: 'wine ${_executable} $@'."
wine "${_executable}" "$@"
|