Bukkit Build Downloader

Discussion in 'Bukkit Tools' started by ltouroumov, Jan 17, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    ltouroumov

    Bukkit build downloader is not technically a plugin, but I didn't see anywhere else to post it.

    Build Downloader allows you to download and switch versions of bukkit.
    This is a Linux Bash script, it will not run on windows.
    I don't think I will make a ".bat" version of this.

    Usage:
    Code:
    ./manage.sh package command version
    Packages
    • bukkit
    • craftbukkit
    Commands
    • Download
      Downloads the bukkit build specified in "version" and names it bukkit-"version".jar or craftbukkit-"version".jar
    • Remove
      Delete the bukkit/craftbukkit .jar
    • Default
      Links the specified version of craftbukkit or bukkit to the generic jar
    Version
    build number that can be found at http://bamboo.lukegb.com/

    Examples
    Code:
    ./manage.sh craft download 65
    will download build 65 of craftbukkit
    Code:
    ./manage.sh craft default 65
    Sets build 65 as default

    Script
    Code:
    #!/bin/bash
    
    case "$1" in
      bukkit)
        url_pattern="http://bamboo.lukegb.com/browse/BUKKIT-BUKKITMAIN-JOB1-#version#/artifact/Bukkit-JAR/bukkit-0.0.1-SNAPSHOT.jar"
        file_pattern="bukkit-#version#.jar"
        file_default="bukkit.jar"
      ;;
      craft|craftbukkit)
        url_pattern="http://bamboo.lukegb.com/browse/BUKKIT-CRAFTBUKKIT-JOB1-#version#/artifact/CraftBukkit-JAR/craftbukkit-0.0.1-SNAPSHOT.jar"
        file_pattern="craftbukkit-#version#.jar"
        file_default="craftbukkit.jar"
      ;;
      *)
        echo "Specify a package (bukkit or craft[bukkit])"
        exit -1
      ;;
    esac
    
    shift
    
    case "$1" in
      download)
        version=$2
        url=$(echo "$url_pattern" | sed "/#version#/s//$version/")
        file=`basename $url`
        echo "Downloading $url"
        wget -q "$url"
        if [[ -f "$file" ]]; then (
          mv `basename $url` $(echo "$file_pattern" | sed "/#version#/s//$version/")
        ) else (
          echo "Download failed"
        ) fi
      ;;
      remove)
        version=$2
        file=$(echo "$file_pattern" | sed "/#version#/s//$version/")
        if [[ -f "$file" ]]; then (
          rm $file
          echo "Removed $file"
        ) else (
          echo "File $file does not exist"
        ) fi
      ;;
      default)
        version=$2
        file=$(echo "$file_pattern" | sed "/#version#/s//$version/")
        if [[ -f "$file" ]]; then (
          rm "$file_default"
          ln -s $file $file_default
        ) else (
          echo "File $file missing"
        ) fi
      ;;
    esac
     
  2. Offline

    seanth

    I like this. On OS X 10.6, change wget -q to curl -O, though.
     
  3. Offline

    AntonJrL

    I suggest adding a command like '/latestupdate' or something, just sayin'. Thanks for this!
     
  4. Offline

    Lamp

  5. Offline

    seanth

    This isn't a plugin, so commands like that won't work. This is a shell script.
     
  6. Offline

    PilotPrecise

  7. Offline

    ltouroumov

    @AntonJrL This is not In-Game, it's meant to be executed in the terminal of the server
    @seanth I haven't used it on my mac since I run on dedicated

    I was thinking on adding the --latest switch on download and default. But in my experience, the latest build never works with all the plugins (and I got only 5: WorldEdit, WorldGuard, General, MyHome, MyWarp).

    But to do that I need to parse the HTML of the bamboo (Ex: http://bamboo.lukegb.com/browse/BUKKIT-CRAFTBUKKIT/) to extract latest version number, I don't think I can do it with bash script so I will need to use a ruby/perl/python script to do that.
    I'll work on that, but I want to play minecraft too.
     
Thread Status:
Not open for further replies.

Share This Page