2023-04-14 21:27:40 -07:00
|
|
|
#!/bin/bash
|
|
|
|
%
|
|
|
|
if [[ $REBUILD == "init" ]]; then
|
|
|
|
echo "## Busting Cache, Forcing Rebuild $(date)"
|
|
|
|
fi
|
|
|
|
%
|
2023-04-22 08:19:45 -07:00
|
|
|
echo "************* BUILD INITIALZATION ***********************"
|
|
|
|
if ! { [ "$VERBOSE" = "init" ] || [ "$VERBOSE" = "all" ]; }; then unset VERBOSE; fi
|
2023-04-14 21:27:40 -07:00
|
|
|
export BUILDING=true
|
2023-04-22 08:19:45 -07:00
|
|
|
export BUILD_DIR=/build
|
|
|
|
echo Distro is $LINUX_DISTRO
|
|
|
|
source /opt/lib/verbose.lib
|
2023-04-14 21:27:40 -07:00
|
|
|
|
2023-04-22 08:19:45 -07:00
|
|
|
echo sourcing core-run.env
|
|
|
|
quiet cat /opt/core_run.env
|
|
|
|
source /opt/core_run.env
|
2023-04-14 21:27:40 -07:00
|
|
|
|
2023-04-22 08:19:45 -07:00
|
|
|
echo copying source init/opt directory to image /opt directory
|
|
|
|
quiet ls -la opt/
|
|
|
|
/bin/cp -R -f -p opt/. /opt
|
2023-04-14 21:27:40 -07:00
|
|
|
|
2023-04-22 08:19:45 -07:00
|
|
|
[[ -f ./build.env ]] && source ./build.env && echo loaded build.env at /init/build.env in source
|
2023-04-14 21:27:40 -07:00
|
|
|
|
|
|
|
if [[ -f ./init.sh ]]; then
|
2023-04-22 08:19:45 -07:00
|
|
|
echo "### Running Script init.sh of $BUILD_NAME build source with ${SHELL:-/bin/bash} ####"
|
2023-04-14 21:27:40 -07:00
|
|
|
quiet echo "----- build environment ------"
|
|
|
|
quiet env
|
|
|
|
quiet echo "----- env ------"
|
|
|
|
quiet echo "-------------------- init.sh ------------------------------"
|
|
|
|
quiet cat ./init.sh
|
|
|
|
quiet echo "-------------------------------------------------------------"
|
|
|
|
# init.sh must have shebang and be executable
|
2023-04-22 08:19:45 -07:00
|
|
|
if ! ${SHELL:-/bin/bash} ./init.sh; then return 1; fi
|
2023-04-14 21:27:40 -07:00
|
|
|
echo "############## Finished running init.sh build script #########################"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# map host id now based on build environment
|
|
|
|
if [[ $VOLUME_DIRS ]]; then
|
|
|
|
echo "*** creating and configuring volume directories ***"
|
|
|
|
echo $VOLUME_DIRS
|
|
|
|
mkdir -p $VOLUME_DIRS
|
|
|
|
$BIN_DIR/map-host-id
|
|
|
|
chmod -R g+rw $VOLUME_DIRS
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\n ************* End Initialzation ************************"
|