fix(install): cover a non-login interactive bash
~/.bashrc was only appended to when it already existed, so on an account without one — a fresh container, a minimal image — `bash -i`, which is what most Linux terminal emulators start, did not see the toolchain even though every other shell did. .bashrc is now created when missing. Unlike .bash_profile, whose existence stops bash reading ~/.profile, a .bashrc that only sources the env file changes nothing else about how bash starts. Verified across zsh -i, zsh -c, bash -l, bash -i, sh -l and dash -l on a staged HOME: all six resolve ludic, a second run writes nothing, and .bash_profile is still never created. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
a916fa5118
commit
bfa763a55b
2 changed files with 15 additions and 3 deletions
7
changes/bashrc-noninteractive.md
Normal file
7
changes/bashrc-noninteractive.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
bump: patch
|
||||||
|
type: fix
|
||||||
|
The installer also covers a non-login interactive `bash` — the shell most Linux
|
||||||
|
terminal emulators start, which reads only `~/.bashrc`. That file is now created
|
||||||
|
when it is missing (its presence changes nothing else about how bash starts),
|
||||||
|
while `~/.bash_profile` is still only appended to when it already exists, since
|
||||||
|
creating that one would stop bash reading `~/.profile`.
|
||||||
11
install.sh
11
install.sh
|
|
@ -267,7 +267,7 @@ add_line() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
mkdir -p "$(dirname "$_file")" 2>/dev/null || true
|
mkdir -p "$(dirname "$_file")" 2>/dev/null || true
|
||||||
printf '\n# ludic\n%s\n' "$_line" >> "$_file" || {
|
printf '\n# ludic\n%s\n' "$_line" >> "$_file" 2>/dev/null || {
|
||||||
warn "could not write ${_file}"
|
warn "could not write ${_file}"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -281,9 +281,14 @@ add_to_path() {
|
||||||
|
|
||||||
add_line "${HOME}/.profile" "$_posix"
|
add_line "${HOME}/.profile" "$_posix"
|
||||||
add_line "${ZDOTDIR:-$HOME}/.zshenv" "$_posix"
|
add_line "${ZDOTDIR:-$HOME}/.zshenv" "$_posix"
|
||||||
# bash: only files that already exist, so we never shadow ~/.profile
|
# bash reads ~/.bashrc for a non-login interactive shell — what most Linux
|
||||||
|
# terminal emulators start — and it is safe to create, since its presence
|
||||||
|
# changes nothing else. ~/.bash_profile is only appended to when it already
|
||||||
|
# exists: creating that one would stop bash reading ~/.profile.
|
||||||
[ -f "${HOME}/.bash_profile" ] && add_line "${HOME}/.bash_profile" "$_posix"
|
[ -f "${HOME}/.bash_profile" ] && add_line "${HOME}/.bash_profile" "$_posix"
|
||||||
[ -f "${HOME}/.bashrc" ] && add_line "${HOME}/.bashrc" "$_posix"
|
if [ -f "${HOME}/.bashrc" ] || have bash; then
|
||||||
|
add_line "${HOME}/.bashrc" "$_posix"
|
||||||
|
fi
|
||||||
if have fish || [ -f "${HOME}/.config/fish/config.fish" ]; then
|
if have fish || [ -f "${HOME}/.config/fish/config.fish" ]; then
|
||||||
add_line "${HOME}/.config/fish/config.fish" "source \"${INSTALL_DIR}/env.fish\""
|
add_line "${HOME}/.config/fish/config.fish" "source \"${INSTALL_DIR}/env.fish\""
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue