#!/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" <