Skip to content

Commit 3b48372

Browse files
committed
added dotenv support to makeself archive creation
1 parent a6ef540 commit 3b48372

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

external.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ARCHIVE_DIR=$(echo "${QUERY}" | jq -r '.archive_dir')
1111
FILE_NAME=$(echo "${QUERY}" | jq -r '.file_name')
1212
LABEL=$(echo "${QUERY}" | jq -r '.label')
1313
STARTUP_SCRIPT=$(echo "${QUERY}" | jq -r '.startup_script')
14+
DOTENV=$(echo "${QUERY}" | jq -r '.dotenv')
1415
NEEDROOT=$(echo "${QUERY}" | jq -r '.needroot')
1516
if [ "${NEEDROOT}" = "true" ]; then
1617
NEEDROOT="--needroot"
@@ -27,8 +28,11 @@ cp -R "${ARCHIVE_DIR}" .
2728
cp "${MAKESELF_BIN}" makeself.sh
2829
cp "${MAKESELF_HEADER_BIN}" makeself-header.sh
2930
chmod +x "$(basename "${ARCHIVE_DIR}")/${STARTUP_SCRIPT}"
31+
if [ -n "${DOTENV}" ]; then
32+
echo "${DOTENV}" > "$(basename "${ARCHIVE_DIR}")/.env"
33+
fi
3034

31-
RUN=( ./makeself.sh --nomd5 --nocrc --tar-extra '--mtime=2019-01-01' --packaging-date '1970-01-01T00:00:00Z' --base64 "${NEEDROOT}" "$(basename "${ARCHIVE_DIR}")" "${FILE_NAME}" "${LABEL}" "./${STARTUP_SCRIPT}" )
35+
RUN=( ./makeself.sh --nomd5 --nocrc --tar-extra '--mtime=2019-01-01' --packaging-date '1970-01-01T00:00:00Z' --base64 ${NEEDROOT} "$(basename "${ARCHIVE_DIR}")" "${FILE_NAME}" "${LABEL}" "./${STARTUP_SCRIPT}" )
3236
echo "${RUN[@]}" >run.log
3337

3438
"${RUN[@]}" >makeself.log 2>&1

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ data "external" "this" {
77

88
archive_dir = abspath(var.source_dir)
99
startup_script = var.source_entrypoint
10+
dotenv = var.source_environment
1011
needroot = var.needroot
1112

1213
label = var.description

variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ variable "source_entrypoint" {
1818
description = "The script to run when the archive is extracted."
1919
}
2020

21+
variable "source_environment" {
22+
type = string
23+
default = ""
24+
25+
description = "Dotenv file to be included into the archive."
26+
}
27+
2128
variable "filename" {
2229
type = string
2330
default = "makeself.run"

0 commit comments

Comments
 (0)