work in the current dir, without installation (#279)

This commit is contained in:
neil 2016-09-02 22:37:49 +08:00 committed by GitHub
parent 2d12b68952
commit f3e4cea34f

41
acme.sh
View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh
VER=2.4.4
VER=2.4.5
PROJECT_NAME="acme.sh"
@ -8,6 +8,10 @@ PROJECT_ENTRY="acme.sh"
PROJECT="https://github.com/Neilpang/$PROJECT_NAME"
DEFAULT_INSTALL_HOME="$HOME/.$PROJECT_NAME"
_SCRIPT_="$0"
DEFAULT_CA="https://acme-v01.api.letsencrypt.org"
DEFAULT_AGREEMENT="https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf"
@ -91,7 +95,6 @@ _err() {
}
_usage() {
version
_err_e "$@"
}
@ -1227,10 +1230,37 @@ _starttlsserver() {
#[domain] [keylength]
_initpath() {
if [ -z "$_SCRIPT_HOME" ] ; then
if _exists readlink && _exists dirname ; then
_debug "Lets guess script dir."
_debug "_SCRIPT_" "$_SCRIPT_"
_script="$(readlink -f "$_SCRIPT_")"
_debug "_script" "$_script"
_script_home="$(dirname "$_script")"
_debug "_script_home" "$_script_home"
if [ -d "$_script_home" ] ; then
_SCRIPT_HOME="$_script_home"
else
_err "It seems the script home is not correct:$_script_home"
fi
fi
fi
if [ -z "$LE_WORKING_DIR" ] ; then
LE_WORKING_DIR=$HOME/.$PROJECT_NAME
if [ -f "$DEFAULT_INSTALL_HOME/account.conf" ] ; then
_debug "It seems tha $PROJECT_NAME is already installed in $DEFAULT_INSTALL_HOME"
LE_WORKING_DIR="$DEFAULT_INSTALL_HOME"
else
LE_WORKING_DIR="$_SCRIPT_HOME"
fi
fi
if [ -z "$LE_WORKING_DIR" ] ; then
_debug "Using default home:$DEFAULT_INSTALL_HOME"
LE_WORKING_DIR="$DEFAULT_INSTALL_HOME"
fi
_DEFAULT_ACCOUNT_CONF_PATH="$LE_WORKING_DIR/account.conf"
if [ -z "$ACCOUNT_CONF_PATH" ] ; then
@ -2743,6 +2773,11 @@ _installalias() {
# nocron
install() {
if [ -z "$LE_WORKING_DIR" ] ; then
LE_WORKING_DIR="$DEFAULT_INSTALL_HOME"
fi
_nocron="$1"
if ! _initpath ; then
_err "Install failed."