Mess around with .env handling

This commit is contained in:
Radon Rosborough 2021-07-04 15:35:54 +00:00
parent 7149f817a6
commit 80141ce683
5 changed files with 47 additions and 3 deletions

View File

@ -2,4 +2,10 @@
set -euo pipefail
exec node "$(dirname "$(realpath "$0")")"/../tools/depgraph.js "$@"
root="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
set -a
. "${root}/.env"
set +a
exec node "${root}/tools/depgraph.js" "$@"

View File

@ -2,7 +2,13 @@
set -euo pipefail
export PATH="$(sed -E 's/:bin:/:/; s/(^|:)bin(:|$)//' <<< "${PATH}")"
root="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
export PATH="$(sed -E "s_:${root}/bin:_:_; s_(^|:)${root}/bin(:|$)__" <<< "${PATH}")"
set -a
. "${root}/.env"
set +a
if [[ "${OSTYPE:-}" != darwin* ]] && [[ "${EUID}" != 0 ]]; then
exec sudo -E docker "$@"

13
bin/packer Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
export PATH="$(sed -E "s_:${root}/bin:_:_; s_(^|:)${root}/bin(:|$)__" <<< "${PATH}")"
set -a
. "${root}/.env"
set +a
exec packer "$@"

View File

@ -2,7 +2,13 @@
set -euo pipefail
export PATH="$(sed -E 's/:bin:/:/; s/(^|:)bin(:|$)//' <<< "${PATH}")"
root="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
export PATH="$(sed -E "s_:${root}/bin:_:_; s_(^|:)${root}/bin(:|$)__" <<< "${PATH}")"
set -a
. "${root}/.env"
set +a
if [[ "${OSTYPE:-}" != darwin* ]] && [[ "${EUID}" != 0 ]]; then
exec sudo -E skopeo "$@"

13
bin/terraform Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
export PATH="$(sed -E "s_:${root}/bin:_:_; s_(^|:)${root}/bin(:|$)__" <<< "${PATH}")"
set -a
. "${root}/.env"
set +a
exec terraform "$@"