This file is indexed.

/usr/games/doomsday-compat is in doomsday 1.15.8-5build1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/bin/sh

# doomsday-compat: This script translates between the "-iwad" parameter
# as expected by vanilla Doom and the one expected by the Doomsday Engine:
# - Vanilla Doom expects the -iwad parameter to give an IWAD file.
# - Doomsday expects the -iwad parameter to give a directory containing
#   IWAD files and loads one depending on the additional -game parameter.

# Copyright © 2013-2015 Fabian Greffrath <fabian@debian.org>
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>

# On Debian systems, the complete text of the GNU General
# Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

DOOMSDAY="doomsday"

next_is_iwad=0
next_is_pwad=0

iwaddir="$(awk '/^iwaddir/{print $2}' /etc/doomsday/paths)"
gamemode="doom2"

for arg in "$@"
do
	if [ $arg = "-iwad" ]
	then
		next_is_iwad=1
		continue
	fi

	if [ $arg = "-file" ]
	then
		next_is_pwad=1
		continue
	fi

	if [ $next_is_iwad = 1 ]
	then
		next_is_iwad=0
		iwadpath=$arg
		iwadfile=$(basename $arg)
		iwaddir=$(dirname $arg)
		continue
	fi

	if [ $next_is_pwad = 1 ]
	then
		next_is_pwad=0
		pwadpath=$arg
		pwadfile=$(basename $arg)
		if [ ! -f $pwadpath -a -f $iwaddir/$pwadpath ]
		then
			pwadpath=$iwaddir/$pwadpath
		fi
		continue
	fi

	cmdline="$cmdline $arg"
done

# if no -iwad parameter is given, guess from executable name
if [ -z "$iwadfile" ]
then
	case "$(basename $0)" in
		heretic)
			iwadfile=heretic.wad
			iwadpath=$iwaddir/$iwadfile
			;;
		hexen)
			iwadfile=hexen.wad
			iwadpath=$iwaddir/$iwadfile
			;;
	esac
fi

case "$(echo $iwadfile | tr '[:upper:]' '[:lower:]')" in
	doom1.wad)
		gamemode=doom1-share
		;;
	doomu.wad|doom.wad)
		case "$(md5sum $iwadpath | awk '{print $1}')" in
			1cd63c5ddff1bf8ce844237f580e9cf3)
				gamemode=doom1
				;;
			*)
				gamemode=doom1-ultimate
				;;
		esac
		;;
	doom2f.wad|doom2.wad)
		gamemode=doom2
		;;
	freedoomu.wad|freedoom1.wad)
		gamemode=freedoom1
		;;
	freedoom.wad|freedoom2.wad)
		gamemode=freedoom2
		;;
	freedm.wad)
		gamemode=freedm
		;;
	plutonia.wad)
		gamemode=doom2-plut
		;;
	tnt.wad)
		gamemode=doom2-tnt
		;;
	chex.wad)
		gamemode=chex
		;;
	hacx.wad)
		gamemode=hacx
		;;
	heretic1.wad)
		gamemode=heretic-share
		;;
	heretic.wad)
		case "$(md5sum $iwadpath | awk '{print $1}')" in
			3117e399cdb4298eaa3941625f4b2923|1e4cb4ef075ad344dd63971637307e04)
				gamemode=heretic
				;;
			*)
				gamemode=heretic-ext
				;;
		esac
		;;
	hexendemo.wad|machexendemo.wad|hexenbeta.wad|hexen.wad)
		case "$(md5sum $iwadpath | awk '{print $1}')" in
			876a5a44c7b68f04b3bb9bc7a5bd69d6)
				gamemode=hexen-demo
				;;
			*)
				gamemode=hexen
				;;
		esac
		;;
esac

case "$(echo $pwadfile | tr '[:upper:]' '[:lower:]')" in
	hexdd.wad)
		gamemode=hexen-dk
		;;
esac

# fall back to alternatives
if [ $gamemode = "doom2" \
     -a ! -f $iwaddir/doom2.wad \
     -a ! -f $iwaddir/doom2f.wad \
     -a -f $iwaddir/freedoom2.wad ]
then
	gamemode=freedoom2
elif [ \( $gamemode = "heretic" -o $gamemode = "heretic-ext" \) \
     -a ! -f $iwaddir/heretic.wad \
     -a -f $iwaddir/heretic1.wad ]
then
	gamemode=heretic-share
elif [ $gamemode = "hexen" \
     -a ! -f $iwaddir/hexen.wad \
     -a -f $iwaddir/hexendemo.wad ]
then
	gamemode=hexen-demo
fi

if [ -n "$pwadpath" ]
then
	cmdline="-file $pwadpath $cmdline"
fi

if [ -n "$iwaddir" -a -n "$gamemode" ]
then
	eval $DOOMSDAY -iwad $iwaddir -game $gamemode $cmdline
elif [ -n "$gamemode" ]
then
	eval $DOOMSDAY -game $gamemode $cmdline
else
	eval $DOOMSDAY "$@"
fi