From 21165f36157de2e42e4ad8eb16599b0325c98c9b Mon Sep 17 00:00:00 2001 From: Filippo Squillace Date: Tue, 21 Oct 2014 21:25:43 +0100 Subject: [PATCH] Make wget available using curl as fallback --- README.md | 9 +++++++++ bin/juju | 8 -------- lib/core.sh | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2305864..884cd77 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,15 @@ To install the image named juju-x86\_64.tar.gz: # juju -i juju-x86_64.tar.gz +Dependencies +------------ +JuJu comes with a very short list of dependencies in order to be installed in most +of GNU/Linux distributions. The dependencies needed to be in the host OS are: +- bash +- wget or curl +- mkdir +- linux kernel 2.6.32 + Troubleshooting --------------- - **Q**: Why do I get the error "Cannot find the gzip binary required for compressing man and info pages." when I try to install package with yaourt? diff --git a/bin/juju b/bin/juju index 5cbacda..ec46c25 100755 --- a/bin/juju +++ b/bin/juju @@ -84,14 +84,6 @@ for arg do ARGS+=($arg) done -############## CHECKING ESSENTIAL COMMANDS #################### -# Check if the essentials commands are installed (wget and tar) -if ! which wget &> /dev/null || ! which tar &> /dev/null -then - error "Error: wget and tar commands are essentials for JuJu. Get them first." - exit 1 -fi - ################ DEFINE ACTION ######################## if $OPT_SETUP_FROM_FILE; then setup_from_file_juju ${ARGS[@]} diff --git a/lib/core.sh b/lib/core.sh index a65b495..60058d9 100644 --- a/lib/core.sh +++ b/lib/core.sh @@ -32,9 +32,19 @@ source "$(dirname ${BASH_ARGV[0]})/util.sh" JUJU_REPO=https://bitbucket.org/fsquillace/juju-repo/raw/master ORIGIN_WD=$(pwd) -# Define the variables for the dependency commands bash, wget, tar, which, awk, grep, xz, file -WGET="wget --no-check-certificate" +# The essentials executables that MUST exist in the host OS are (wget|curl), bash, mkdir +if command -v wget > /dev/null 2>&1 +then + WGET="wget --no-check-certificate" +elif command -v curl > /dev/null 2>&1 +then + WGET="curl -J -O -k" +else + error "Error: Either wget or curl commands must be installed" + exit 1 +fi TAR=tar + PROOT="${JUJU_HOME}/lib64/ld-linux-x86-64.so.2 --library-path ${JUJU_HOME}/usr/lib:${JUJU_HOME}/lib ${JUJU_HOME}/usr/bin/proot" ################################# MAIN FUNCTIONS ##############################