Skip to content

Conversation

@mjun0812
Copy link
Owner

@mjun0812 mjun0812 commented Dec 16, 2025

Overview

Implemented a feature to dynamically determine the command prefix based on execution privileges, avoiding unnecessary sudo commands when already running with root privileges in container environments or similar.

Changes

  • Added the hasRootPrivileges() function to determine if running with root/administrator privileges.
  • Implemented the getSudoPrefix() function to return 'sudo' only when necessary.
  • Updated installCudaLinuxLocal() to use the dynamic sudo prefix.
  • Updated all package manager commands in installCudaLinuxNetwork() to use the dynamic sudo prefix.
  • Removed hardcoded 'sudo' from the container test workflow.

How to Test

  1. Run in an environment with root privileges (e.g., a container) and confirm that sudo is not prepended.
  2. Run in a standard user privilege environment and confirm that sudo is correctly prepended.
  3. Ensure existing CI tests pass successfully.

- Add hasRootPrivileges() function to check if running with root/admin privileges
- Implement getSudoPrefix() to return 'sudo' only when needed
- Update installCudaLinuxLocal() to use dynamic sudo prefix
- Update installCudaLinuxNetwork() to use dynamic sudo prefix for all package manager commands
- Remove hardcoded 'sudo' from container test workflow
@mjun0812 mjun0812 changed the title feat: root権限に基づく動的なsudoプレフィックスへの切り替え feat: Switching to dynamic sudo prefix based on root privileges Dec 16, 2025
- Add 'needs' dependency to Test job to ensure quality checks pass before running tests
- Update compiled distribution files to reflect source code changes for dynamic sudo prefix
@mjun0812 mjun0812 merged commit 614b359 into main Dec 16, 2025
17 checks passed
@mjun0812 mjun0812 deleted the feat/switch-sudo-prefix branch December 16, 2025 13:12
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