Skip to content

Commit

Permalink
Merge pull request #62 from jandryuk/make
Browse files Browse the repository at this point in the history
Add make command
  • Loading branch information
dpsmith authored Feb 5, 2024
2 parents 32bbd6f + 3ded015 commit b179323
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 43 deletions.
1 change: 1 addition & 0 deletions cmds/build
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build_main() {
pushd "${TOP}/${BUILD_DIR}" >/dev/null

# Source build_env to get access to necessary OE variables.
# cd-s into BUILD_DIR.. after it redefined it.
# shellcheck disable=SC1090
. "${TOP}/${BUILD_DIR}/build_env"

Expand Down
8 changes: 4 additions & 4 deletions cmds/config
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ if [ "\$_" == "\$0" ]; then
return 1
fi
BUILD_DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ABS_BUILD_DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BBPATH="\${BUILD_DIR}/layers/bitbake/bin:\${BUILD_DIR}/layers/openembedded-core/scripts:"
BBPATH="\${ABS_BUILD_DIR}/layers/bitbake/bin:\${ABS_BUILD_DIR}/layers/openembedded-core/scripts:"
BB_ENV_EXTRAWHITE="MACHINE DISTRO BUILD_UID LAYERS_DIR"
LAYERS_DIR="\${BUILD_DIR}/layers"
BUILDDIR="\${BUILD_DIR}"
LAYERS_DIR="\${ABS_BUILD_DIR}/layers"
BUILDDIR="\${ABS_BUILD_DIR}"
PATH=\$BBPATH\$(echo "\$PATH" | sed -e "s|:\$BBPATH|:|g" -e "s|^\$BBPATH||")
unset BBPATH
Expand Down
104 changes: 65 additions & 39 deletions cmds/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ deploy_iso_legacy() {
local iso_name="openxt-installer.iso"
local iso_path="${DEPLOY_DIR}/${iso_name}"

# Prepare repository layout and write XC-{PACKAGE,REPOSITORY,SIGNATURE}
# meta files.
call_cmd "stage" "repository"
# Prepare ISO image layout.
# TODO: Amend syslinux files to reflect versions & such
call_cmd "stage" "iso"

if ! genisoimage -o "${iso_path}" \
-b "isolinux/isolinux.bin" -c "isolinux/boot.cat" \
-no-emul-boot \
Expand Down Expand Up @@ -44,13 +37,6 @@ deploy_iso() {
return 1
fi

# Prepare repository layout and write XC-{PACKAGE,REPOSITORY,SIGNATURE}
# meta files.
call_cmd "stage" "repository"
# Prepare ISO image layout.
# TODO: Amend syslinux files to reflect versions & such
call_cmd "stage" "iso"

xorriso -as mkisofs \
-o "${iso_path}" \
-isohybrid-mbr "${STAGING_DIR}/iso/isolinux/isohdpfx.bin" \
Expand All @@ -71,17 +57,17 @@ deploy_iso() {
-quiet \
"${STAGING_DIR}/iso" \
"${STAGING_DIR}/repository"

echo "ISO created: $iso_path"
}

# Usage: deploy_update
# Run the required staging steps and generate the update tarball
deploy_update() {
# Prepare repository layout and write XC-{PACKAGE,REPOSITORY,SIGNATURE}
# meta files.
call_cmd "stage" "repository"

tar -C "${STAGING_DIR}/repository" \
-cf "${DEPLOY_DIR}/update.tar" packages.main

echo "OTA update tarball created: ${DEPLOY_DIR}/update.tar"
}

deploy_pxe_usage() {
Expand All @@ -95,10 +81,6 @@ __deploy_pxe() {
local pxe_staging="${STAGING_DIR}/pxe"
local repo_dst=""

# Prepare repository layout and write XC-{PACKAGE,REPOSITORY,SIGNATURE}
# meta files.
call_cmd "stage" "repository"

while getopts "hr:" opt; do
case "${opt}" in
h) deploy_pxe_usage 0 ;;
Expand Down Expand Up @@ -131,9 +113,6 @@ __deploy_pxe() {
fi
}
deploy_pxe() {
# Prepare PXE staging.
call_cmd "stage" "pxe"

__deploy_pxe "$@"
}

Expand Down Expand Up @@ -164,6 +143,10 @@ Deployment command list:
pxe: Copy a PXE compatible OpenXT installer to the given
[<tftp-user>@]<tftp-server>:<tftp-path> tftp server, and
setup the installer to fetch repository from <repo-uri>
update: Create the update.tar OTA package.
Multiple commands can be specified together. e.g. deploy update iso.
If pxe is used, it must be last.
End-of-usage
exit "${1:-0}"
}
Expand All @@ -173,23 +156,66 @@ deploy_need_conf() { return 0; }
# Usage: deploy <command>
# Deploy OpenXT on the selected installation media.
deploy_main() {
target="$1"
shift 1
local stage_repo=0
local stage_iso=0
local stage_pxe=0

targets=()
for target in "$@" ; do
targets+=("$target")
shift

case "${target}" in
iso*)
check_cmd_version "${target}"
stage_repo=1
stage_iso=1
;;
pxe*)
stage_repo=1
stage_pxe=1
# break to maintain "$@" for deploy_pxe
break
;;
update)
stage_repo=1
;;
help) deploy_usage 0
return
;;
esac
done

if [ "$stage_repo" -eq 1 ] ; then
# Prepare repository layout and write XC-{PACKAGE,REPOSITORY,SIGNATURE}
# meta files.
call_cmd "stage" "repository"
fi

if [ "$stage_iso" -eq 1 ] ; then
# Prepare ISO image layout.
# TODO: Amend syslinux files to reflect versions & such
call_cmd "stage" "iso"
fi

if [ "$stage_pxe" -eq 1 ] ; then
# Prepare PXE staging.
call_cmd "stage" "pxe"
fi

pushd "${TOP}/${BUILD_DIR}" >/dev/null

case "${target}" in
"iso-old") check_cmd_version "${target}"
deploy_iso_legacy "$@" ;;
"iso") check_cmd_version "${target}"
deploy_iso "$@" ;;
"pxe"*) deploy_pxe "$@" ;;
"help") deploy_usage 0 ;;
"update") deploy_update ;;
*) echo "Unknown staging command \`${target}'." >&2
deploy_usage 1
;;
esac
for target in "${targets[@]}"; do
case "${target}" in
"iso-old") check_cmd_version "${target}"
deploy_iso_legacy ;;
"iso") check_cmd_version "${target}"
deploy_iso ;;
"pxe"*) deploy_pxe "$@" ;;
"help") deploy_usage 0 ;;
"update") deploy_update ;;
esac
done

popd >/dev/null
}
12 changes: 12 additions & 0 deletions cmds/make
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/bash

make_describe() {
echo "Build all the images and then deploy the iso and update."
}

make_need_conf() { return 0; }

make_main() {
call_cmd "build"
call_cmd "deploy" "iso" "update"
}

0 comments on commit b179323

Please sign in to comment.