Skip to content

chore: Consolidate mount-generator for HostOS and GuestOS#9324

Open
shilingwang wants to merge 1 commit intomasterfrom
shiling/tool-consolidate
Open

chore: Consolidate mount-generator for HostOS and GuestOS#9324
shilingwang wants to merge 1 commit intomasterfrom
shiling/tool-consolidate

Conversation

@shilingwang
Copy link
Contributor

@shilingwang shilingwang commented Mar 12, 2026

#NODE-1412

Consolidate mount-generator for HostOS and GuestOS

The mount-generator systemd generator script was maintained as two nearly identical copies:
upgrade/systemd-generators/hostos/mount-generator
upgrade/systemd-generators/guestos/mount-generator

Both shared the same structure, boilerplate, and /boot mount logic. Only two things differed:
Boot device: HostOS uses LVM volumes (/dev/hostlvm/A_boot), GuestOS uses partition UUIDs (/dev/disk/by-partuuid/...)
/var setup: HostOS uses a plain ext4 LVM-backed mount (var-setup.service + var.mount), GuestOS uses LUKS encryption (systemd-cryptsetup@var_crypt.service)

Changes

  1. Merged both scripts into a single upgrade/systemd-generators/mount-generator
  2. Added two identity files (os-type-hostos, os-type-guestos) installed to /etc/ic/os-type at image build time — the merged script reads this file to branch on OS-specific behavior
  3. Updated hostos.bzl and guestos.bzl to point to the shared script and install the appropriate identity file
  4. Deleted the now-redundant hostos/mount-generator and guestos/mount-generator

How the identity is passed

component_files in hostos.bzl / guestos.bzl already maps source files to destination paths inside the image. The two os-type-* files are both installed to /etc/ic/os-type in their respective images, but with different content (hostos or guestos). This is the same pattern already used elsewhere (e.g. setup-ssh-user-keys-hostos.sh / setup-ssh-user-keys-guestos.sh → same destination path).

@github-actions github-actions bot added the chore label Mar 12, 2026
@shilingwang shilingwang marked this pull request as ready for review March 12, 2026 11:01
@shilingwang shilingwang requested a review from a team as a code owner March 12, 2026 11:01
@github-actions github-actions bot added the @node label Mar 12, 2026
@shilingwang shilingwang requested a review from Bownairo March 12, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant