do not fail silently when curl is missing

pull/117/merge
nightwing 2015-05-29 23:21:36 +04:00
rodzic e20c2810be
commit 3e29bc2d4e
1 zmienionych plików z 28 dodań i 2 usunięć

Wyświetl plik

@ -1,5 +1,20 @@
#!/bin/bash -e
set -e
has() {
type "$1" > /dev/null 2>&1
return $?
}
if has "wget"; then
DOWNLOAD="wget --no-check-certificate -nc"
elif has "curl"; then
DOWNLOAD="curl -sSOL"
else
echo "Error: you need curl or wget to proceed" >&2;
exit 1
fi
cd `dirname $0`/..
SOURCE=`pwd`
@ -116,12 +131,23 @@ updateCore() {
installGlobalDeps() {
if ! [[ -f ~/.c9/installed ]] && ! [[ $os == "windows" ]]; then
curl https://raw.githubusercontent.com/c9/install/master/install.sh | bash
if ! [[ -f ~/.c9/installed ]]; then
if [[ $os == "windows" ]]; then
URL=https://raw.githubusercontent.com/cloud9ide/sdk-deps-win32
else
URL=https://raw.githubusercontent.com/c9/install
fi
$DOWNLOAD $URL/master/install.sh | bash
fi
}
############################################################################
export C9_DIR="$HOME"/.c9
if [[ $os == "windows" ]]; then
export PATH="$C9_DIR:$C9_DIR/node_modules/.bin:$PATH"
else
export PATH="$C9_DIR/node/bin:$C9_DIR/node_modules/.bin:$PATH"
fi
NPM=npm
NODE=node