File: quake.in

package info (click to toggle)
quake 8
  • links: PTS, VCS
  • area: contrib
  • in suites: jessie, jessie-kfreebsd
  • size: 928 kB
  • ctags: 5
  • sloc: sh: 510; makefile: 182
file content (71 lines) | stat: -rw-r--r-- 1,902 bytes parent folder | download
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/sh

# quake.sh - launcher script for quake 1

self="@self@"
role="@role@"
options="@options@"
data_location=/usr/share/games/quake
engine_path=/usr/lib/quake/@alternative@
no_data_title="Quake"
no_data_msg="Missing data; see /usr/share/doc/${self}/README.Debian"

main() {
    while [ $# -gt 0 ]; do
        case "$1" in
            -h|--help)
                show_help
                exit 2
                ;;
            -v|--version)
                show_version
                exit 2
                ;;
            --engine)
                engine_path="$2"
                shift
                ;;
            --engine=*)
                engine_path="$1"
                engine_path="${engine_path#--engine=}"
                ;;
            *)
                break
                ;;
        esac

        shift
    done

    if ! [ -f "${data_location}/id1/pak0.pak" ]; then
        if test "${role}" = server; then
            echo "$no_data_msg"
        else
            exec "$data_location"/need-data.sh "$no_data_title" "$no_data_msg"
        fi
    fi
    
    exec ${engine_path} -basedir ${data_location} ${options} "$@"
}

show_help() {
    echo "Usage: ${self} [-h|--help] [-v|--version] [ARG1] [ARG2] ..."
    echo "Launch Quake ${role}."
    echo
    echo "This script supports these options:"
    echo "  -h, --help       show this help information"
    echo "  -v, --version    show version information"
    echo "  --engine BINARY  use BINARY as the Quake engine, e.g."
    echo "                   quake --engine=/usr/games/darkplaces"
    echo
    echo "Any further arguments will be passed directly to the Quake engine."
}

show_version() {
    echo "Debian Quake 1 wrapper script"
    echo "Please consult your apt database for the version number of this script."
    echo "Looking for data at: '$data_location'"
    echo "Using engine: '$engine_path'"
}

main "$@"