Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP build-config.sh #171

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions build-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

# Copyright (C) 2022 LEIDOS.
#
# 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.

#
# GENERIC Build Script for CARMA Configuration Images
#
# Do not run this script itself, rather symlink this script into the individual
# configuration folders below and invoke it there to build the appropriate config
# image using docker build. Automatically acquires folder name and system version
# and passes neessary data into the docker build process.

if [[ -z "$1" ]] ; then
echo "No argument supplied. User must provide path to desired config to build."
exit 1
fi

CONFIG_PATH=$1

CONFIG_PATH=$(realpath ${CONFIG_PATH})

if [[ ! -d "${CONFIG_PATH}" ]] ; then
echo "Specified config folder ${CONFIG_PATH} does not exist."
exit 1
fi

# Move arguments forward so they can be passed to build-image.sh
shift

current_files=()

for entry in "$CONFIG_PATH"/*
do
current_files+=( $(basename -- ${entry}) )
done

TEMPLATE_PATH=template_config/template_config
TEMPLATE_PATH=$(realpath ${TEMPLATE_PATH})


if [[ ! -d "${TEMPLATE_PATH}" ]] ; then
echo "Could not fine template_config. You must run this script from the same folder."
exit 1
fi

added_files=()
for template_file in "$TEMPLATE_PATH"/*
do
template_file=$(basename -- ${template_file})
file_exists=false
for existing_file in ${current_files[@]}; do

if [[ ${existing_file} == ${template_file} ]] ; then
file_exists=true
break
fi
done

if [[ ${file_exists} == true ]] ; then
continue
fi

cp -r ${TEMPLATE_PATH}/${template_file} $CONFIG_PATH/${template_file}
added_files+=( $CONFIG_PATH/${template_file} )
done

# Build the config
current_dir=$PWD
cd $CONFIG_PATH
./build-image.sh "$@"
cd ${PWD}

# Cleanup added files to prevent accidental commits
for added_file in ${added_files[@]}; do
rm ${added_file}
done
78 changes: 0 additions & 78 deletions carla_integration/build-image.sh

This file was deleted.

65 changes: 0 additions & 65 deletions carla_integration/system_release.sh

This file was deleted.

3 changes: 0 additions & 3 deletions chrysler_pacifica_ehybrid_s_2019/.dockerignore

This file was deleted.

39 changes: 0 additions & 39 deletions chrysler_pacifica_ehybrid_s_2019/Dockerfile

This file was deleted.

Loading