From 045151971575ad855cd645a2bf84de0ddf1b09ff Mon Sep 17 00:00:00 2001 From: Honza Hommer Date: Sun, 19 May 2019 15:42:11 +0200 Subject: [PATCH 1/6] Pass arguments to installOnline function --- get.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/get.sh b/get.sh index f85ab94..b9bbc0b 100644 --- a/get.sh +++ b/get.sh @@ -9,18 +9,18 @@ _exists() { 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 } if _exists curl && [ "${ACME_USE_WGET:-0}" = "0" ]; then - curl https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh + curl https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh -s - "$@" elif _exists wget ; then - wget -O - https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh + wget -O - https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh -s - "$@" else echo "Sorry, you must have curl or wget installed first." echo "Please install either of them and try again." From 3334c8d142553c90f9abb2ea135127b4a9272992 Mon Sep 17 00:00:00 2001 From: Honza Hommer Date: Tue, 2 Jul 2019 23:00:41 +0200 Subject: [PATCH 2/6] Use double dash, typos --- index.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index b9bbc0b..89fb0bf 100644 --- a/index.html +++ b/index.html @@ -13,14 +13,13 @@ else 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 -s - "$@" + curl https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh -s -- "$@" elif _exists wget ; then - wget -O - https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh -s - "$@" + wget -O - https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh -s -- "$@" else echo "Sorry, you must have curl or wget installed first." echo "Please install either of them and try again." From 7f33bcc3ce8adfb791aaa8478305446c71b527ae Mon Sep 17 00:00:00 2001 From: Honza Hommer Date: Tue, 2 Jul 2019 23:23:54 +0200 Subject: [PATCH 3/6] Add HTTPS_INSECURE support --- index.html | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 89fb0bf..0b72d16 100644 --- a/index.html +++ b/index.html @@ -16,11 +16,31 @@ return "$?" } -if _exists curl && [ "${ACME_USE_WGET:-0}" = "0" ]; then - curl https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh -s -- "$@" +_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 + +_ACME="https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh" +_CURL="curl $_CURL_OPTS $_ACME" +_WGET="wget $_WGET_OPTS $_ACME" + +if _exists curl && ! _truthy "$ACME_USE_WGET"; then + _CMND="$_CURL" elif _exists wget ; then - wget -O - https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh -s -- "$@" + _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 | INSTALLONLINE=1 sh -s -- "$@" From 8a48e527c508a5b087cb5e825ca59ed7cc565714 Mon Sep 17 00:00:00 2001 From: Honza Hommer Date: Tue, 2 Jul 2019 23:41:11 +0200 Subject: [PATCH 4/6] Add ACME_USE_WGET support --- index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 0b72d16..0adbde1 100644 --- a/index.html +++ b/index.html @@ -29,11 +29,17 @@ _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 $_ACME" -if _exists curl && ! _truthy "$ACME_USE_WGET"; then +if _exists curl && [ -z "$_USE_WGET" ]; then _CMND="$_CURL" elif _exists wget ; then _CMND="$_WGET" @@ -43,4 +49,4 @@ exit 2 fi -$_CMND | INSTALLONLINE=1 sh -s -- "$@" +$_CMND | ACME_USE_WGET=$_USE_WGET INSTALLONLINE=1 sh -s -- "$@" From 90ea99565fe2d40248e4705e2a61be01f74f5f3d Mon Sep 17 00:00:00 2001 From: Honza Hommer Date: Tue, 2 Jul 2019 23:41:42 +0200 Subject: [PATCH 5/6] Update README --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 From 073799daf73c96729a367d32787c61726fb2ed2b Mon Sep 17 00:00:00 2001 From: Honza Hommer Date: Tue, 2 Jul 2019 23:44:37 +0200 Subject: [PATCH 6/6] Fix missing wget option --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 0adbde1..d0da853 100644 --- a/index.html +++ b/index.html @@ -37,7 +37,7 @@ _ACME="https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh" _CURL="curl $_CURL_OPTS $_ACME" -_WGET="wget $_WGET_OPTS $_ACME" +_WGET="wget $_WGET_OPTS -O - $_ACME" if _exists curl && [ -z "$_USE_WGET" ]; then _CMND="$_CURL"