BattleForge Forum

This is a community forum and not official technical support. — If you need official support: Contact Us

The following comments are owned by whoever posted them. We are not responsible for them in any way.

Back to Threads Reply to Thread

Patching script for BattleForge

Here is the script for patching BattleForge, described in the Topic "HowTo: Running BattleForge under Crossover Games"

#!/bin/bash
# Script do update BattleForge
# needs to be run in BattleForge directory

IFS="
"

updateversion="261135"

#try to automatically extract the new version
newversion=`cat log.txt | grep "Version Info" | cut -d" " -f5`
if [ -n "${newversion}" ]; then
  updateversion="${newversion}"
fi

#data=`cat bf_current.txt`
data="`curl http://na.llnet.battleforge.ea.com/u/f/eagames/battleforge/battleforge/retail/bfc/${updateversion}/bf_current.txt 2>/dev/null`"

if ( echo $data | grep -q "404 Not Found" ); then
  echo "Error: Could not download the update file list"
  exit 1
fi

mkdir -p tmp
pushd tmp 2>/dev/null

for fileline in $data; do
  url=`echo $fileline | awk -F";" '{print $5}'`
  file=`basename $url`
  filepath=`echo $fileline | awk -F";" '{print $1}'`
  newfile=`basename $filepath`
  md5sum=`echo $fileline | awk -F";" '{print $4}' | tr "[:lower:]" "[:upper:]"`

  #only download files with mismatching md5sum
  if [ "${md5sum}" == "`md5sum ../$filepath 2>/dev/null | cut -f1 -d' ' | tr '[:lower:]' '[:upper:]'`" ]; then
    #skip this file
    echo "file \"${newfile}\" is UpToDate, skipping..."
    continue
  fi

  wget $url
  cabextract $file

  if [ $? = 1 ]; then
    echo $file >> failed.txt
    failed = 1
  else rm $file
    mv $newfile ../$filepath
  fi
done

if [ "$filed" = "1" ]; then
  echo "FILES FAILED"
  cat failed.txt
fi

popd 2>/dev/null

they have moved the log.txt file to %My Documents%/BattleForge/Diag/bs_log.txt, meanig that you will have to change the line to:
newversion=`cat ~/Documents/BattleForge/Diag/bs_log.txt | grep "Version Info" | cut -d" " -f5`
note: you may have to change this to target your %My Documents% path, if you have changed it.

On another note, if you are on a Mac you will have to use md5 instead of md5sum. which means that you will have to change the line to the following:
if [ "${md5sum}" == "`md5 ../$filepath 2>/dev/null | cut -f4 -d' ' | tr '[:lower:]' '[:upper:]'`" ]; then

You will also have to get "wget", "cabextract" and other missing unix tools from MacPorts.

A year later, it doesn't work, but that's to be expected. The log is now in the game folder due to complaints, and the server location changed... ugh.

Confirming that its still not working. Tried to install it on windows and update it there, but it wo't run under cx.

They have changed the download txt files. I changed the script a bit and got it working.

Of course, I'm sharing:

#!/bin/bash
# Script do update BattleForge
# needs to be run in BattleForge directory

IFS="
"

updateversion="261135"

#try to automatically extract the new version
newversion=`cat ~/Documents/BattleForge/Diag/bs_log.txt | grep "Version Info" | cut -d" " -f5`
if [ -n "${newversion}" ]; then
updateversion="${newversion}"
fi

echo "Current version is ${updateversion}"

#data=`cat bf_current.txt`
data="`curl http://na.llnet.battleforge.ea.com/u/f/eagames/battleforge/battleforge/retail/bfc/${updateversion}/bf_current.txt 2>/dev/null`"

if ( echo $data | grep -q "404 Not Found" ); then
echo "Error: Could not download the update file list"
exit 1
fi

mkdir -p tmp
pushd tmp 2>/dev/null

for fileline in $data; do
url=`echo $fileline | awk -F";" '{print $5}'`
url="http://na.llnet.battleforge.ea.com/u/f/eagames/battleforge/battleforge/${url}"
file=`basename $url`
filepath=`echo $fileline | awk -F";" '{print $1}'`
newfile=`basename $filepath`
md5sum=`echo $fileline | awk -F";" '{print $4}' | tr "[:lower:]" "[:upper:]"`

#only download files with mismatching md5sum
if [ "${md5sum}" == "`md5 ../$filepath | cut -f 2- -d \= | tr -d ' ' | tr '[:lower:]' '[:upper:]'`" ]; then
#skip this file
echo "file \"${newfile}\" is UpToDate, skipping..."
continue
else
echo "Downloading file \"${newfile}\"..."
fi

wget $url
cabextract $file

if [ $? = 1 ]; then
echo $file >> failed.txt
failed = 1
else rm $file
mv $newfile ../$filepath
fi
done

if [ "$filed" = "1" ]; then
echo "FILES FAILED"
cat failed.txt
fi

popd 2>/dev/null

This is the MAC version of the script!
For Linux users:
Change the line
if [ "${md5sum}" == "`md5 ../$filepath 2>/dev/null | cut -f1 -d' ' | tr '[:lower:]' '[:upper:]'`" ]; then
to
if [ "${md5sum}" == "`md5sum ../$filepath 2>/dev/null | cut -f1 -d' ' | tr '[:lower:]' '[:upper:]'`" ]; then

where do you paste script? just in the bs_log.txt? if ur just suppose to paste it in there (i did) whats suppose to happen next?

CrossOver Forums: the place to discuss running Windows applications on Mac and Linux

CodeWeavers or its third-party tools process personal data (e.g. browsing data or IP addresses) and use cookies or other identifiers, which are necessary for its functioning and required to achieve the purposes illustrated in our Privacy Policy. You accept the use of cookies or other identifiers by clicking the Acknowledge button.
Please Wait...
eyJjb3VudHJ5IjoiVVMiLCJsYW5nIjoiZW4iLCJjYXJ0IjowLCJ0enMiOi02LCJjZG4iOiJodHRwczpcL1wvbWVkaWEuY29kZXdlYXZlcnMuY29tXC9wdWJcL2Nyb3Nzb3Zlclwvd2Vic2l0ZSIsImNkbnRzIjoxNzM2MzczNjgxLCJjc3JmX3Rva2VuIjoiUHl2THpicldBUW1KQUVWOCIsImdkcHIiOjB9