Remove intrusive useless logging
[csit.git] / resources / libraries / bash / qemu_build.sh
1 #!/bin/bash
2 # Copyright (c) 2018 Cisco and/or its affiliates.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 set -x
16
17 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
18
19 # Include
20 source ${SCRIPT_DIR}/config/defaults
21 source ${SCRIPT_DIR}/shell/qemu_utils.sh
22
23 # Read configuration
24 while read line
25 do
26     if echo $line | grep -F = &>/dev/null
27     then
28         varname=$(echo "$line" | cut -d '=' -f 1)
29         cfg[$varname]=$(echo "$line" | cut -d '=' -f 2-)
30     fi
31 done < ${SCRIPT_DIR}/config/config
32
33 # Read parameters
34 for i in "$@"; do
35     case $i in
36         --version=*)
37             cfg['QEMU_INSTALL_VERSION']="${i#*=}"
38             shift ;;
39         --directory=*)
40             cfg['QEMU_INSTALL_DIR']="${i#*=}"
41             shift ;;
42         --patch)
43             cfg['QEMU_PATCH']=true
44             shift ;;
45         --force)
46             cfg['QEMU_FORCE_INSTALL']=true
47             shift ;;
48         --target-list)
49             cfg['QEMU_TARGET_LIST']="${i#*=}"
50             shift ;;
51         *)
52             ;;
53     esac
54 done
55
56 # Install qemu
57 qemu_utils.qemu_install ${cfg[QEMU_INSTALL_DIR]} ${cfg[QEMU_INSTALL_VERSION]} \
58     ${cfg[QEMU_PATCH]} ${cfg[QEMU_FORCE_INSTALL]} ${cfg[QEMU_TARGET_LIST]}