diff --git a/functions.sh b/functions.sh index 6ce72d0..a78f40f 100644 --- a/functions.sh +++ b/functions.sh @@ -1,18 +1,18 @@ #!/usr/bin/env bash CERT_DIR=~/.letsencrypt_drupal -TMP_DIR=/tmp/letsencrypt_drupal +TMP_DIR=/tmp/letsencrypt_drupal_${PROJECT_NAME} FILE_BASECONFIG=${TMP_DIR}/baseconfig FILE_DRUSH_ALIAS=${TMP_DIR}/drush_alias FILE_DRUPAL_VERSION=${TMP_DIR}/drupal_version FILE_PROJECT_ROOT=${TMP_DIR}/project_root +LOCK_FILENAME=/tmp/cert_renew_lock_${PROJECT_NAME} #--------------------------------------------------------------------- acquire_lock_or_exit() { # Check we are not running already: http://mywiki.wooledge.org/BashFAQ/045 - # @ToDo: Platform specific lock. - exec 8>/tmp/cert_renew_lock + exec 8>${LOCK_FILENAME} if ! flock -n 8 ; then logline "Another instance of this script running."; exit 1 diff --git a/letsencrypt_drupal.sh b/letsencrypt_drupal.sh index ab383dd..6785998 100755 --- a/letsencrypt_drupal.sh +++ b/letsencrypt_drupal.sh @@ -11,15 +11,23 @@ # ** 7|8 # * Path to project root # ** Must contain letsencrypt_drupal folder. See readme. +# * Switches for Dehydrated +# ** Pass through these command line args to Dehydrated. OK if blank. # Basic variables. DRUSH_ALIAS="$1" DRUPAL_VERSION="$2" PROJECT_ROOT="$3" +DEHYDRATED_SWITCHES="$4" DRUSH_ALIAS_NO_AT="${DRUSH_ALIAS/@/}" + +# We need to export these variables so functions.sh can use them. +export PROJECT_NAME=$(echo "$DRUSH_ALIAS_NO_AT" | cut -d'.' -f1) +export PROJECT_ENV=$(echo "$DRUSH_ALIAS_NO_AT" | cut -d'.' -f2) + CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -DEHYDRATED="https://github.com/lukas2511/dehydrated.git" +DEHYDRATED="https://github.com/dehydrated-io/dehydrated.git" FILE_DOMAINSTXT=${PROJECT_ROOT}/letsencrypt_drupal/domains_${DRUSH_ALIAS_NO_AT}.txt FILE_CONFIG=${PROJECT_ROOT}/letsencrypt_drupal @@ -102,7 +110,7 @@ main() { echo ${DRUPAL_VERSION} > ${FILE_DRUPAL_VERSION} echo ${PROJECT_ROOT} > ${FILE_PROJECT_ROOT} - ${CURRENT_DIR}/dehydrated/dehydrated --config ${FILE_BASECONFIG} --cron --accept-terms + ${CURRENT_DIR}/dehydrated/dehydrated --config ${FILE_BASECONFIG} --cron --accept-terms ${DEHYDRATED_SWITCHES} } self_update