Given it took me a good few hours to figure this out I feel its worth posting up in-case any of you (or anyone you know) are having the same problems:
In order to use custom maps on a linux server they MUST have all their filenames in lower case. Okay this isn't entirely true - the top level directory appears to be fine in upper case but lets keep everything lower case anyway (its cleaner that way). If this isn't the case then those wonderful coders at EA have made it so that BF2 fails to recognise that the map is installed.
To help us solve this tricky little problem EA have kindly provided a python script to convert the case of file and directories to lower case ... except it doesn't work and just throws a lot of errors - nice to see they check these things
So whats a poor guy to do to get his maps running on a linux box ?
Simple, run the two simple bash scripts provided below and all will be well:
Copy and paste both bits of code into files in the bf2 levels directory and run them from there (make sure to chmod +x <filename>) where filename is where you saved the code!
./maplist_generator.sh > ../settings/maplist.con
Finally go into ../settings/maplist.con and uncomment any maps that you want to run.
I hope this helps save someone a little time.
In order to use custom maps on a linux server they MUST have all their filenames in lower case. Okay this isn't entirely true - the top level directory appears to be fine in upper case but lets keep everything lower case anyway (its cleaner that way). If this isn't the case then those wonderful coders at EA have made it so that BF2 fails to recognise that the map is installed.
To help us solve this tricky little problem EA have kindly provided a python script to convert the case of file and directories to lower case ... except it doesn't work and just throws a lot of errors - nice to see they check these things
So whats a poor guy to do to get his maps running on a linux box ?
Simple, run the two simple bash scripts provided below and all will be well:
Copy and paste both bits of code into files in the bf2 levels directory and run them from there (make sure to chmod +x <filename>) where filename is where you saved the code!
The first script above simply parses all the files in the current directory to lower case ... and unlike the EA script it works *sticks tongue out at EA*. For the record I call this script case_changer.sh#!/bin/bash
#change all files to lower case so they work with linux:
#dump full paths of all files in subdirectories to an array:
array=( ` find . -name "*" ` )
#parse array:
for file in ${array[@]};
do
newFile=`echo "${file}"|perl -ne 'chomp;print "$_" if (tr/A-Z/a-z/);'`
#only change the files that actually need changing:
if [ ! $newFile = "" ]; then
mv "${file}" "${newFile}"
fi
done
The second file generates a maplist for you from the renamed files. Make sure to pipe the output of this to your maplist location i.e. I call this script maplist_generator.sh so I would run:#!/bin/bash
#maplist generator (ignore our script files ending in *.sh):
for file in $( ls ); do
if ! grep -q ".sh$" $file ; then
echo "//mapList.append $file gpm_cq 32"
fi
done
./maplist_generator.sh > ../settings/maplist.con
Finally go into ../settings/maplist.con and uncomment any maps that you want to run.
I hope this helps save someone a little time.