commit 17f019c4871a371619c4aea33c7cc99de94525be parent 308444365601e967584dfc2acf3afac600699767 Author: Jan Pobrislo <ccx@te2000.cz> Date: Sun, 26 Oct 2025 20:02:58 +0000 Generalize environment variable setup using .env-template Diffstat:
| M | command/pthbs-enter-gen | | | 16 | +++++++++++----- |
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/command/pthbs-enter-gen b/command/pthbs-enter-gen @@ -23,12 +23,18 @@ if ! test -d "$envcommand"; then fi printf '%s\n' "$envcommand" >"$envdir/PATH" -if test -d "$envtop/zsh"; then - printf '%s\n' "$envtop/zsh/site-functions:$envtop/zsh/functions" >"$envdir/FPATH" -fi -if test -d "$envtop/library/pkgconfig"; then - printf '%s\n' "$envtop/library/pkgconfig" >"$envdir/PKG_CONFIG_LIBDIR" +if test -d "$envtop/.env-template"; then + for f in "$envtop/.env-template"/*; do + if ! test -f "$f"; then + case "$f" in + ($envtop/.env-template/\*) continue;; + esac + printf >2 'Error: expected plain file while generating env: %s\n' "$f" + exit 1 + fi + sed "s|@ENVROOT@|$envtop" <"$f" >"$envdir/${f##*/}" + done fi mkscript() {