--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2022 Wind River Systems, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Ensure we fail the job if any steps fail.
+set -e -o pipefail
+
+#########################################################################
+# Variables
+#########################################################################
+
+SRC_ORAN_BRANCH="master"
+
+SRC_ORAN_URL="https://gerrit.o-ran-sc.org/r/pti/rtp"
+
+SCRIPTS_DIR=$(dirname $(readlink -f $0))
+TIMESTAMP=`date +"%Y%m%d_%H%M%S"`
+
+#########################################################################
+# Common Functions
+#########################################################################
+
+help_info () {
+cat << ENDHELP
+Usage:
+$(basename $0) [-w WORKSPACE_DIR] [-n] [-u] [-h]
+where:
+ -w WORKSPACE_DIR is the path for the project
+ -n dry-run only for bitbake
+ -u update the repo if it exists
+ -h this help info
+examples:
+$0
+$0 -w workspace_1234
+ENDHELP
+}
+
+echo_step_start() {
+ [ -n "$1" ] && msg_step=$1
+ echo "#########################################################################################"
+ echo "## STEP START: ${msg_step}"
+ echo "#########################################################################################"
+}
+
+echo_step_end() {
+ [ -n "$1" ] && msg_step=$1
+ echo "#########################################################################################"
+ echo "## STEP END: ${msg_step}"
+ echo "#########################################################################################"
+ echo
+}
+
+echo_info () {
+ echo "INFO: $1"
+}
+
+echo_error () {
+ echo "ERROR: $1"
+}
+
+run_cmd () {
+ echo
+ echo_info "$1"
+ echo "CMD: ${RUN_CMD}"
+ ${RUN_CMD}
+}
+
+#########################################################################
+# Parse cmd options
+#########################################################################
+
+DRYRUN=""
+
+while getopts "w:b:e:r:unh" OPTION; do
+ case ${OPTION} in
+ w)
+ WORKSPACE=`readlink -f ${OPTARG}`
+ ;;
+ n)
+ DRYRUN="-n"
+ ;;
+ u)
+ SKIP_UPDATE="No"
+ ;;
+ h)
+ help_info
+ exit
+ ;;
+ esac
+done
+
+if [ -z ${WORKSPACE} ]; then
+ echo_info "No workspace specified, a directory 'workspace' will be created in current directory as the workspace"
+ WORKSPACE=`readlink -f workspace`
+fi
+
+#########################################################################
+# Functions for each step
+#########################################################################
+PRJ_NAME=prj_oran_stx_centos
+
+STX_SRC_BRANCH="r/stx.6.0"
+STX_LOCAL_DIR=${WORKSPACE}/localdisk
+STX_LOCAL_SRC_DIR=${STX_LOCAL_DIR}/designer/${USER}/${PRJ_NAME}
+STX_LOCAL_PRJ_DIR=${STX_LOCAL_DIR}/loadbuild/${USER}/${PRJ_NAME}
+STX_SRC_DIR=${WORKSPACE}/src
+STX_PRJ_DIR=${WORKSPACE}/${PRJ_NAME}
+STX_PRJ_OUTPUT=${WORKSPACE}/prj_output
+STX_MIRROR_DIR=${WORKSPACE}/mirror
+STX_MANIFEST_URL="https://opendev.org/starlingx/manifest"
+
+prepare_workspace () {
+ msg_step="Create workspace for the build"
+ echo_step_start
+
+ mkdir -p ${STX_LOCAL_SRC_DIR} ${STX_LOCAL_PRJ_DIR} ${STX_MIRROR_DIR} ${STX_PRJ_OUTPUT}
+ rm -f ${STX_SRC_DIR} ${STX_PRJ_DIR}
+ ln -sf ${STX_LOCAL_SRC_DIR} ${STX_SRC_DIR}
+ ln -sf ${STX_LOCAL_PRJ_DIR} ${STX_PRJ_DIR}
+
+ echo_info "The following directories are created in your workspace(${WORKSPACE}):"
+ echo_info "For all layers source: ${STX_SRC_DIR}"
+ echo_info "For StarlingX rpm mirror: ${STX_MIRROR_DIR}"
+ echo_info "For StarlingX build project: ${STX_PRJ_DIR}"
+
+ echo_step_end
+}
+
+create_env () {
+ msg_step="Create env file for the build"
+ echo_step_start
+
+ ENV_FILENAME=env.${PRJ_NAME}
+
+ cat <<EOF > ${WORKSPACE}/${ENV_FILENAME}
+
+export STX_MIRROR_DIR=${STX_MIRROR_DIR}
+
+#######################################
+# Upstream variables
+#######################################
+
+export LC_ALL=en_US.UTF-8
+export PROJECT=${PRJ_NAME}
+export SRC_BUILD_ENVIRONMENT=tis-r6-pike
+export MY_LOCAL_DISK=${STX_SRC_DIR}
+export MY_REPO_ROOT_DIR=\${MY_LOCAL_DISK}
+export MY_REPO=\${MY_REPO_ROOT_DIR}/cgcs-root
+export CGCSDIR=\${MY_REPO}/stx
+export MY_WORKSPACE=${WORKSPACE}/\${PROJECT}
+export MY_BUILD_ENVIRONMENT=\${USER}-\${PROJECT}-\${SRC_BUILD_ENVIRONMENT}
+export MY_BUILD_ENVIRONMENT_FILE=\${MY_BUILD_ENVIRONMENT}.cfg
+export MY_BUILD_ENVIRONMENT_FILE_STD=\${MY_BUILD_ENVIRONMENT}-std.cfg
+export MY_BUILD_ENVIRONMENT_FILE_RT=\${MY_BUILD_ENVIRONMENT}-rt.cfg
+export MY_BUILD_ENVIRONMENT_FILE_STD_B0=\${MY_WORKSPACE}/std/configs/\${MY_BUILD_ENVIRONMENT}-std/\${MY_BUILD_ENVIRONMENT}-std.b0.cfg
+export MY_BUILD_ENVIRONMENT_FILE_RT_B0=\${MY_WORKSPACE}/rt/configs/\${MY_BUILD_ENVIRONMENT}-rt/\${MY_BUILD_ENVIRONMENT}-rt.b0.cfg
+export MY_BUILD_DIR=${WORKSPACE}/\${PROJECT}
+export MY_SRC_RPM_BUILD_DIR=\${MY_BUILD_DIR}/rpmbuild
+export MY_BUILD_CFG=\${MY_WORKSPACE}/\${MY_BUILD_ENVIRONMENT_FILE}
+export MY_BUILD_CFG_STD=\${MY_WORKSPACE}/std/\${MY_BUILD_ENVIRONMENT_FILE_STD}
+export MY_BUILD_CFG_RT=\${MY_WORKSPACE}/rt/\${MY_BUILD_ENVIRONMENT_FILE_RT}
+export PATH=\${MY_REPO}/build-tools:\${MY_LOCAL_DISK}/bin:\${CGCSDIR}/stx-update/extras/scripts:\${PATH}
+export CGCSPATCH_DIR=\${CGCSDIR}/stx-update/cgcs-patch
+export BUILD_ISO_USE_UDEV=1
+
+# WRCP/WRA/WRO do not support layered builds at this time.
+export LAYER=""
+
+# StarlingX since 4.0 supports layered builds (compiler, distro, flock) as an option.
+# Note: Only flock layer builds an iso at this time.
+# Note: You may leave LAYER="", this will build everything, also known as a 'monolithic' build.
+# export LAYER=compiler
+# export LAYER=distro
+# export LAYER=flock
+
+# Upstream issue seems to have been corrected
+# export REPO_VERSION="--repo-branch=repo-1"
+export REPO_VERSION=
+
+# In order to avoid running out of space in your home directory
+export XDG_CACHE_HOME=\${MY_LOCAL_DISK}/.cache;
+export XDG_DATA_HOME=\${MY_LOCAL_DISK}
+
+#/bin/title "\${HOSTNAME} \${PROJECT}"
+
+alias patch_build=\${MY_REPO}/stx/update/extras/scripts/patch_build.sh
+
+alias cdrepo="cd \$MY_REPO_ROOT_DIR"
+alias cdbuild="cd \$MY_BUILD_DIR"
+
+cd \${MY_REPO_ROOT_DIR}
+
+EOF
+
+ echo_info "Env file created at ${WORKSPACE}/$ENV_FILENAME"
+
+ source ${WORKSPACE}/${ENV_FILENAME}
+
+ echo_step_end
+}
+
+repo_init_sync () {
+ msg_step="Init the repo and sync"
+ echo_step_start
+
+ cd ${MY_REPO_ROOT_DIR}
+ STX_MANIFEST="default.xml"
+ if [ "$LAYER" != "" ]; then
+ STX_MANIFEST=${LAYER}.xml
+ fi
+
+ RUN_CMD="repo init ${REPO_VERSION} -u ${STX_MANIFEST_URL} -b ${STX_SRC_BRANCH} -m ${STX_MANIFEST}"
+ run_cmd "Init the repo from manifest"
+
+ RUN_CMD="repo sync --force-sync"
+ run_cmd "repo sync"
+
+ echo_step_end
+}
+
+create_build_docker () {
+ msg_step="Create build environment docker container"
+ echo_step_start
+
+ cd ${MY_REPO_ROOT_DIR}/stx-tools/
+ export PATH=$PATH:$PWD
+
+ echo "MYUNAME=${USER}" > localrc
+ echo "PROJECT=${PRJ_NAME}" >> localrc
+ echo "HOST_PREFIX=${WORKSPACE}" >> localrc
+ echo "HOST_MIRROR_DIR=${WORKSPACE}/mirror" >> localrc
+ echo "LAYER=${LAYER}" >> localrc
+ echo "MY_EMAIL=jackie.huang@windriver.com" >> localrc
+
+ # workarounds
+ #git checkout master
+ #sed -i 's/docker /sudo docker /' tb.sh
+
+ #RUN_CMD="tb.sh create"
+ #run_cmd "Create build environment docker image"
+
+ RUN_CMD="tb.sh run"
+ run_cmd "Create build environment docker container"
+
+ echo_step_end
+}
+
+exec_build_docker () {
+ msg_step="Enter a bash shell within the build environment container"
+ echo_step_start
+
+ cd ${MY_REPO_ROOT_DIR}/stx-tools/
+ export PATH=$PATH:$PWD
+
+ RUN_CMD="tb.sh exec"
+ run_cmd "Enter a bash shell within the build environment container"
+
+ #cd $MY_REPO_ROOT_DIR/stx-tools/centos-mirror-tools/
+ #RUN_CMD="sudo -E ./download_mirror.sh"
+ #run_cmd "Download rpms"
+
+ echo_step_end
+}
+
+# To be removed:
+# This build script can not successfully build out the image yet,
+# get the upstream image temporary so we can still test the CI job to
+# upload the image to nexus
+ISO_STX_COS=bootimage.iso
+ISO_UP_VER=6.0.0
+ISO_UP=http://mirror.starlingx.cengn.ca/mirror/starlingx/release/${ISO_UP_VER}/centos/flock/outputs/iso/${ISO_STX_COS}
+ISO_INF_COS=inf-image-centos-all-x86-64.iso
+
+
+build_image () {
+ echo_step_start "Build CentOS images"
+
+ mkdir -p ${STX_PRJ_OUTPUT}
+ cd ${STX_PRJ_OUTPUT}
+ wget ${ISO_UP} -O ${ISO_INF_COS}
+
+ echo_step_end
+
+ echo_info "Build succeeded, you can get the image in ${STX_PRJ_OUTPUT}/${ISO_INF_COS}"
+}
+
+
+#########################################################################
+# Main process
+#########################################################################
+
+prepare_workspace
+create_env
+#repo_init_sync
+#create_build_docker
+#exec_build_docker
+build_image
--- /dev/null
+#!/bin/sh
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Common env
+#
+# username to build
+export MYUNAME=stxbuilder
+export MYUID=1001
+export MY_EMAIL="oran.inf@windriver.com"
+export WGET_OPENDEV="wget --no-check-certificate"
+export LOCALDISK="/localdisk"
+export MIRROR_DIR="/import/mirrors"
+
+groupadd cgts
+echo "mock:x:751:root" >> /etc/group
+echo "mockbuild:x:9001:" >> /etc/group
+
+useradd -r -u $MYUID -g cgts -m $MYUNAME
+echo "Li69nux*"|sudo passwd --stdin ${MYUNAME}
+
+gpasswd -a $MYUNAME mock
+
+mkdir -p ${LOCALDISK}/loadbuild/mock-cache
+mkdir -p ${LOCALDISK}/loadbuild/mock
+mkdir -p ${LOCALDISK}/designer
+mkdir -p ${MIRROR_DIR}/CentOS
+
+chmod 775 ${LOCALDISK}/loadbuild/mock
+chown root:mock ${LOCALDISK}/loadbuild/mock
+chmod 775 ${LOCALDISK}/loadbuild/mock-cache
+chown root:mock ${LOCALDISK}/loadbuild/mock-cache
+
+
+# Proxy configuration
+export http_proxy="http://147.11.252.42:9090"
+export https_proxy="http://147.11.252.42:9090"
+export ftp_proxy="http://147.11.252.42:9090"
+
+echo "proxy=$http_proxy" >> /etc/yum.conf && \
+ echo -e "export http_proxy=$http_proxy\nexport https_proxy=$https_proxy\n\
+export ftp_proxy=$ftp_proxy" >> /root/.bashrc
+
+
+# CentOS & EPEL URLs that match the base image
+# Override these with --build-arg if you have a mirror
+CENTOS_7_8_URL=https://vault.centos.org/centos/7.8.2003
+CENTOS_7_9_URL=http://mirror.centos.org/centos-7/7.9.2009
+EPEL_7_8_URL=https://archives.fedoraproject.org/pub/archive/epel/7.2020-04-20
+
+# Lock down centos & epel repos
+rm -f /etc/yum.repos.d/*
+cd /etc/yum.repos.d/
+${WGET_OPENDEV} https://opendev.org/starlingx/tools/raw/branch/master/toCOPY/yum.repos.d/centos-7.9.repo
+${WGET_OPENDEV} https://opendev.org/starlingx/tools/raw/branch/master/toCOPY/yum.repos.d/centos.repo
+${WGET_OPENDEV} https://opendev.org/starlingx/tools/raw/branch/master/toCOPY/yum.repos.d/epel.repo
+
+cd /etc/pki/rpm-gpg/
+${WGET_OPENDEV} https://opendev.org/starlingx/tools/raw/branch/master/centos-mirror-tools/rpm-gpg-keys/RPM-GPG-KEY-EPEL-7
+
+cd -
+rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* && \
+ echo "http_caching=packages" >> /etc/yum.conf && \
+ echo "skip_missing_names_on_install=0" >>/etc/yum.conf && \
+ # yum variables must be in lower case ; \
+ echo "$CENTOS_7_8_URL" >/etc/yum/vars/centos_7_8_url && \
+ echo "$EPEL_7_8_URL" >/etc/yum/vars/epel_7_8_url && \
+ echo "$CENTOS_7_9_URL" >/etc/yum/vars/centos_7_9_url && \
+ # disable fastestmirror plugin because we are not using mirrors ; \
+ # FIXME: use a mirrorlist URL for centos/vault/epel archives. I couldn't find one.
+ sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf && \
+ echo "[main]" >> /etc/yum/pluginconf.d/subscription-manager.conf && \
+ echo "enabled=0" >> /etc/yum/pluginconf.d/subscription-manager.conf && \
+ yum clean all && \
+ yum makecache && \
+ yum install -y deltarpm
+
+
+# root CA cert expired on October 1st, 2021
+yum update -y --enablerepo=centos-7.9-updates ca-certificates
+
+# Download required dependencies by mirror/build processes.
+yum install -y \
+ anaconda \
+ anaconda-runtime \
+ autoconf-archive \
+ autogen \
+ automake \
+ bc \
+ bind \
+ bind-utils \
+ bison \
+ cpanminus \
+ createrepo \
+ createrepo_c \
+ deltarpm \
+ docker-client \
+ expat-devel \
+ flex \
+ isomd5sum \
+ gcc \
+ gettext \
+ git \
+ libguestfs-tools \
+ libtool \
+ libxml2 \
+ lighttpd \
+ lighttpd-fastcgi \
+ lighttpd-mod_geoip \
+ net-tools \
+ mkisofs \
+ mongodb \
+ mongodb-server \
+ pax \
+ perl-CPAN \
+ python-deltarpm \
+ python-pep8 \
+ python-pip \
+ python-psutil \
+ python2-psutil \
+ python36-psutil \
+ python36-requests \
+ python3-devel \
+ python-sphinx \
+ python-subunit \
+ python-virtualenv \
+ python-yaml \
+ python2-ruamel-yaml \
+ postgresql \
+ qemu-kvm \
+ quilt \
+ rpm-build \
+ rpm-sign \
+ rpm-python \
+ squashfs-tools \
+ sudo \
+ systemd \
+ syslinux \
+ udisks2 \
+ vim-enhanced \
+ wget
+
+# clone the tools repo
+cd ~
+git clone https://opendev.org/starlingx/tools.git
+
+# Finally install a locked down version of mock
+yum install -y https://mirrors.xlhy1.com/centos/7/updates/x86_64/Packages/python36-rpm-4.11.3-7.el7.x86_64.rpm
+yum install -y \
+ http://mirror.starlingx.cengn.ca/mirror/centos/epel/dl.fedoraproject.org/pub/epel/7/x86_64/Packages/m/mock-1.4.16-1.el7.noarch.rpm \
+ http://mirror.starlingx.cengn.ca/mirror/centos/epel/dl.fedoraproject.org/pub/epel/7/x86_64/Packages/m/mock-core-configs-31.6-1.el7.noarch.rpm
+
+# mock custumizations
+# forcing chroots since a couple of packages naughtily insist on network access and
+# we dont have nspawn and networks happy together.
+useradd -s /sbin/nologin -u 9001 -g 9001 mockbuild && \
+ rmdir /var/lib/mock && \
+ ln -s ${LOCALDISK}/loadbuild/mock /var/lib/mock && \
+ rmdir /var/cache/mock && \
+ ln -s ${LOCALDISK}/loadbuild/mock-cache /var/cache/mock && \
+ echo "config_opts['use_nspawn'] = False" >> /etc/mock/site-defaults.cfg && \
+ echo "config_opts['rpmbuild_networking'] = True" >> /etc/mock/site-defaults.cfg && \
+ echo >> /etc/mock/site-defaults.cfg
+
+# cpan modules, installing with cpanminus to avoid stupid questions since cpan is whack
+cpanm --notest Fatal && \
+ cpanm --notest XML::SAX && \
+ cpanm --notest XML::SAX::Expat && \
+ cpanm --notest XML::Parser && \
+ cpanm --notest XML::Simple
+
+# Install repo tool
+curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo && \
+ chmod a+x /usr/local/bin/repo
+
+# installing go and setting paths
+export GOPATH="/usr/local/go"
+export PATH="${GOPATH}/bin:${PATH}"
+yum install -y golang && \
+ mkdir -p ${GOPATH}/bin && \
+ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
+
+# Uprev git, repo
+yum install -y dh-autoreconf curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto docbook2X && \
+ cd /tmp && \
+ wget https://github.com/git/git/archive/v2.29.2.tar.gz -O git-2.29.2.tar.gz && \
+ tar xzvf git-2.29.2.tar.gz && \
+ cd git-2.29.2 && \
+ make configure && \
+ ./configure --prefix=/usr/local && \
+ make all doc && \
+ make install install-doc && \
+ cd /tmp && \
+ rm -rf git-2.29.2.tar.gz git-2.29.2
+
+# Systemd Enablement
+#(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
+# rm -f /lib/systemd/system/multi-user.target.wants/*;\
+# rm -f /etc/systemd/system/*.wants/*;\
+# rm -f /lib/systemd/system/local-fs.target.wants/*; \
+# rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
+# rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
+# rm -f /lib/systemd/system/basic.target.wants/*;\
+# rm -f /lib/systemd/system/anaconda.target.wants/*
+
+# pip installs
+# Install required python modules globally; versions are in the constraints file.
+# Be careful not to replace modules provided by RPMs as it may break
+# other system packages. Look for warnings similar to "Uninstalling a
+# distutils installed project has been deprecated" from pip.
+pip install -c ~/tools/toCOPY/builder-constraints.txt \
+ testrepository \
+ fixtures \
+ pbr \
+ git-review \
+ python-subunit \
+ junitxml \
+ testtools
+
+# Create a sane py27 virtualenv
+virtualenv /opt/py27 && \
+ source /opt/py27/bin/activate && \
+ pip install -c ~/tools/toCOPY/builder-opt-py27-constraints.txt \
+ tox \
+ && \
+ for prog in tox ; do \
+ ln -s /opt/py27/bin/$prog /usr/bin ; \
+ done
+
+# Inherited tools for mock stuff
+# we at least need the mock_cache_unlock tool
+# they install into /usr/bin
+cp -rf ~/tools/toCOPY/mock_overlay /opt/mock_overlay
+cd /opt/mock_overlay && \
+ make && \
+ make install
+
+# This image requires a set of scripts and helpers
+# for working correctly, in this section they are
+# copied inside the image.
+cp ~/tools/toCOPY/finishSetup.sh /usr/local/bin
+cp ~/tools/toCOPY/populate_downloads.sh /usr/local/bin
+cp ~/tools/toCOPY/generate-local-repo.sh /usr/local/bin
+cp ~/tools/toCOPY/generate-centos-repo.sh /usr/local/bin
+cp ~/tools/toCOPY/lst_utils.sh /usr/local/bin
+cp ~/tools/toCOPY/.inputrc /home/$MYUNAME/
+chown $MYUNAME:cgts /home/$MYUNAME/.inputrc
+
+# Thes are included for backward compatibility, and
+# should be removed after a reasonable time.
+cp ~/tools/toCOPY/generate-cgcs-tis-repo /usr/local/bin
+cp ~/tools/toCOPY/generate-cgcs-centos-repo.sh /usr/local/bin
+
+# ENV setup
+echo "# Load stx-builder configuration" >> /etc/profile.d/stx-builder-conf.sh && \
+ echo "if [[ -r \${HOME}/buildrc ]]; then" >> /etc/profile.d/stx-builder-conf.sh && \
+ echo " source \${HOME}/buildrc" >> /etc/profile.d/stx-builder-conf.sh && \
+ echo " export PROJECT SRC_BUILD_ENVIRONMENT MYPROJECTNAME MYUNAME" >> /etc/profile.d/stx-builder-conf.sh && \
+ echo " export MY_BUILD_CFG MY_BUILD_CFG_RT MY_BUILD_CFG_STD MY_BUILD_DIR MY_BUILD_ENVIRONMENT MY_BUILD_ENVIRONMENT_FILE MY_BUILD_ENVIRONMENT_FILE_RT MY_BUILD_ENVIRONMENT_FILE_STD MY_DEBUG_BUILD_CFG_RT MY_DEBUG_BUILD_CFG_STD MY_LOCAL_DISK MY_MOCK_ROOT MY_REPO MY_REPO_ROOT_DIR MY_SRC_RPM_BUILD_DIR MY_RELEASE MY_WORKSPACE LAYER" >> /etc/profile.d/stx-builder-conf.sh && \
+ echo "fi" >> /etc/profile.d/stx-builder-conf.sh && \
+ echo "export FORMAL_BUILD=0" >> /etc/profile.d/stx-builder-conf.sh && \
+ echo "export PATH=\$MY_REPO/build-tools:\$PATH" >> /etc/profile.d/stx-builder-conf.sh
+
+# centos locales are broken. this needs to be run after the last yum install/update
+localedef -i en_US -f UTF-8 en_US.UTF-8
+
+# setup
+mkdir -p /www/run && \
+ mkdir -p /www/logs && \
+ mkdir -p /www/home && \
+ mkdir -p /www/root/htdocs/localdisk && \
+ chown -R $MYUID:cgts /www && \
+ ln -s ${LOCALDISK}/loadbuild /www/root/htdocs/localdisk/loadbuild && \
+ ln -s ${MIRROR_DIR}/CentOS /www/root/htdocs/CentOS && \
+ ln -s ${LOCALDISK}/designer /www/root/htdocs/localdisk/designer
+
+# lighthttpd setup
+# chmod for /var/log/lighttpd fixes a centos issue
+# in place sed for server root since it's expanded soon thereafter
+# echo "server.bind = \"localhost\"" >> /etc/lighttpd/lighttpd.conf && \
+echo "$MYUNAME ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers && \
+ mkdir -p /var/log/lighttpd && \
+ chmod a+rwx /var/log/lighttpd/ && \
+ sed -i 's%^var\.log_root.*$%var.log_root = "/www/logs"%g' /etc/lighttpd/lighttpd.conf && \
+ sed -i 's%^var\.server_root.*$%var.server_root = "/www/root"%g' /etc/lighttpd/lighttpd.conf && \
+ sed -i 's%^var\.home_dir.*$%var.home_dir = "/www/home"%g' /etc/lighttpd/lighttpd.conf && \
+ sed -i 's%^var\.state_dir.*$%var.state_dir = "/www/run"%g' /etc/lighttpd/lighttpd.conf && \
+ sed -i "s/server.port/#server.port/g" /etc/lighttpd/lighttpd.conf && \
+ sed -i "s/server.use-ipv6/#server.use-ipv6/g" /etc/lighttpd/lighttpd.conf && \
+ sed -i "s/server.username/#server.username/g" /etc/lighttpd/lighttpd.conf && \
+ sed -i "s/server.groupname/#server.groupname/g" /etc/lighttpd/lighttpd.conf && \
+ sed -i "s/server.bind/#server.bind/g" /etc/lighttpd/lighttpd.conf && \
+ sed -i "s/server.document-root/#server.document-root/g" /etc/lighttpd/lighttpd.conf && \
+ sed -i "s/server.dirlisting/#server.dirlisting/g" /etc/lighttpd/lighttpd.conf && \
+ echo "server.port = 8088" >> /etc/lighttpd/lighttpd.conf && \
+ echo "server.use-ipv6 = \"disable\"" >> /etc/lighttpd/lighttpd.conf && \
+ echo "server.username = \"$MYUNAME\"" >> /etc/lighttpd/lighttpd.conf && \
+ echo "server.groupname = \"cgts\"" >> /etc/lighttpd/lighttpd.conf && \
+ echo "server.bind = \"localhost\"" >> /etc/lighttpd/lighttpd.conf && \
+ echo "server.document-root = \"/www/root/htdocs\"" >> /etc/lighttpd/lighttpd.conf && \
+ sed -i "s/dir-listing.activate/#dir-listing.activate/g" /etc/lighttpd/conf.d/dirlisting.conf && \
+ echo "dir-listing.activate = \"enable\"" >> /etc/lighttpd/conf.d/dirlisting.conf
+
+#systemctl enable lighttpd
+#systemctl start lighttpd
+/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
+
+
+echo "export PATH=/usr/local/bin:${LOCALDISK}/designer/$MYUNAME/bin:\$PATH" >> /home/$MYUNAME/.bashrc
+chmod a+x /usr/local/bin/*
+
+# Genrate a git configuration file in order to save an extra step
+# for end users, this file is required by "repo" tool.
+cd /home/$MYUNAME/
+runuser -u $MYUNAME -- git config --global user.email $MY_EMAIL && \
+ runuser -u $MYUNAME -- git config --global user.name $MYUNAME && \
+ runuser -u $MYUNAME -- git config --global color.ui false
+
+# Customizations for mirror creation
+rm -f /etc/yum.repos.d/*
+cp -f ~/tools/centos-mirror-tools/yum.repos.d/* /etc/yum.repos.d/
+cp -f ~/tools/centos-mirror-tools/rpm-gpg-keys/* /etc/pki/rpm-gpg/
+
+# Import GPG keys
+rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
+
+# Try to continue a yum command even if a StarlingX repo is unavailable.
+yum-config-manager --setopt=StarlingX\*.skip_if_unavailable=1 --save