From f75fdbebaebcc5fc434897e749cbd11a0e5d4457 Mon Sep 17 00:00:00 2001 From: Brian Bennett Date: Thu, 30 Sep 2021 13:21:57 -0700 Subject: [PATCH] Additional fixes to deal with X3 EOL (#55) Reviewed by: Dan McDonald --- Makefile | 8 +++--- README.md | 6 +++++ cns-hook | 7 ++++- dehydrated | 75 +++++++++++------------------------------------------- 4 files changed, 32 insertions(+), 64 deletions(-) diff --git a/Makefile b/Makefile index ec44d11..5767547 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ VERSION= $(shell git tag --sort=taggerdate | tail -1) # Prevent macOS from putting resource forks in the tar export COPYFILE_DISABLE=true -.PHONY: archive release +.PHONY: archive patch release subclean archive: $(ARCHIVE) release: clean .version $(ARCHIVE) @@ -29,8 +29,10 @@ $(SCRIPT): # This is a temporary hack to work around an upstream bug. We want a better # way to handle this. patch: $(SCRIPT) - git submodule foreach --recursive git reset --hard patch -p1 $< < PATCHES/000-fix-grep.patch -clean: +subclean: + git submodule foreach --recursive git reset --hard + +clean: subclean rm .version $(ARCHIVE) || true diff --git a/README.md b/README.md index 7a67efe..a897fb8 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,12 @@ [dehydrated](https://github.com/lukas2511/dehydrated) hook script to set up certificates automatically for Triton, using DNS challenges. Requires CNS. +## Before You Begin + +Due to recent changes with dehydrated upstream, you will either need to run +this on platform `20200423` or later, *or* have `grep` (i.e., gnu-grep) +installed from pkgsrc or pkgsrc-tools. + ## How to use: headnode services (CloudAPI etc) 1. Set up CNS in your Triton deployment (see diff --git a/cns-hook b/cns-hook index 1a56aa9..88cc81c 100755 --- a/cns-hook +++ b/cns-hook @@ -1,12 +1,17 @@ #!/usr/bin/env bash +# Ensure BSEDIR is relative to this script. +BASEDIR="${BASH_SOURCE[0]%/*}" + source "${BASEDIR}/cns-hook-util" if [[ -f "${BASEDIR}/override-hook" ]]; then + # shellcheck disable=SC1091 source "${BASEDIR}/override-hook" fi # Protection for unknown functions, required by dehydrated. -valid_passthrough_hooks=$(grep function ${BASEDIR}/cns-hook-util | awk '{print $2}') +# shellcheck source=cns-hook-util +valid_passthrough_hooks=$(grep function "${BASEDIR}/cns-hook-util" | awk '{print $2}') handler="$1" shift diff --git a/dehydrated b/dehydrated index 8e4073f..bef27f3 100755 --- a/dehydrated +++ b/dehydrated @@ -9,76 +9,31 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli done SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -export PATH="/opt/smartdc/bin:$PATH" +export PATH="/opt/smartdc/bin:/opt/tools/bin:/opt/local/bin:$PATH" export CURL_CA_BUNDLE="$SCRIPTDIR/cacert.pem" if [ ! -f "$SCRIPTDIR/cacert.pem" ]; then cat >"$SCRIPTDIR/cacert.pem" <