dist: Add a startup shell script and manpage

Pretty basic shell script for finding a port and launching it
automatically.  It's nothing overly fancy, but shell portability is
strived for, since it should be capable of launching no matter what
operating system is in use, it should not use anything more advanced
than is available in Bourn shell/POSIX (no ksh/bash extensions).
This commit is contained in:
Mike Swanson 2014-09-28 00:38:57 -07:00
parent f6f5ee8836
commit 581025694c
4 changed files with 109 additions and 0 deletions

3
dist/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.6
freedm.adoc
freedoom[12].adoc

7
dist/README vendored Normal file
View file

@ -0,0 +1,7 @@
This directory contains some files that should be useful for system
installations on Unix-like operating systems, including desktop
entries, AppData XML files, and a shell script to run Freedoom in a
simple manner.
Unless otherwise noted, these files should be considered public domain
material and not subject to the usual Freedoom license terms.

55
dist/freedoom vendored Executable file
View file

@ -0,0 +1,55 @@
#!/bin/sh -
# These ports should really be ordered by ease-of-use. Most likely
# advanced users with many ports installed will invoke their preferred
# one directly rather than depend on this script...
PORTS="odamex prboom-plus prboom eternity gzdoom zdoom chocolate-doom"
# Just a single argument starting the command is allowed, -p, in order
# to explicitly set a port on the command line. -- is also supported
# so that -p can be instead sent directly to the port's argument list.
if [ $# -gt 0 ]; then
if [ "$1" = "-p" ]; then
PORT="$2"
shift; shift
elif [ "$1" = "--" ]; then
shift
fi
fi
if [ "$(basename "$0")" = "freedm" ]; then
IWAD=freedm.wad
elif [ "$(basename "$0")" = "freedoom1" ]; then
IWAD=freedoom1.wad
elif [ "$(basename "$0")" = "freedoom2" ]; then
IWAD=freedoom2.wad
else
IWAD=freedoom2.wad
fi
if [ -z "$PORT" ] && [ -h "$HOME"/.doomport ]; then
if [ -f "$(readlink -f "$HOME"/.doomport)" ] \
&& [ -x "$(readlink -f "$HOME"/.doomport)" ]; then
PORT="$(readlink -f "$HOME"/.doomport)"
fi
fi
if [ "$PORT" ]; then
"$PORT" -iwad $IWAD "$@"
exit 0
fi
dirpath=$(eval echo "\${PATH}" 2>/dev/null | tr : ' ')
for port in $PORTS; do
for dir in $dirpath; do
for file in "$dir"/"$port"; do
if [ -f "$file" ] && [ -x "$file" ]; then
"$file" -iwad $IWAD "$@"
exit 0
fi
done
done
done

44
dist/freedoom.adoc vendored Normal file
View file

@ -0,0 +1,44 @@
freedoom(6)
===========
:doctype: manpage
NAME
----
freedoom - Automatically launch Freedoom with an engine
SYNOPSIS
--------
*freedoom* ['-p' 'PORT'|'--'] ['ARGS']
DESCRIPTION
-----------
Freedoom is a project to create a complete free-content game based on
the 'Doom' engine (often called ``source ports'' or simply ``ports''),
which itself is free software. In addition, it maintains
compatibility with 'Doom' itself and is capable of playing the wide
variety of modifications (``mods'') that have been released by an
active community since 1993.
This command is a simple shell script to assist in running Freedoom,
which is not a game engine itself nor part of any engine project, but
playing Freedoom should remain simple. Only accepted as the first
argument, you may pass '-p PORT', which will run Freedoom using the
'PORT' specified. As an alternative, you may make a symbolic link
named +$HOME/.doomport+ to your preferred port. A port specified on
the command line explicitly overrides +$HOME/.doomport+, whereas the
existence of the symbolic link will override the detection of port
based on a hard-coded list.
Additional arguments passed to the program, or after specifying '--'
as the first option, will be passed to the engine being called. This
can allow you to use options such as '-file' to load mods or anything
else available with the engine of choice.
COPYRIGHT
---------
Freedoom is licensed under a permissive three-clause BSD license. For
details, see the source tree or any +COPYING+/+COPYRIGHT+ file that
may have been installed by distribution packaging.
This manual page and the launcher script are both placed under the
public domain.