-
-
Notifications
You must be signed in to change notification settings - Fork 147
fix: check if sudo command is available before using it in install.sh #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: bytemain <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #575 +/- ##
=======================================
Coverage 21.93% 21.93%
=======================================
Files 72 72
Lines 4815 4815
=======================================
Hits 1056 1056
Misses 3662 3662
Partials 97 97 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an installation failure on systems without sudo installed (e.g., minimal containers, embedded systems) by adding a check for sudo availability before attempting to use it.
Key Changes:
- Add conditional check using
command -v sudoto detect if sudo is available - Set
SUDO_CMDto empty string when sudo is not found, allowing installation to proceed if user already has write permissions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Check if sudo is available | ||
| if command -v sudo &> /dev/null; then | ||
| SUDO_CMD="sudo" | ||
| else |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When sudo is not available, the script silently sets SUDO_CMD to empty string without informing the user. This could lead to confusing permission errors later (lines 88-92, 95-103) if the user doesn't have write permissions to /usr/local/bin. Consider adding a warning message here to inform users that sudo is not available and they will need appropriate permissions to install to /usr/local/bin.
| else | |
| else | |
| echo "Warning: 'sudo' command not found. Proceeding without sudo." | |
| echo "Installation directory is '${INSTALL_DIR}'. Ensure you have write permissions to this directory (for example, run this script as root)." |
install.shfails on systems withoutsudoinstalled (minimal containers, embedded systems) withsudo: command not found.Changes
command -v sudocheck before settingSUDO_CMDOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.