]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - setup/linux/setup_image/setup.data/config.games.sh
ok
[xonotic/netradiant.git] / setup / linux / setup_image / setup.data / config.games.sh
1 #!/bin/sh
2 #
3 # Script for generating .game files
4
5 # generate game support files
6 # Expects params (game, game path_prefix)
7
8 exec >/dev/tty
9
10   if [ $# -lt 2 ] ; then
11     echo "Incorrect number of params to GenGameFiles";
12     return;
13   fi
14
15   # NOTE: the naming of the vars here doesn't follow attributes names in XML, it can be confusing
16   game=$1;
17   INPUT_FILE="games/$game.game";
18   game_engine=`grep "enginepath_linux=" $INPUT_FILE | awk -F"\"" '{print $2 }'`
19   game_engine_path=$SETUP_COMPONENT_PATH;
20   game_tools=$2;
21   OUT_FILE="$game_tools/games/$game.game";
22
23   echo -e "Generating game file '$OUT_FILE' from '$INPUT_FILE' with the following values...";
24   echo -e "\tGame        :\t $game";
25   echo -e "\tGame Engine :\t $game_engine_path/$game_engine";
26   echo -e "\tGame Tools  :\t $game_tools";
27
28   if [ -f "$OUT_FILE" ] ; then
29     rm -f $OUT_FILE;
30   fi
31   
32   if [ ! -d "$game_tools/games" ] ; then
33     mkdir "$game_tools/games";
34   fi
35   
36 sed -e 's!enginepath_linux=\".*.\"!enginepath_linux=\"'$game_engine_path'\"\n  gametools=\"'$game_tools/$game'\"!g' <$INPUT_FILE >$OUT_FILE
37
38 exit 0;