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.
20 scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
21 source $scriptdir/lib.sh
23 BASE_IMAGE_URL=${BASE_IMAGE_URL:-$(_read_build_config DEFAULT base_image)}
24 CENTOS_SNAP=${CENTOS_SNAP:-$(_read_build_config DEFAULT centos_reposnap)}
26 BASE_IMAGE_NAME=`echo $BASE_IMAGE_URL | awk -F "/" '{print $NF}'`
27 BASE_IMAGE_SIZE="8GiB"
30 [ -n "$GOLDEN_BASE_IMAGE_FETCH_USER" ] && wget_args="$wget_args --http-user=$GOLDEN_BASE_IMAGE_FETCH_USER"
31 [ -n "$GOLDEN_BASE_IMAGE_FETCH_PASSWORD" ] && wget_args="$wget_args --http-password=$GOLDEN_BASE_IMAGE_FETCH_PASSWORD"
35 echo "Download $sourceurl to $WORKTMP/base-img"
36 mkdir -pv $WORKTMP/base-img
37 pushd $WORKTMP/base-img
38 wget --no-check-certificate --no-verbose -N \
39 --auth-no-challenge $wget_args \
44 fetch_image $BASE_IMAGE_URL
45 cp $MANIFEST_PATH/packages.yaml $scriptdir/dib_elements/myproduct/package-installs.yaml
49 PACKAGES_TO_INSTALL="$(_get_package_list install)" \
50 PACKAGES_TO_UNINSTALL="$(_get_package_list uninstall)" \
51 DIB_RPMLISTS=$RPMLISTS \
52 DIB_CHECKSUM=$CHECKSUM_DIR \
53 DIB_LOCAL_REPO=$REPO_DIR \
54 DIB_DISTRIBUTION_MIRROR=$CENTOS_SNAP \
55 DIB_YUM_REPO_CONF="${REPO_FILES}/repositories.repo ${REPO_FILES}/localrepo.repo" \
56 DIB_LOCAL_IMAGE=$WORKTMP/base-img/$BASE_IMAGE_NAME \
57 ELEMENTS_PATH=$scriptdir/dib_elements/ \
58 /usr/bin/disk-image-create --root-label img-rootfs --image-size $BASE_IMAGE_SIZE vm centos7 selinux-permissive myproduct -o $TMP_GOLDEN_IMAGE
60 rm -rf $WORKTMP/base-img