From: Lukas Schauer Date: Mon, 7 Dec 2015 10:21:26 +0000 (+0100) Subject: use absolute path of script directory as default BASEDIR, remove trailing slash from... X-Git-Tag: v0.1.0~194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=401f5f75971a0a25e2cf85ef8af71f1f8e7ecbf5;p=thirdparty%2Fdehydrated.git use absolute path of script directory as default BASEDIR, remove trailing slash from BASEDIR --- diff --git a/letsencrypt.sh b/letsencrypt.sh index 0756aee..52ba5cb 100755 --- a/letsencrypt.sh +++ b/letsencrypt.sh @@ -4,7 +4,7 @@ set -e set -u set -o pipefail -# default config values +# Default config values CA="https://acme-v01.api.letsencrypt.org" LICENSE="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf" HOOK_CHALLENGE= @@ -12,12 +12,16 @@ RENEW_DAYS="14" KEYSIZE="4096" WELLKNOWN=".acme-challenges" PRIVATE_KEY_RENEW=no -BASEDIR="./" +BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -if [[ -e "config.sh" ]]; then - . ./config.sh +# If exists load config from same directory as this script +if [[ -e "${BASEDIR}/config.sh" ]]; then + . "${BASEDIR}/config.sh" fi +# Remove slash from end of BASEDIR. Mostly for cleaner outputs, doesn't change functionality. +BASEDIR="${BASEDIR%%/}" + umask 077 # paranoid umask, we're creating private keys anti_newline() {