Skip to content

feat: create .bashrc by default#2146

Merged
RohitKushvaha01 merged 1 commit into
mainfrom
RohitKushvaha01-patch-4
Jun 3, 2026
Merged

feat: create .bashrc by default#2146
RohitKushvaha01 merged 1 commit into
mainfrom
RohitKushvaha01-patch-4

Conversation

@RohitKushvaha01
Copy link
Copy Markdown
Member

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 3, 2026

Greptile Summary

This PR adds creation of an empty ~/.bashrc (resolved to /public/.bashrc given HOME=/public) during the --installing phase, ensuring the file is present for new users who want to customize their shell environment via the hook that initrc already has.

  • Scope limited to new installs: the guard lives inside the --installing branch, so existing users who upgrade without a .bashrc won't get one created automatically — they must reinstall or create it manually.
  • Empty file creation: the resulting .bashrc is empty, which is consistent with the initrc comment directing users to add their own customizations there.

Confidence Score: 4/5

Safe 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 .bashrc sourcing already in initrc. The main gap is that upgrading users without a .bashrc won't benefit, but that is a limitation rather than a breakage.

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

Filename Overview
src/plugins/terminal/scripts/init-alpine.sh Adds creation of an empty ~/.bashrc (at /public/.bashrc) during the --installing phase; only new installs benefit, existing users upgrading without a .bashrc are unaffected

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]
Loading

Reviews (1): Last reviewed commit: "feat: create .bashrc by default" | Re-trigger Greptile

Comment on lines +46 to 50
if [ ! -f "$HOME/.bashrc" ]; then
touch "$HOME/.bashrc" && chmod 644 "$HOME/.bashrc"
fi

echo "Installation completed."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
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!

Comment on lines +46 to +48
if [ ! -f "$HOME/.bashrc" ]; then
touch "$HOME/.bashrc" && chmod 644 "$HOME/.bashrc"
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
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!

@RohitKushvaha01 RohitKushvaha01 merged commit e0eafd0 into main Jun 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant