On an Omarchy laptop bootstrap left two of almost everything: VS Code from both pacman and the tarball (two menu entries, one shared ~/.config/Code profile), and kubectl/helm/k9s/kubectx/yq/jq/node/ansible in ~/.local/bin behind mise and pacman copies that always won on PATH. The zsh helpers (op*, grmb, secrets.env) also never reached the bash login shell. - lib/fetch.sh: add `shadowed`, true when another copy of a tool comes earlier on PATH than ~/.local/bin. Always false where zshrc puts ~/.local/bin first, so VM installs are unchanged. - bin/, node/, ansible/: skip tools that are shadowed. - vscode/: defer to any system `code`, and remove a tarball copy this module installed earlier. - bash/: new module; bash port of the zshrc helpers, sourced from ~/.bashrc via a marked block. No-ops without ~/.bashrc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.5 KiB
Bash
Executable File
48 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# bash/install.sh — give bash the dotfiles shell helpers (opr/opc/opd/opl/ops,
|
|
# grmb, and secrets.env loading).
|
|
#
|
|
# WHY: those helpers lived only in the managed ~/.zshrc, so on a host that
|
|
# keeps bash as its login shell they silently did not exist. Omarchy is that
|
|
# host: it ships its own ~/.bashrc and default rc, and zsh/ cannot install zsh
|
|
# there (no dnf/apt). secrets/ still wrote secrets.env, but nothing loaded it,
|
|
# so every vault-backed variable was simply unset in new shells.
|
|
#
|
|
# Unlike zsh/, this never owns ~/.bashrc -- the host's rc stays in charge. It
|
|
# copies bash/dotfiles.bash to ~/.config/dotfiles/ and adds one marked source
|
|
# line, the same pattern mcp-config/ uses. Skipped when there is no ~/.bashrc
|
|
# (a zsh-only box has no use for it). No sudo. Idempotent.
|
|
set -eu
|
|
|
|
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
|
|
|
say() { printf '%s\n' "$*" >&2; }
|
|
|
|
BASHRC="$HOME/.bashrc"
|
|
CONF_DIR="$HOME/.config/dotfiles"
|
|
DEST="$CONF_DIR/dotfiles.bash"
|
|
MARK_BEGIN="# >>> dotfiles helpers >>>"
|
|
MARK_END="# <<< dotfiles helpers <<<"
|
|
|
|
if [ ! -f "$BASHRC" ]; then
|
|
say "bash: no $BASHRC; skipping."
|
|
exit 0
|
|
fi
|
|
|
|
mkdir -p "$CONF_DIR"
|
|
chmod 700 "$CONF_DIR"
|
|
install -m 0644 "$SCRIPT_DIR/dotfiles.bash" "$DEST"
|
|
say "bash: wrote $DEST"
|
|
|
|
if grep -qxF "$MARK_BEGIN" "$BASHRC"; then
|
|
say "bash: $BASHRC already sources it."
|
|
else
|
|
cat >>"$BASHRC" <<EOF
|
|
|
|
$MARK_BEGIN
|
|
[ -f "\$HOME/.config/dotfiles/dotfiles.bash" ] && . "\$HOME/.config/dotfiles/dotfiles.bash"
|
|
$MARK_END
|
|
EOF
|
|
say "bash: added a source line to $BASHRC (open a new shell to pick it up)."
|
|
fi
|