-
-
Notifications
You must be signed in to change notification settings - Fork 114
fix: run with sudo for normal users #888
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
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom Pre-merge Checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||
|
LGTM! |
| if [ $EUID -ne 0 ]; then | ||
| sudo nixopus install "${cli_args[@]}" | ||
| else | ||
| nixopus install "${cli_args[@]}" | ||
| fi |
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.
Lets exit and throw error if not root.
For installing docker and setting related permissions for docker and docker daemon, we need root permission mandatorily.
nixopus install works fine if docker is already there, but if docker is not installed, then we have to run with sudo.
So advised to run it as sudo. If you check docs, here also by default we expect user to run the script with sudo.
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.
Without this escalation, normal users would fail midway because certain installs require root.
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.
even after we enter sudo password, it doesn't continue installation.
to fix that, sudo is added here.
User description
Issue
Failed to install openssh-server error when it is already installed and running through apt #886
Description
In scripts/install.sh at line 430, the command
nixopus install "${cli_args[@]}" is executed without sudo privileges. This causes failures when installing system packages like openssh-server, even though the Python code indeps.py uses sudo for individual package commands.Scope of Change
Select all applicable areas impacted by this PR:
Screenshot / Video / GIF (if applicable)
before fix:

after fix:

Developer Checklist
To be completed by the developer who raised the PR.
Reviewer Checklist
To be completed by the reviewer before merge.
PR Type
Bug fix
Description
Add sudo privilege check for normal users in install script
Execute nixopus install with sudo when EUID is not root
Prevent permission failures for system package installations
Diagram Walkthrough
flowchart LR A["Check EUID"] --> B{Is root?} B -->|No| C["Execute with sudo"] B -->|Yes| D["Execute without sudo"] C --> E["nixopus install"] D --> EFile Walkthrough
install.sh
Add conditional sudo execution for install commandscripts/install.sh
nixopus installwithsudowhen EUID is not 0Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.