The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Ashley on March 19, 2012, 11:27:35 PM

Title: get_lang_files.sh with curl
Post by: Ashley on March 19, 2012, 11:27:35 PM
Since the Mac doesn't come with wget, but does come with curl, a version of this script which uses the latter.

#!/bin/sh
#
# script to fetch language files (using curl)
#
cd simutrans/text
# get the translations for basis
# The first file is longer, but only because it contains SQL error messages
# - discard it after complete download (although parsing it would give us the archive's name):

curl -d "version=0&choice=all&submit=Export%21" http://simutrans-germany.com/translator/script/main.php?page=wrap > /dev/null || {
  echo "Error: generating file language_pack-Base+texts.zip failed (curl returned $?)" >&2;
  exit 3;
}
curl http://simutrans-germany.com/translator/data/tab/language_pack-Base+texts.zip > language_pack-Base+texts.zip || {
  echo "Error: download of file language_pack-Base+texts.zip failed (curl returned $?)" >&2
  rm -f "language_pack-Base+texts.zip"
  exit 4
}
unzip -tv "language_pack-Base+texts.zip" || {
   echo "Error: file language_pack-Base+texts.zip seems to be defective" >&2
   rm -f "language_pack-Base+texts.zip"
   exit 5
}
unzip "language_pack-Base+texts.zip"
#rm language_pack-Base+texts.zip
# remove Chris English (may become british ... )
rm ce.tab
cd ../..
Title: Re: get_lang_files.sh with curl
Post by: prissi on March 20, 2012, 11:25:14 AM
mingw comes without curl but wget out of the box (as any GNU supported stuff). Either we need another switch or another script for macuser.
Title: Re: get_lang_files.sh with curl
Post by: Ashley on March 20, 2012, 11:32:14 PM
Well that's why I posted this script, for Mac users to use.
Title: Re: get_lang_files.sh with curl
Post by: Ashley on April 03, 2012, 06:05:08 PM
Here's a version which will use whichever is available on the system.
Title: Re: get_lang_files.sh with curl
Post by: prissi on April 03, 2012, 06:33:48 PM
Thanks Timothy for the best solution!