News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

get_lang_files.sh with curl

Started by Ashley, March 19, 2012, 11:27:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ashley

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 ../..

prissi

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.

Ashley

Well that's why I posted this script, for Mac users to use.

Ashley

Here's a version which will use whichever is available on the system.

prissi

Thanks Timothy for the best solution!