4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
19 source $scriptdir/lib.sh
22 config_ini=${1:-$BUILD_CONFIG_INI}
23 output_repo_files_dir=${2:-$REPO_FILES}
24 output_mock_dir=${2:-$output_repo_files_dir}
25 [ -f "$config_ini" ] || _abort "Config INI '$config_ini' not found"
28 $LIBDIR/build_step_create_yum_repo_files.sh $config_ini $output_repo_files_dir
31 mkdir -p $output_mock_dir
32 cp $LIBDIR/mock/logging.ini $output_mock_dir/
33 cp $LIBDIR/mock/site-defaults.cfg $output_mock_dir/
34 mock_cfg=$output_mock_dir/mock.cfg
35 sed -e "/#REPOSITORIES#/r $output_repo_files_dir/repositories.repo" $LIBDIR/mock/mock.cfg.template > $mock_cfg
37 -e "s/#RPM_PACKAGER#/\"$(_read_build_config $config_ini rpm packager)\"/" \
38 -e "s/#RPM_VENDOR#/\"$(_read_build_config $config_ini rpm vendor)\"/" \
39 -e "s/#RPM_LICENSE#/\"$(_read_build_config $config_ini rpm license)\"/" \
40 -e "s/#RPM_RELEASE_ID#/\"$(_read_build_config $config_ini rpm release_id)\"/" \
41 -e "s/#PRODUCT_RELEASE_BUILD_ID#/\"$PRODUCT_RELEASE_BUILD_ID\"/" \
42 -e "s/#PRODUCT_RELEASE_LABEL#/\"$PRODUCT_RELEASE_LABEL\"/" \
45 docker_sock=/var/run/docker.sock
46 if [ -S "$docker_sock" ]; then
47 sed -i "/#ADDITIONAL_CONFIG_OPTS#/a config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('$docker_sock', '$docker_sock'))" $mock_cfg
49 if [ -n "$DOCKER_HOST" ]; then
50 sed -i "/#ADDITIONAL_CONFIG_OPTS#/a config_opts['environment']['DOCKER_HOST'] = '${DOCKER_HOST}:2375'" $mock_cfg
54 # include kernels in order for yum development group to install
55 sed -i -e 's/exclude=kernel/#exclude=kernel/' $mock_cfg
57 echo "Wrote mock configuration to: $output_mock_dir"