Merge pull request #2356 from alexbelgium/codex/define-home-in-global-and-config-templates

Ensure HOME exists before writing user shell files and guard HOME usage
This commit is contained in:
Alexandre
2026-01-11 08:50:17 +01:00
committed by GitHub
2 changed files with 10 additions and 4 deletions

View File

@@ -301,11 +301,14 @@ done
update_scripts_with_block
# --- MINIMAL CHANGE: also inject into /etc/bash.bashrc (for interactive bash shells)
mkdir -p /etc "$HOME"
mkdir -p /etc
touch "/etc/bash.bashrc"
touch "$HOME/bash.bashrc"
inject_block_into_file "/etc/bash.bashrc"
inject_block_into_file "$HOME/bash.bashrc"
if [[ -n "${HOME:-}" ]]; then
mkdir -p "$HOME"
touch "$HOME/bash.bashrc"
inject_block_into_file "$HOME/bash.bashrc"
fi
################
# Set timezone #

View File

@@ -205,7 +205,10 @@ while IFS= read -r line; do
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi
# Persist for interactive shells
append_unique_line "$HOME/.bashrc" "export $line"
if [[ -n "${HOME:-}" ]]; then
mkdir -p "$HOME"
append_unique_line "$HOME/.bashrc" "export $line"
fi
append_unique_line "/etc/bash.bashrc" "export $line"
# Show in log