summaryrefslogtreecommitdiff
path: root/lib/builder-utils.sh
diff options
context:
space:
mode:
authorDT Netsolution GmbH <[email protected]>2012-01-27 00:04:47 (GMT)
committer DT Netsolution GmbH <op[email protected]>2012-01-27 00:04:47 (GMT)
commit9fb1cd3e0223fbc8d4c150085c453455f420cf4c (patch)
tree77c7f6f0e7d44708854ded4f9d45e63547ed8632 /lib/builder-utils.sh
parent841784005c9db5b63a11acd0ee207a861d3cd52d (diff)
- moved builder frome itwatch to devtools
- restructured, added variable handling, callbacks, ....
Diffstat (limited to 'lib/builder-utils.sh')
-rw-r--r--lib/builder-utils.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh
new file mode 100644
index 0000000..4cf2c71
--- /dev/null
+++ b/lib/builder-utils.sh
@@ -0,0 +1,56 @@
+#############################################
+# void retrieve_file (src, dst)
+#
+# Description: retrieve file from an URL
+#
+# Parameter
+# src: source url to get file from
+# dst: path to store file to
+#
+#############################################
+function retrieve_file() {
+ local src=$1
+ local dst=$2
+
+ # Check, if the URL is a file URL starting with file://
+ if [ -f $dst ] && [ -z ${DIST_FORCE_DOWNLOAD} ]; then
+ echo " Info: File still cached/downloaded. To force a download, set DIST_FORCE_DOWNLOAD=1"
+ elif [[ $src == file://* ]]; then
+ fileurl=`echo $src | sed "s/^file:\/\///"`
+ cp $fileurl $dst 2>/dev/null
+ else
+ rm -f $dst
+ wget --tries=1 -O $dst --timeout=5 -q --no-verbose $src
+ fi
+}
+
+
+#############################################
+# check if method is available and call it
+#############################################
+function call_entry_point() {
+ local _resultvar=$1
+ local func=$2
+
+ # Entry point
+ type $func &>/dev/null
+ if [ $? == 0 ] ; then
+ $func
+ eval $_resultvar="0"
+ else
+ eval $_resultvar="1"
+ fi
+
+}
+
+
+###################
+# Check error
+###################
+builder_check_error() {
+ if [ $? == 1 ] ; then
+ echo "FATAL: $1"
+ exit 0
+ fi
+}
+

Powered by Domaintechnik.at | Hosting - Domain - Webspace