+ TMP=`mktemp -d`
+
+ echo "[[Downloading $TARGZURL ($TMP)]]"
+ echo "[wget \"$TARGZURL\" -O \"$TMP/$TARFILE\"]"
+
+ pushd "$CIVICRM_ROOT" > /dev/null
+ wget -q "$TARGZURL" -O "$TMP/$TARFILE"
+ tar zxfv "$TMP/$TARFILE"
+ popd
+
+ rm "$TMP/$TARFILE"
+ rmdir "$TMP"
+}
+
+###########################################
+## usage: do_gencode <civicrm-path>
+function do_gencode() {
+ pushd "$1/xml" > /dev/null
+ if [ -f "GenCode.php" ]; then
+ echo "[[Generate files]]"
+ php GenCode.php
+ else
+ echo "[[Skip \"Generate files\"]]"
+ fi
+ popd > /dev/null
+}
+
+###########################################
+## config_repo <repo-name> <local-path> <default-branch> <git-scripts-path>
+## 1 2 3 4
+function config_repo() {
+ do_gitify "${UPSTREAM_GIT_BASE_URL}/${1}.git" "$2" -b "$3"
+ do_hookify "$1" "$2" "$4"
+ ## doesn't work with http -- git ls-remote "git://github.com/civicrm/civicrm-drupalz.git" HEAD --exit-code &>- ; echo $?
+ if [ -n "$FORK_GIT_BASE_URL" ]; then
+ git_set_remote "$2" upstream "${UPSTREAM_GIT_BASE_URL}/${1}.git"
+ git_set_remote "$2" origin "${FORK_GIT_BASE_URL}/${1}.git"
+ else
+ git_set_remote "$2" origin "${UPSTREAM_GIT_BASE_URL}/${1}.git"
+ fi