Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
KrestenKjaer committed Oct 2, 2018
0 parents commit 0f1f3cb
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
*.iml
49 changes: 49 additions & 0 deletions bin/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

readonly TMP_DOWNLOAD_DIR="$(mktemp -d -t "liquibase_XXXXXX")"

install () {
local -r install_type="$1"
local -r version="$2"
local -r install_path="$3"

local -r bin_install_path="${install_path}/bin"
local -r download_url="$(get_download_url "${version}")"
local -r download_path="${TMP_DOWNLOAD_DIR}/$(get_filename "${version}")"

echo "Downloading liquibase version ${version} from ${download_url}"
if curl -Lfs "${download_url}" -o "${download_path}"; then
echo "Cleaning liquibase previous binaries"
rm -rf "${bin_install_path}/liquibase"

echo "Creating liquibase bin directory"
mkdir -p "${bin_install_path}"

echo "Extracting liquibase archive"
echo "${download_path} -C ${bin_install_path}"
tar zxfv "${download_path}" -C "${bin_install_path}" --strip 1
mv "${bin_install_path}/liquibase-v${version}/liquibase" "${bin_install_path}/liquibase"
else
echo "Error: liquibase version ${version} not found" >&2
exit 1
fi
}

get_arch () {
uname | tr '[:upper:]' '[:lower:]'
}

get_filename () {
local -r version="$1"
local -r platform="$(get_arch)"
echo "liquibase-${version}-bin.tar.gz"
}

get_download_url () {
local -r version="$1"
local -r filename="$(get_filename "${version}")"
echo "https://github.com/liquibase/liquibase/releases/download/liquibase-parent-${version}/${filename}"
echo "https://github.com/rancher/rancher-compose/releases/download/v${version}/${filename}"
}

install "${ASDF_INSTALL_TYPE}" "${ASDF_INSTALL_VERSION}" "${ASDF_INSTALL_PATH}"
7 changes: 7 additions & 0 deletions bin/list-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

list_all () {
echo "3.6.2"
}

list_all

0 comments on commit 0f1f3cb

Please sign in to comment.