Add a script to build REC images
[ta/build-tools.git] / build_images.sh
1 #!/bin/bash
2 # Copyright 2019 Nokia
3 #
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
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16 set -x
17 set -eu
18
19 usage() {
20     echo "Usage: $0 -m <manifest-path> -w <work-dir-path>"
21     exit 1
22 }
23
24 [ "$#" -ne 4 ] && usage
25 while getopts "m:w:" OPT; do
26     case $OPT in
27     m)
28         export MANIFEST_PATH=$(readlink -f $OPTARG)
29         ;;
30     w)
31         export WORK=$OPTARG
32         ;;
33     *)
34         usage
35         ;;
36     esac
37 done
38
39 scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
40 source $scriptdir/lib.sh
41
42 _initialize_work_dirs
43
44 # Create manifest RPM
45 $LIBDIR/create_manifest_rpm.sh
46
47 # Create repo config
48 $LIBDIR/build_step_create_yum_repo_files.sh
49
50 # QCOW
51 $LIBDIR/build_step_golden_image.sh
52 sha1short=$(grep -v product-manifest $RPMLISTS/rpmlist | sha1sum | cut -c-8)
53
54 # ISO images
55 $LIBDIR/build_step_create_install_cd.sh
56
57 echo "=== SUCCESS ==="
58 echo "Build results are in $WORKRESULTS"
59 echo "Installed RPMS checksum: ${sha1short} (this will change if list of installed RPMs changes)"