Admin/download-components
author wenzelm
Wed, 01 Aug 2012 22:11:54 +0200
changeset 48639 675988e64bf9
parent 48593 c895e334162c
child 48788 cea7f88c8084
permissions -rwxr-xr-x
store parent heap stamp as well -- needs to be propagated through the build hierarchy; misc tuning;

#!/usr/bin/env bash
#
# Author: Florian Haftmann
#
# DESCRIPTION: Download and unpack components from central component store

shopt -s -o errexit
shopt -s -o nounset

THIS="$(basename "$0")"
HERE="$(cd $(dirname "$0"); cd "$(pwd -P)"; pwd)"

trap 'echo "Error in ${THIS}" >&2' ERR

function fail {
  echo "$1" >&2
  exit 1
}

ISABELLE_HOME_USER="$(isabelle getenv -b ISABELLE_HOME_USER)"
: ${TMP:='/tmp'}
REMOTE='http://isabelle.in.tum.de/components'
LOCAL="${ISABELLE_HOME_USER}/contrib"
SUFFIX='.tar.gz'

for COMPONENT in "$@"
do
  COMPONENT_ARCHIVE="${COMPONENT}.tar.gz"
  wget -nd --directory-prefix="${TMP}" "${REMOTE}/${COMPONENT_ARCHIVE}"
  tar -xzv -f "${TMP}/${COMPONENT_ARCHIVE}" -C "${LOCAL}"
  rm "${TMP}/${COMPONENT_ARCHIVE}"
  echo
done