Skip to content

Harden installer disk target validation and live-media exclusion - #29

Merged
youngcoder45 merged 2 commits into
mainfrom
copilot/fix-review-comments
Jul 11, 2026
Merged

Harden installer disk target validation and live-media exclusion#29
youngcoder45 merged 2 commits into
mainfrom
copilot/fix-review-comments

Conversation

CopilotAI commented May 31, 2026

Copy link
Copy Markdown
Contributor

This PR addresses review feedback on installer safety checks in scripts/install.sh. It tightens --disk validation and makes live-boot detection more precise to prevent destructive operations on invalid or active boot media.

  • Disk argument hardening (--disk)

    • Require block device type disk via lsblk -ndo TYPE before accepting --disk.
    • Reject non-disk targets (including partition/symlink-path bypass cases) with clear guidance.
  • Live boot media protection

    • Add is_live_boot_disk() to detect currently booted install media.
    • Apply this check to --disk preselection and reject live medium as install target.
  • Safer live-label matching

    • Replace broad substring matching with anchored/prefix-aware checks for known live labels (ARCHISO, CVH_LINUX_, CODEVERSE_) to avoid excluding unrelated disks.
  • Interactive disk list filtering

    • Add get_installable_disks() and use it in disk selection so live media is excluded from presented candidates.
  • User-facing error formatting

    • Fix spacing/indentation in the rejection message (" Select a different disk.").
# before accepting --diskif [[ "$(lsblk -ndo TYPE "$2"2>/dev/null)"!="disk" ]];thenecho -e "${RED}[ERROR]${NC} '$2' must be a whole-disk device ..."exit 1
fiif is_live_boot_disk "$2";thenecho -e "${RED}[ERROR]${NC} '$2' is the live boot medium. You cannot install to it."echo -e " Select a different disk."exit 1
fi

@youngcoder45
youngcoder45 marked this pull request as ready for review May 31, 2026 10:44
CopilotAI requested a review from a team as a code ownerMay 31, 2026 10:45
CopilotAI changed the title [WIP] Fix code issues from review commentsHarden installer disk target validation and live-media exclusionMay 31, 2026
CopilotAI requested a review from youngcoder45May 31, 2026 10:46
@youngcoder45

Copy link
Copy Markdown
Contributor

@sinisterMage check this

@sinisterMage

Copy link
Copy Markdown
Collaborator

lemme check it out

@sinisterMage

Copy link
Copy Markdown
Collaborator

LGTM, but up to you @youngcoder45

@youngcoder45
youngcoder45 merged commit 2dac08b into mainJul 11, 2026
Sign up for freeto 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.

3 participants

@youngcoder45@sinisterMage