1
0
mirror of https://github.com/limosek/zaf.git synced 2024-11-21 18:09:06 +01:00

Added possibility to use wget

This commit is contained in:
Lukas Macura 2016-12-05 12:03:13 +01:00
parent 9ac7bd34d4
commit 71a79ed57f
4 changed files with 32 additions and 9 deletions

View File

@ -30,6 +30,14 @@ You need to be root and you must have curl installed on your system. Depending o
``` ```
curl -k https://raw.githubusercontent.com/limosek/zaf/master/install.sh | sh curl -k https://raw.githubusercontent.com/limosek/zaf/master/install.sh | sh
``` ```
If you have only wget installed:
```
wget --no-check-certificate -O - https://raw.githubusercontent.com/limosek/zaf/master/install.sh | sh
```
If you do not have https support (like openwrt)
```
wget -O - http://github.macura.cz/zaf/install.sh| ZAF_RAW_URL=http://github.macura.cz/zaf/install.sh ZAF_REPO_URL=http://github.macura.cz/zaf-plugins/ sh
```
### Install options and autoconfiguration ### Install options and autoconfiguration
General parameters for install.sh on any system (simplest way how to install) General parameters for install.sh on any system (simplest way how to install)

View File

@ -5,6 +5,9 @@ if [ -z "$ZAF_URL" ]; then
# Runing as standalone install.sh. We have to download rest of files first. # Runing as standalone install.sh. We have to download rest of files first.
ZAF_URL="https://github.com/limosek/zaf/" ZAF_URL="https://github.com/limosek/zaf/"
fi fi
if [ -z "$ZAF_RAW_URL" ]; then
ZAF_RAW_URL="https://raw.githubusercontent.com/limosek/zaf"
fi
[ -z "$ZAF_GITBRANCH" ] && ZAF_GITBRANCH=master [ -z "$ZAF_GITBRANCH" ] && ZAF_GITBRANCH=master
@ -12,8 +15,12 @@ fi
# Lite version of zaf_fetch_url, full version will be loaded later # Lite version of zaf_fetch_url, full version will be loaded later
zaf_fetch_url(){ zaf_fetch_url(){
echo curl -f -k -s -L -o - "$1" >&2; if zaf_which curl >/dev/null 2>/dev/null; then
curl -f -k -s -L -o - "$1" echo curl -f -k -s -L -o - "$1" >&2;
curl -f -k -s -L -o - "$1"
else
wget --no-check-certificate -O - "$1"
fi
} }
# Lite version of zaf_which, full version will be loaded later # Lite version of zaf_which, full version will be loaded later
@ -401,17 +408,17 @@ zaf_postconfigure() {
if ! [ -f README.md ]; then if ! [ -f README.md ]; then
# Hardcoded variables # Hardcoded variables
ZAF_VERSION="1.3" ZAF_VERSION="1.3"
ZAF_URL="https://github.com/limosek/zaf"
ZAF_RAW_URL="https://raw.githubusercontent.com/limosek/zaf"
export ZAF_TMP_DIR="/tmp/zaf-installer" export ZAF_TMP_DIR="/tmp/zaf-installer"
export ZAF_DIR="$ZAF_TMP_DIR/zaf" export ZAF_DIR="$ZAF_TMP_DIR/zaf"
if [ -n "$ZAF_PROXY" ]; then if [ -n "$ZAF_PROXY" ]; then
export ALL_PROXY="$ZAF_PROXY" export ALL_PROXY="$ZAF_PROXY"
export http_proxy="$ZAF_PROXY"
export https_proxy="$ZAF_PROXY"
fi fi
mkdir -p $ZAF_TMP_DIR mkdir -p $ZAF_TMP_DIR
if ! zaf_which curl >/dev/null; if ! zaf_which curl >/dev/null && ! zaf_which wget >/dev/null;
then then
zaf_err "Curl not found. Cannot continue. Please install it." zaf_err "Curl or wget not found. Cannot continue. Please install it."
fi fi
echo "Installing from url $url..." echo "Installing from url $url..."
[ -z "$*" ] && auto=auto [ -z "$*" ] && auto=auto

View File

@ -102,9 +102,15 @@ zaf_fetch_url() {
case $scheme in case $scheme in
http|https|ftp|file) http|https|ftp|file)
[ "$scheme" != "file" ] && [ -n "$ZAF_OFFLINE" ] && zaf_err "Cannot download $1 in offline mode!" [ "$scheme" != "file" ] && [ -n "$ZAF_OFFLINE" ] && zaf_err "Cannot download $1 in offline mode!"
[ "${ZAF_CURL_INSECURE}" = "1" ] && insecure="-k" if zaf_which curl >/dev/null 2>/dev/null; then
zaf_dbg curl $insecure -f -s -L -o - $1 [ "${ZAF_CURL_INSECURE}" = "1" ] && insecure="-k"
curl $insecure -f -s -L -o - "$1" | zaf_tocache_stdin "$1" 120 zaf_dbg curl $insecure -f -s -L -o - $1
curl $insecure -f -s -L -o - "$1" | zaf_tocache_stdin "$1" 120
else
[ "${ZAF_CURL_INSECURE}" = "1" ] && insecure="--no-check-certificate"
zaf_dbg wget $insecure -O - $1
wget $insecure -O - "$1" | zaf_tocache_stdin "$1" 120
fi
;; ;;
esac esac
} }

2
zaf
View File

@ -27,6 +27,8 @@ fi
if [ -n "$ZAF_PROXY" ]; then if [ -n "$ZAF_PROXY" ]; then
export ALL_PROXY="$ZAF_PROXY" export ALL_PROXY="$ZAF_PROXY"
export http_proxy="$ZAF_PROXY"
export https_proxy="$ZAF_PROXY"
fi fi
if [ -f ./lib/zaf.lib.sh ]; then if [ -f ./lib/zaf.lib.sh ]; then