From 581025694c1c263338fae98339c1e8b08e58bc44 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Sun, 28 Sep 2014 00:38:57 -0700 Subject: [PATCH] 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). --- dist/.gitignore | 3 +++ dist/README | 7 ++++++ dist/freedoom | 55 ++++++++++++++++++++++++++++++++++++++++++++++ dist/freedoom.adoc | 44 +++++++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 dist/.gitignore create mode 100644 dist/README create mode 100755 dist/freedoom create mode 100644 dist/freedoom.adoc diff --git a/dist/.gitignore b/dist/.gitignore new file mode 100644 index 00000000..40340965 --- /dev/null +++ b/dist/.gitignore @@ -0,0 +1,3 @@ +*.6 +freedm.adoc +freedoom[12].adoc diff --git a/dist/README b/dist/README new file mode 100644 index 00000000..4a9d7e5c --- /dev/null +++ b/dist/README @@ -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. diff --git a/dist/freedoom b/dist/freedoom new file mode 100755 index 00000000..0e956e84 --- /dev/null +++ b/dist/freedoom @@ -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 diff --git a/dist/freedoom.adoc b/dist/freedoom.adoc new file mode 100644 index 00000000..1fc8af7a --- /dev/null +++ b/dist/freedoom.adoc @@ -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.