Skip to content

feat(installer): block desktop edition installer on handheld devices#167

Open
ptr1337 wants to merge 1 commit intodevelopfrom
block-desktop-installer-on-nvidia
Open

feat(installer): block desktop edition installer on handheld devices#167
ptr1337 wants to merge 1 commit intodevelopfrom
block-desktop-installer-on-nvidia

Conversation

@ptr1337
Copy link
Member

@ptr1337 ptr1337 commented Feb 15, 2026

No description provided.

Signed-off-by: Peter Jung <admin@ptr1337.dev>
Copy link
Contributor

Copilot AI left a 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 adds functionality to block the desktop edition installer when running on handheld devices, improving the user experience by preventing unsupported configurations. The change refactors the edition_compat_check function to detect handheld hardware and enforce edition compatibility rules bidirectionally.

Changes:

  • Refactored edition compatibility checking to detect handheld devices and block desktop edition installation on such hardware
  • Improved error handling by replacing .expect() with proper match statement for profile parsing
  • Added comprehensive translations for the new warning message across all 26 supported languages

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

File Description
src/installer.rs Refactored edition_compat_check function to detect handheld devices, block desktop edition on handheld hardware, and improve error handling
i18n/*/cachyos_hello.ftl (26 files) Added desktop-on-handheld-warning translation key across all supported languages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Ok(profiles) => profiles,
Err(e) => {
error!("Failed to parse handheld profiles: {e}");
return true;
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If parsing handheld profiles fails, the function returns true (allowing installation to proceed). This means that if the profiles file is missing, corrupted, or has parse errors, both the handheld edition compatibility check and the desktop edition blocking check will be bypassed. Consider whether this fail-open behavior is appropriate for security/UX, or if a more conservative approach (returning false to block installation when profiles cannot be loaded) would be safer.

Suggested change
return true;
return false;

Copilot uses AI. Check for mistakes.
Comment on lines +93 to +98
if edition_tag == "handheld" && !is_handheld_device {
ui.show_message(MessageType::Warning, &fl!("unsupported-hw-warning"), message.clone());
return true;
}

if edition_tag.contains("desktop") && is_handheld_device {
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an inconsistency in how edition tags are checked: line 93 uses exact equality (edition_tag == "handheld") while line 98 uses substring matching (edition_tag.contains("desktop")). This means handheld variants like "handheld-steamdeck" would not be caught by the first check but desktop variants like "desktop-kde" would be caught by the second. Consider using .contains("handheld") on line 93 for consistency, or document why exact matching is required for handheld editions.

Copilot uses AI. Check for mistakes.
Comment on lines +73 to +74
let edition_tag =
fs::read_to_string("/etc/edition-tag").unwrap_or("desktop".to_string()).trim().to_string();
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .trim().to_string() pattern is used to clean whitespace from the file content, which is good. However, this is applied inconsistently across the file: line 25 uses .trim().into() while line 74 uses .trim().to_string(). Both accomplish the same thing, but for consistency, consider using the same pattern throughout.

Suggested change
let edition_tag =
fs::read_to_string("/etc/edition-tag").unwrap_or("desktop".to_string()).trim().to_string();
let edition_tag: String =
fs::read_to_string("/etc/edition-tag").unwrap_or("desktop".into()).trim().into();

Copilot uses AI. Check for mistakes.
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