måndag 31 oktober 2011

I love Battle for Wesnoth ..

(This note is done in english as it concerns linux :)
I love playing Battle for Wesnoth, an Open Source strategy/RPG-game, but I hate having to click every frakking addon and waiting for the program to reset in between every install .. so here's a script that takes care of that.
Note that this was made for BfW1.8 under Ubuntu 11.04:
(Edit : I've removed the unpacking portion of this script as it doesn't seem to work)

  1. This script requires wget and Battle for Wesnoth 1.8. If you do not have them install them now.
  2. Open a terminal in the usual way or by pressing ctrl+alt+T
  3. Create a folder to hold your files by entering "mkdir BfWaddons"
  4. Enter the dir with "cd BfWaddons"
  5. Enter "gedit addons_18.txt" to create a textfile and add the URL http://addons.wesnoth.org/1.8/ to it. Save the file and exit.
  6. Enter "gedit get_addons_18.sh" to create the script-file and enter the following code:
    # Primitive bash-script to download and extract all addons for Battle for Wesnoth 1.8
    # by karl.rosenqvist@gmail.com
    # released 2011-10-31 under WTFPL-License v.2 http://sam.zoy.org/wtfpl/COPYING

    # Wget recursively downloads only BZ2 files linked from the sites listed
    # in addons_18.txt that are newer than any you've already downloaded. There are a few
    # other specifications in there - like to not create a new directory for every music
    # file, to ignore robots.txt and to not crawl up to the parent directory of a link.
    # It is based on this example http://www.veen.com/jeff/archives/000573.html

    wget -r -l1 -H -t1 -nd -N -np -A.bz2 -erobots=off -i addons_18.txt
  7. Save and exit.
  8. Now enter "./get_addons_18.sh" and wait coz it's gonna take a while.
  9. Once the download has finished you will have to move the files to the appropriate directory yourself. With BfW it is /home/[USER]/.wesnoth1.8/ and unpack them yourself. I couldn't make the script do that yet.
Download all the files and unpack them into the appropriate folder, let me know in the comments if you found this useful or are experiencing problems. And if the developers of BfW finds this script useful or a nuisance clogging up the servers I can only apologize.

Good luck!