diff options
author | Aleksander Machniak <alec@alec.pl> | 2016-12-30 21:41:50 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2016-12-30 21:41:50 +0300 |
commit | cb09ff0ffcb2a06c9dd493b5441c03483da8c84a (patch) | |
tree | d4a450c5439fecd0c74224f12d73525230e3ccac /bin | |
parent | 40cd8d3bdd8d360f9eae8d98171011942141dae1 (diff) |
Make it working with wget when curl is not installed, mark --force argument as boolean
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/install-jsdeps.sh | 11 |
1 files 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) { |