48 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| #
 | |
| # https://github.com/acmesh-official/acme.sh
 | |
| #
 | |
| # A humble wrapper script to the acme.sh tool which have to exist
 | |
| # somewhere in PATH. Sets the tool to use this service's config
 | |
| # and log files.
 | |
| #
 | |
| # Author: Kovács Zoltán <kovacs.zoltan@smartfront.hu>
 | |
| #         Kovács Zoltán <kovacsz@marcusconsulting.hu>
 | |
| # License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html)
 | |
| # 2023-06-18 v1.0
 | |
| # new: forked from the "Smartfront's DOCKER_skeleton" repository.
 | |
| # 2021-09-14 v0.1 Initial release
 | |
| 
 | |
| # Messages.
 | |
| #
 | |
| MSG_MISSINGTOOL="Fatal: missing socket relay tool"
 | |
| MSG_MISSINGWORKER="Fatal: missing worker script"
 | |
| 
 | |
| # Where I'm?
 | |
| #
 | |
| SCRPATH="$( cd -P "$( "$(which dirname)" "$0" )" && echo "$PWD" )"
 | |
| [[ -z "$SCRPATH" ]] && exit 1
 | |
| 
 | |
| # Where is the service's base?
 | |
| #
 | |
| SERVICE="$( cd -P "$( "$(which dirname)" "$SCRPATH" )" && echo "$PWD" )"
 | |
| [[ -z "$SERVICE" ]] && exit 1
 | |
| 
 | |
| # Checks the worker components.
 | |
| #
 | |
| ACME="$(PATH="$SCRPATH:$PATH" which acme.sh)"
 | |
| if [ -z "$ACME" -o ! -x "$ACME" ]; then 
 | |
|     echo -e "$MSG_MISSINGWORKER acme.sh" >&2; exit 1
 | |
| fi
 | |
| SOCAT="$(PATH="$SCRPATH:$PATH" which socat)"
 | |
| if [ -z "$SOCAT" -o ! -x "$SOCAT" ]; then 
 | |
|     echo -e "$MSG_MISSINGTOOL socat" >&2; exit 1
 | |
| fi
 | |
| 
 | |
| # Finally launches the worker with the original command line parameters.
 | |
| #
 | |
| export LE_WORKING_DIR="$SERVICE/configs/acme"
 | |
| export LE_CONFIG_HOME="$SERVICE/configs/acme"
 | |
| export LOG_FILE="$SERVICE/logs/web/acme.log"
 | |
| "$ACME" "$@"
 |