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
|
#! /bin/sh
# @self@ - launcher script for Quake II @role@
self="@self@"
role="@role@"
options="@options@"
data_location=/usr/share/games/quake2
engine_path=/usr/lib/quake2/@alternative@
no_data_title="Quake II"
no_data_msg="Missing data; see /usr/share/doc/${self}/README.Debian"
use_data_location="$data_location"
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=}"
;;
--demo)
use_data_location="$data_location-demo"
;;
*)
break
;;
esac
shift
done
if ! [ -f "${use_data_location}/baseq2/pak0.pak" ]; then
# try to fall back to the demo data - might work?
use_data_location="$data_location-demo"
fi
if ! [ -f "${use_data_location}/baseq2/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} ${options} +set basedir "$use_data_location" "$@"
}
show_help() {
echo "Usage: ${self} [-h|--help] [-v|--version] [ARG1] [ARG2] ..."
echo "Launch Quake II ${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 II engine, e.g."
echo " quake2 --engine=/usr/lib/yagami-quake2/quake2"
echo " --demo use the demo data, even if the full game is"
echo " also installed"
echo
echo "Any further arguments will be passed directly to the engine."
}
show_version() {
echo "Debian Quake II 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 "$@"
|