blob: 1c08f9875c88850a8adec9b9d885d21f20f59152 (
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
|
#!/bin/sh
set -eu ${TRACE+-x}
PREFIX=/usr/share/dogelog
guess_backend() {
if [ -f "$PREFIX/dogelog.mjs" ]; then
if command -v node >/dev/null 2>&1; then
echo node; return
elif command -v bun >/dev/null 2>&1; then
echo bun; return
fi
fi
if [ -f "$PREFIX/dogelog.py" ]; then
if command -v pypy3 >/dev/null 2>&1; then
echo pypy3; return
elif command -v python3 >/dev/null 2>&1; then
echo python3
fi
fi
if [ -f "$PREFIX/dogelog.zip" ]; then
if command -v java >/dev/null 2>&1; then
echo java; return
fi
fi
echo Please install dogelog >&2
return 1
}
# If backend isn't specified try to guess it, based on what's installed
if [ "${DOGELOG_BACKEND-}" = '' ]; then
DOGELOG_BACKEND="$(guess_backend)"
fi
# Select command line appropriate to the backend
case "${DOGELOG_BACKEND}" in
node*)
CMDLINE="node $PREFIX/dogelog.mjs" ;;
bun*)
CMDLINE="bun $PREFIX/dogelog.mjs" ;;
python*)
CMDLINE="python3 $PREFIX/dogelog.py" ;;
pypy*)
CMDLINE="pypy3 $PREFIX/dogelog.py" ;;
java*)
CMDLINE="java -cp $PREFIX/dogelog.zip:playerj/canned Index"
;;
*)
cat <<-EOT >&2
DOGELOG_BACKEND must be undefined or be one of: node, bun, python, pypy or java
Current value is: $DOGELOG_BACKEND
EOT
exit 1 ;;
esac
if command -v rlwrap >/dev/null 2>&1; then
CMDLINE="rlwrap $CMDLINE"
fi
exec $CMDLINE "$@"
|