Hello,

tried libo_git_from_tar.sh on mac os x and failed because of missing wget, since we have curl which should do it let's try tp use it.

This has been lightly tested, read: i've verified that the both on linux and on mac os x it starts downloading. It is still running on mac os x and tomorrow will know if it worked fine. Anyway the patch looks simple enough to be correct.

Please review.

thanks,
riccardo
>From ccbe3e4e0a28e2b8587daa1c4ad6732e9c608286 Mon Sep 17 00:00:00 2001
From: Riccardo Magliocchetti <riccardo.magliocche...@gmail.com>
Date: Mon, 23 Jul 2012 20:14:27 +0200
Subject: [PATCH] Use curl if available in libo_git_from_tar


Signed-off-by: Riccardo Magliocchetti <riccardo.magliocche...@gmail.com>
---
 libo_git_from_tar.sh |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/libo_git_from_tar.sh b/libo_git_from_tar.sh
index bc086ad..2850c68 100755
--- a/libo_git_from_tar.sh
+++ b/libo_git_from_tar.sh
@@ -55,7 +55,7 @@ usage()
 #
 sanity_check()
 {
-    which wget > /dev/null 2>&1 || die "This script need wget in the PATH to function"
+    which wget > /dev/null 2>&1 || which curl > /dev/null 2>&1 || die "This script need wget or curl in the PATH to function"
     which tar > /dev/null 2>&1 || die "This script need tar in the PATH to function"
     which bzip2 > /dev/null 2>&1 || die "This script need bzips in the PATH to function"
 }
@@ -77,6 +77,22 @@ shift
 }
 
 ###
+# Wrapper for curl / wget
+#
+download()
+{
+    if command -v wget; then
+        wget -c $1 -P $2
+    else
+        if command -v curl; then
+            curl -C --create-dirs $1 -o $2/$(basename $1)
+            exit 1
+        fi
+    fi
+}
+
+
+###
 # Create the links, if needed, in the core repo for a given child repos
 #
 relink()
@@ -109,7 +125,7 @@ process_child_repo()
 local repo="$1"
 
     if ! $resume ; then do_action "Remove old copy of $repo tar.bz2 file, if any" "removing ${temp_dir}/libreoffice-$repo.tar.bz2"  rm -f ${temp_dir}/libreoffice-$repo.tar.bz2 ; fi
-    do_action "Download the $repo repo tar.bz2 file" "downloading package for the $repo repo" wget -c http://dev-www.libreoffice.org/bundles/libreoffice-$repo.tar.bz2 -P ${temp_dir}
+    do_action "Download the $repo repo tar.bz2 file" "downloading package for the $repo repo" download http://dev-www.libreoffice.org/bundles/libreoffice-$repo.tar.bz2 ${temp_dir}
 
     if [ -e ./clone/$repo ] ; then
         do_action "Remove the current $repo repo" "removing ./clone/$repo" rm -fr ./clone/$repo
@@ -176,7 +192,7 @@ fi
 
 if $do_core ; then
     if ! $resume ; then do_action "Remove any old copy of core tar.bz2 file, if any" "removing ${temp_dir}/libreoffice-core.tar.bz2"  rm -f ${temp_dir}/libreoffice-core.tar.bz2 ; fi
-    do_action "Download the core repo tar.bz2 file" "downloading package for the core repo" wget -c http://dev-www.libreoffice.org/bundles/libreoffice-core.tar.bz2 -P ${temp_dir}
+    do_action "Download the core repo tar.bz2 file" "downloading package for the core repo" download http://dev-www.libreoffice.org/bundles/libreoffice-core.tar.bz2 ${temp_dir}
     do_action "" "cannot create the directory ${core_path}" mkdir ${core_path?}
     do_action "" "cannot cd to ${core_path?}" pushd ${core_path?} > /dev/null
     do_action "Unpack the core repo tar.bz2 file to ${core_path}" "unpacking the core tar.bz2 file" tar --strip-components=1 -xf ${temp_dir}/libreoffice-core.tar.bz2
-- 
1.7.10.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to