Fix: bashisms - step 2
[releng/builder.git] / jjb / netvirt / quagga-build.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the term s of the Eclipse Public License
8 # v1.0 accompanies testing this distribution with Netvirt jobs, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> quagga-build.sh"
12
13 set -e -x
14
15 # The script builds 6wind/quagga source and binary packages from zrpcd
16 # repository for testing router functionalities with Netvirt jobs, .
17
18 initdir=$(pwd)
19 cd "$(pwd)/zrpcd"
20
21 chmod a+x "$(pwd)/pkgsrc/dev_compile_script.sh"
22 cd "$(pwd)/pkgsrc" && sudo "./dev_compile_script.sh" -p -d -b -v "$QUAGGA_VERSION"
23
24 # Move packages into a that will be uploaded to Nexus
25 UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
26 mkdir -p "$UPLOAD_FILES_PATH"
27
28 OS=$(facter operatingsystem)
29
30 case "$OS" in
31     Ubuntu)
32         mv "$WORKSPACE/zrpcd/pkgsrc/"*.deb "$UPLOAD_FILES_PATH" || true
33     ;;
34     CentOS|RedHat)
35         mv "$WORKSPACE/zrpcd/pkgsrc/"*.rpm "$UPLOAD_FILES_PATH" || true
36     ;;
37     *)
38         # nothing to do
39     ;;
40 esac
41
42 cd $initdir
43
44 # todo: remove below lines once the scripts in zrpcd repos build the src packages.
45 # Ref: https://lists.opendaylight.org/pipermail/integration-dev/2018-July/012330.html
46 tar cvzf "$WORKSPACE/upload_files/zrpcd.$(date +%F).tar.gz" "$(pwd)/zrpcd"