bashgithubliquibasesourceforge

How to setup latest version of liquibase through bash script?


I used to install liquibase older version e.g

   `wget https://github.com/downloads/liquibase/liquibase/liquibase-2.0.5-bin.tar.gz`

and proceed with extraction and move it to desired location . I am unable to locate latest version of liquibase on github. Probably its removed or unavailable ?

Liquibase download page has only link to source-forge , could someone help me how to wget a package from source-forge ?

Edit I am not sure of github, it seems there are no builds available for latest version. However, my complete script looks like this:

#!/bin/bash
sudo apt-get update
sudo apt-get install -y openjdk-7-jre-headless
sudo apt-get install -y libmysql-java
LV="3.1.1"
function setupLiquibase(){
  source $HOME/.profile

  INSTALLED="$(command -v liquibase)"

  # if not added already
  if [ -z "$LIQUIBASE_HOME" ]
    then
      echo  'export MYSQL_JCONNECTOR=/usr/share/java/mysql-connector-java.jar'|sudo tee -a $HOME/.profile
      echo  'export LIQUIBASE_HOME=/usr/local/liquibase' |sudo tee -a $HOME/.profile
      echo  'export PATH=$PATH:$LIQUIBASE_HOME'|sudo tee -a $HOME/.profile
  fi

  if [ -z "$INSTALLED" ]
    then
        echo "Installing liquibase $LV "
        sudo rm -rf liquibase*
        wget http://kaz.dl.sourceforge.net/project/liquibase/Liquibase%20Core/liquibase-"$LV"-bin.tar.gz
        gunzip liquibase-"$LV"-bin.tar.gz
        sudo mkdir /usr/local/liquibase
        sudo tar -xf liquibase-"$LV"-bin.tar -C /usr/local/liquibase
        sudo chmod +x /usr/local/liquibase/liquibase
    else
        INSTALLED="$(liquibase --version)"
        echo "Liquibase is already installed, ${INSTALLED}"
  fi
}

setupLiquibase

Solution

  • Try to download it with this command line

    wget http://sourceforge.net/projects/liquibase/files/Liquibase%20Core/liquibase-3.2.0-bin.tar.gz/download -O liquibase-3.2.0-bin.tar.gz
    

    To choose a filename for the download you can specify the option -O nomefile (Note that it is a capital o not a 0).

    If you forget (like I did the first time) to specify -O nomefile you will have on the hard disk a file with the name as guessed by wget. So:

    http://Site/FullPath/liquibase-3.2.0-bin.tar.gz/download  --> download
    

    and after you have to rename by hands the file download.

    If instead it was

    http://Site/FullPath/liquibase-3.2.0-bin.tar.gz  --> liquibase-3.2.0-bin.tar.gz
    

    you will have directly the file with the correct name.