diff --git a/README.md b/README.md index b0e4701..22a73ab 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,21 @@ or wget -O - https://get.acme.sh | sh ``` +### Install Options + +See https://github.com/Neilpang/acme.sh/wiki/Options-and-Params for available options. + +``` +curl https://get.acme.sh | ACME_USE_WGET=1 HTTPS_INSECURE=1 sh -s -- --home /opt/acme.sh --noprofile + +``` + +or + +``` +wget -O - https://get.acme.sh | HTTPS_INSECURE=1 sh -s -- --home /opt/acme.sh --noprofile +``` + ## 2. Advanced Installation: https://github.com/Neilpang/acme.sh/wiki/How-to-install diff --git a/index.html b/index.html index f85ab94..d0da853 100644 --- a/index.html +++ b/index.html @@ -9,19 +9,44 @@ return 1 fi if type command >/dev/null 2>&1 ; then - command -v $cmd >/dev/null 2>&1 + command -v "$cmd" >/dev/null 2>&1 else - type $cmd >/dev/null 2>&1 + type "$cmd" >/dev/null 2>&1 fi - ret="$?" - return $ret + return "$?" } -if _exists curl && [ "${ACME_USE_WGET:-0}" = "0" ]; then - curl https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh +_truthy() { + val="$(echo "$1" | tr '[:upper:]' '[:lower:]')" + [ -n "$val" ] && [ "$val" != 0 ] && [ "$val" != false ] +} + +if _truthy "$HTTPS_INSECURE"; then + _CURL_OPTS="--insecure" + _WGET_OPTS="--no-check-certificate" +else + _CURL_OPTS= + _WGET_OPTS= +fi + +if _truthy "$ACME_USE_WGET"; then + _USE_WGET=1 +else + _USE_WGET=0 +fi + +_ACME="https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh" +_CURL="curl $_CURL_OPTS $_ACME" +_WGET="wget $_WGET_OPTS -O - $_ACME" + +if _exists curl && [ -z "$_USE_WGET" ]; then + _CMND="$_CURL" elif _exists wget ; then - wget -O - https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh + _CMND="$_WGET" else echo "Sorry, you must have curl or wget installed first." echo "Please install either of them and try again." + exit 2 fi + +$_CMND | ACME_USE_WGET=$_USE_WGET INSTALLONLINE=1 sh -s -- "$@"