Release Date: 2025-12-29
Previous Version: v0.2.0-alpha.24
Summary
This patch release introduces automatic privilege elevation for self-update operations in nanx. The update mechanism now intelligently detects when elevated permissions are required and automatically re-executes with sudo when necessary, improving the user experience during binary updates on Unix-like systems.
Features
Automatic Privilege Elevation for Self-Updates
- [nanions::self_cmd::update::installer] Implemented automatic permission detection and sudo re-execution for the update command
needs_elevated_permissions() function to detect if the binary location requires elevated access (checks write permissions on parent directory and binary itself)
- Added is_elevated() function to determine if the current process already has root/administrator privileges
- Implemented automatic re-execution with sudo when elevated permissions are needed but not present
- Enhanced error messages to clearly indicate permission issues and guide users
- Supports both Unix-like systems (Linux, macOS) with proper permission checking via std::fs::metadata()
This feature eliminates the common friction point where users would encounter permission denied errors during self-updates and had to manually retry with sudo. The installer now handles this automatically while preserving security by only elevating when actually necessary.
Statistics
| Metric | Value |
|---|
| Commits | 2 |
|---|---|
| Files Changed | 2 |
| Lines | +74 / -1 |
| Issues Closed | 0 |
Contributors
| Name | Commits | Lines |
|---|
| VivinMeth ([email protected]) | 2 | +74 / -1 |
|---|