Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Support for multiple projects #5

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions functions.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 10 additions & 2 deletions letsencrypt_drupal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down