feat: create .bashrc by default#2146
Conversation
Greptile SummaryThis PR adds creation of an empty
Confidence Score: 4/5Safe to merge — the change is small, idempotent, and does not affect existing files or the normal startup path. The new code only runs during installation, touches no existing files, and pairs naturally with the src/plugins/terminal/scripts/init-alpine.sh — specifically whether the .bashrc creation should also live in the normal startup branch for existing users. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[init-alpine.sh invoked] --> B{arg == --installing?}
B -- Yes --> C[Configure timezone]
C --> D[mkdir -p PREFIX/.configured]
D --> E{HOME/.bashrc exists?}
E -- No --> F[touch HOME/.bashrc\nchmod 644 HOME/.bashrc]
F --> G[echo Installation completed\nexit 0]
E -- Yes --> G
B -- No --> H{No args?}
H -- Yes --> I[Write PID, create MOTD\ncreate acode CLI, create initrc]
I --> J[Source initrc via bash --rcfile]
J --> K{HOME/.bashrc exists?}
K -- Yes --> L[source HOME/.bashrc]
K -- No --> M[Skip .bashrc sourcing]
H -- No --> N[exec args directly]
Reviews (1): Last reviewed commit: "feat: create .bashrc by default" | Re-trigger Greptile |
| if [ ! -f "$HOME/.bashrc" ]; then | ||
| touch "$HOME/.bashrc" && chmod 644 "$HOME/.bashrc" | ||
| fi | ||
|
|
||
| echo "Installation completed." |
There was a problem hiding this comment.
The
.bashrc is created only in the --installing branch, which runs once at first setup. Users who already have $PREFIX/.configured (i.e., existing installs) and no .bashrc will never hit this path on upgrade — they'd need to reinstall or create the file manually. Moving this guard into the normal startup path ($# -eq 0) would ensure every user gets a .bashrc regardless of when they installed.
| if [ ! -f "$HOME/.bashrc" ]; then | |
| touch "$HOME/.bashrc" && chmod 644 "$HOME/.bashrc" | |
| fi | |
| echo "Installation completed." | |
| if [ ! -f "$HOME/.bashrc" ]; then | |
| touch "$HOME/.bashrc" && chmod 644 "$HOME/.bashrc" | |
| fi | |
| echo "Installation completed." | |
| # NOTE: also add the same guard in the "$#" -eq 0 branch so that | |
| # existing users who upgrade without a .bashrc get one on next start. |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| if [ ! -f "$HOME/.bashrc" ]; then | ||
| touch "$HOME/.bashrc" && chmod 644 "$HOME/.bashrc" | ||
| fi |
There was a problem hiding this comment.
The
touch line uses 7-space indentation (3 spaces inside the if) while the rest of the --installing block uses 4-space indentation. Consistent 4-space inner indentation (8 spaces total) would match the surrounding code style.
| if [ ! -f "$HOME/.bashrc" ]; then | |
| touch "$HOME/.bashrc" && chmod 644 "$HOME/.bashrc" | |
| fi | |
| if [ ! -f "$HOME/.bashrc" ]; then | |
| touch "$HOME/.bashrc" && chmod 644 "$HOME/.bashrc" | |
| fi |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
No description provided.