Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Adding files to support command line testing of image creation
Browse files Browse the repository at this point in the history
Adding the below listed files for successful image creation and testing
on command line with make

Signed-off-by: Vinay Potluri <[email protected]>
  • Loading branch information
vinaypotluri authored and mbelluzzo-intel committed Dec 4, 2019
1 parent 76798d7 commit 5e16347
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 1 deletion.
29 changes: 29 additions & 0 deletions images/native-finalize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
#
# This is a finalize script that is run by clr-distro-factory to support
# user's requirement for conversion / compression of images before exporting.
# ex: <image_name>-finalize.sh

set -e

SCRIPT_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")

if (( ${#} != 1 )); then
echo "${0}: Must receive exactly one file path." >&2
exit 1
fi

if [[ ! -s "${1}" ]]; then
echo "${0}: Invalid input: '${1}' is empty." >&2
exit 1
fi

file_ext="${1##*.}"

if [[ "${file_ext}" == "iso" ]]; then
echo "${1}"
else
"${SCRIPT_DIR}/task-compress-image.sh" "${1}" "${1}.xz" >&2
rm -rf "${1}" >&2
echo "${1}.xz"
fi
12 changes: 12 additions & 0 deletions images/native-post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
# This is a post install script that is run from the config after the image
# has been created by clr-installer for images with special requirements
# ex: <image_name>-post.sh

set -e

SCRIPT_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")

# Delay booting to give user a change to change boot params
"${SCRIPT_DIR}"/task-wait-to-boot.sh "${1}"
5 changes: 4 additions & 1 deletion images/native.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ targetMedia:
type: part
keyboard: us
language: en_US.UTF-8
bundles: [bootloader, os-core, os-core-update]
iso: true
keepImage: true
telemetry: false
bundles: [bootloader, os-core, os-core-update]
kernel: kernel-native
block-devices: [{name: native, file: native.img}]
post-install: [{cmd: "${yamlDir}/native-post.sh ${chrootDir}"}]
18 changes: 18 additions & 0 deletions images/task-compress-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
#
# This is a task script that can be executed to perform specific tasks
# which are common between various images.
# Task scripts can be called commonly from post & finalize scripts.
# ex: task-<job_name>.sh

set -e

if (( ${#} < 1 )); then
echo "${0}: Insufficient number of arguments." >&2
exit 1
fi

if ! xz -q -T0 --stdout "${1}" > "${2:-${1}.xz}"; then
echo "${0}: Unable to compress file ${1}." >&2
exit 1
fi
15 changes: 15 additions & 0 deletions images/task-wait-to-boot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
#
# This is a task script that can be executed to perform specific tasks
# which are common between various images.
# Task scripts can be called commonly from post & finalize scripts.
# ex: task-<job_name>.sh

#!/bin/bash

# Have the installer image wait 5 seconds before launch
# Useful for users to change the boot command for debug

echo "timeout 5" >> "${1}/boot/loader/loader.conf"

exit 0

0 comments on commit 5e16347

Please sign in to comment.