diff --git a/tools/nocloud-factory-install/factory-install/config/localhost.yml b/tools/nocloud-factory-install/factory-install/config/localhost.yml new file mode 100644 index 00000000..63014efe --- /dev/null +++ b/tools/nocloud-factory-install/factory-install/config/localhost.yml @@ -0,0 +1,8 @@ +# Ansible Bootstrap Configurations - user configuration overrides +# +# System and network bootstrap properties cen be specified here as outlined in +# the StarlingX documentation. For instance, OAM network configuration can +# be specified: external_oam_subnet, external_oam_gateway_address, +# external_oam_floating_address, etc. + +system_mode: simplex diff --git a/tools/nocloud-factory-install/factory-install/scripts/10-init-setup b/tools/nocloud-factory-install/factory-install/scripts/10-init-setup new file mode 100755 index 00000000..21dd349b --- /dev/null +++ b/tools/nocloud-factory-install/factory-install/scripts/10-init-setup @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Copyright (c) 2024 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# cloud-init script to setup the factory install services +# + +USER=sysadmin +HOME=/home/${USER} +NOCLOUD=/opt/nocloud + +FACTORY_INSTALL=/var/lib/factory-install + +check_rc_die() { + local -i rc=${1} + msg=${2} + if [ ${rc} -ne 0 ]; then + echo "FATAL: ${msg} [rc=${rc}]" && exit 1 + fi +} + +echo "Factory Install Setup - Start" + +if [ -d "${FACTORY_INSTALL}" ]; then + echo "${FACTORY_INSTALL} exists, aborting" + exit 1 +fi + +mkdir -p "${FACTORY_INSTALL}"/{stage,state} +check_rc_die $? "mkdir failed" + +# Copy system config, setup and test scripts +cp -r "${NOCLOUD}"/factory-install/scripts "${FACTORY_INSTALL}"/scripts && \ + cp -r "${NOCLOUD}"/factory-install/setup "${FACTORY_INSTALL}"/setup && \ + cp -r "${NOCLOUD}"/factory-install/tests "${FACTORY_INSTALL}"/tests && \ + cp -r "${NOCLOUD}"/factory-install/config "${FACTORY_INSTALL}"/config +check_rc_die $? "copy failed" + +# Ensure files are executable for run-parts +chmod a+x "${FACTORY_INSTALL}"/scripts/* && \ + chmod a+x "${FACTORY_INSTALL}"/setup/* && \ + chmod a+x "${FACTORY_INSTALL}"/tests/* +check_rc_die $? "chmod failed" + +# Copy configuration files required for running bootstrap and deployment configuration services +# NOTE: Configuration files are expected to be located in home directory +su "${USER}" <