SPDX-FileCopyrightText: (C) 2026 Intel Corporation
SPDX-License-Identifier: Apache-2.0
name: create-usb-installation-files description: Package bootable USB installation artifacts (HookOS, host image, deployment scripts) from an ICT image, Ubuntu ISO, or previously built image.
Trigger Phrases
- create usb installation files
- build usb-installation-files.tar.gz
- package usb artifacts
- create bootable usb bundle
- build artifacts from ict image
- image from tool
- image composer
- from iso
- iso url
Required Inputs
- enib_home: absolute path to this repository root
- build_mode:
image-from-iso|image-from-tool|reuse-image(auto-infer when possible) - Inputs collected only after mode is confirmed (collect only those relevant to the selected mode):
image-from-tool:ict_img— absolute path to.raw.gzor.raw.img.gzimage (optional whencreate-imageis run in same session)image-from-iso:iso_url— Ubuntu ISO URLreuse-image: no extra inputs required
- Additional inputs for
image-from-toolonly whenict_imgis not already provided:create_image_first:yes|nowork_template: ICT working template nametarget_template: source ICT template path (default:infrastructure/host-os/ict/ubuntu24-x86_64-minimal-ptl.yml)os_image_composer_repo: clone path for image-composer-tool (example:<enib_home>/tools/image-composer-tool)
- run_ven_deployment_check:
yes|no(ask user whether to runsudo ./ven-deployment.shafter artifact creation)
Preconditions
- Repository exists and is writable:
test -d <enib_home> && test -w <enib_home> - Build entrypoints exist:
test -f <enib_home>/Makefiletest -f <enib_home>/infrastructure/build-artifacts/build-installation-artifacts.sh
- If
ict_imgprovided, verify it exists and has valid extension:test -f <ict_img>- extension matches
*.raw.gz|*.raw.img.gz
- Infer
build_modefrom user input when unambiguous:- mentions
ict,image from tool, orimage composer->image-from-tool - mentions
from isoor provides an ISO URL/path (*.iso,http(s)://...*.iso) ->image-from-iso
- mentions
- Ask user to choose mode only when inference is ambiguous or conflicting.
- If
build_mode=image-from-toolandcreate_image_first=yes, run all preconditions fromcreate-imageskill. - If
build_mode=image-from-toolandict_imgwas NOT already provided:- probe for existing images at the expected first-time ICT output location (
<os_image_composer_repo>/workspace/ubuntu-ubuntu24-x86_64/imagebuild/<config-name>/) - capture timestamps with
statand ask user one informed question to reuse or rebuild.
- probe for existing images at the expected first-time ICT output location (
- If
build_mode=image-from-toolandict_imgwas already provided: skip reuse/rebuild prompt and use the given path directly. - Prompt for
sudoconfirmation only before destructive operations: disk wipe, partition table changes, or build commands that overwrite the output directory. Do not prompt for non-destructivesudocommands such asapt install. - Sudo probe (MANDATORY before any step that runs
sudo, includingsudo tar,sudo ./ven-deployment.sh, or any privilegedmake buildsubstep): runsudo -n true. If exit is non-zero, stop and instruct the user to runsudo -vin their terminal (or add a scopedNOPASSWDentry in/etc/sudoers.d/for the specific binary), then re-trigger the skill. Ifsudo -vwas already run butsudo -n truestill fails, the user must make sudo timestamps global (tty_tickets issue):echo 'Defaults timestamp_type=global' | sudo tee /etc/sudoers.d/agent-timestamp && sudo chmod 0440 /etc/sudoers.d/agent-timestamp && sudo visudo -c. See AGENTS.md.
Steps
- Collect required inputs and determine flow:
- Infer
build_modefrom user wording when possible (ict/image from tool/image composer=>image-from-tool;from isoor ISO URL =>image-from-iso). - Ask user to choose mode only if no unambiguous inference is possible.
- Once mode is confirmed, collect only inputs required for that mode (do not ask for unrelated inputs).
- Flow A (
build_mode=image-from-tool):- If
ict_imgwas already provided by the user: use it directly without any reuse/rebuild prompt. - If
ict_imgwas NOT provided: probe expected ICT output path, show found image(s) with timestamps, ask one question to reuse or rebuild. - If rebuilding or no image found and
create_image_first=yes: runcreate-imageskill, then collect artifact path.
- If
- Flow B (
build_mode=image-from-iso): ask only foriso_url, then build. - Flow C (
build_mode=reuse-image): no additional inputs; proceed directly to build.
- If Flow A requires image creation, run
create-imageskill to generate a host image and collect artifact path. - Set build command arguments:
build_mode=image-from-tool:make build MODE=image-from-tool ICT_IMG="<ICT_IMG>"build_mode=image-from-iso:make build MODE=image-from-iso ISO_URL="<ISO_URL>"build_mode=reuse-image:make build MODE=reuse-image
- Build USB installation artifacts from repository root:
cd <enib_home>
- execute selected build command from Step 3
- Capture generated output path:
<enib_home>/infrastructure/build-artifacts/out/usb-installation-files.tar.gz
- Ask user whether to try VEN deployment script:
cd <enib_home>/infrastructure/build-artifacts/outsudo tar -xzf usb-installation-files.tar.gzprintf 'y\ny\n' | sudo ./ven-deployment.sh
Validation
- Build command exits with code 0.
- Output file exists:
<enib_home>/infrastructure/build-artifacts/out/usb-installation-files.tar.gz
- Archive contains expected entries:
bootable-usb-prepare.shconfig-fileusb-bootable-files.tar.gzven-deployment.sh
- Validate only top-level archive entries for this skill (do not require inner archive extraction checks).
Rollback
- Remove packaged output if user requests cleanup:
rm -f <enib_home>/infrastructure/build-artifacts/out/usb-installation-files.tar.gz
- Remove intermediate output directory if user approves:
rm -rf <enib_home>/infrastructure/build-artifacts/out
- If image was created in this run and user wants cleanup, apply rollback guidance from
create-imageskill.
Safety Rules
- Ask for
sudoconfirmation only before destructive operations (disk wipe, partition table changes, overwriting output directories). Do not prompt for routinesudouse such asapt installor read-only commands. - Never infer credentials, certificates, SSH keys, or secrets.
- Stop on precondition or validation failure and provide next-action guidance.
- Do not overwrite ICT source template; always copy to working template.
Expected Result Summary
Return:
- whether preconditions passed
- whether
create-imagewas executed - selected build mode and effective command
- discovered older image paths and timestamps
- whether user approved reuse of an older image or requested rebuild
- packaging build status
- artifact file names and absolute paths
- validation results for archive contents
- whether user opted to run VEN deployment check
- troubleshooting hints when build fails (for example proxy/sudo/dependency issues)
Troubleshooting Notes
- If
/dev/nbd0is already attached from a previous run, clean up the stale NBD connection before retrying VEN deployment.