Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ main() {
else
log_info "Running 'nixopus install' with options: ${cli_args[*]}"
fi
nixopus install "${cli_args[@]}"
if [ $EUID -ne 0 ]; then
sudo nixopus install "${cli_args[@]}"
else
nixopus install "${cli_args[@]}"
fi
Comment on lines +430 to +434
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

log_success "nixopus install completed successfully!"
else
log_info "Skipping 'nixopus install' as requested..."
Expand Down