From cb09ff0ffcb2a06c9dd493b5441c03483da8c84a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 30 Dec 2016 19:41:50 +0100 Subject: [PATCH] Make it working with wget when curl is not installed, mark --force argument as boolean --- bin/install-jsdeps.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/install-jsdeps.sh b/bin/install-jsdeps.sh index ebc539d88..c92c94a2f 100755 --- a/bin/install-jsdeps.sh +++ b/bin/install-jsdeps.sh @@ -102,14 +102,19 @@ EOL; */ function fetch_from_source($package, $useCache = true, &$filetype = null) { - global $CURL, $FILEINFO, $CACHEDIR; + global $CURL, $WGET, $FILEINFO, $CACHEDIR; $filetype = pathinfo($package['url'], PATHINFO_EXTENSION) ?: 'tmp'; $cache_file = $CACHEDIR . '/' . $package['lib'] . '-' . $package['version'] . '.' . $filetype; if (!is_readable($cache_file) || !$useCache) { echo "Fetching $package[url]\n"; - exec(sprintf('%s -s %s -o %s', $CURL, escapeshellarg($package['url']), $cache_file), $out, $retval); + + if ($CURL) + exec(sprintf('%s -s %s -o %s', $CURL, escapeshellarg($package['url']), $cache_file), $out, $retval); + else + exec(sprintf('%s -q %s -O %s', $WGET, escapeshellarg($package['url']), $cache_file), $out, $retval); + if ($retval !== 0) { die("ERROR: Failed to download source file from " . $package['url'] . "\n"); } @@ -252,7 +257,7 @@ function extrac_zipfile($package, $srcfile) //////////////// Execution -$args = rcube_utils::get_opt(array('f' => 'force')) + array('force' => false); +$args = rcube_utils::get_opt(array('f' => 'force:bool')) + array('force' => false); $WHAT = $args[0]; foreach ($SOURCES['dependencies'] as $package) {