blob: 8bd02940815df54fa1924d5ad3aff5568dd9deae [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001#!/bin/bash
2###############################################################################
3#
4# <:copyright-BRCM:2016:proprietary:standard
5#
6# Broadcom Ltd. Proprietary and Confidential.(c) 2016 Broadcom Ltd.
7# All Rights Reserved
8#
9# This program is the proprietary software of Broadcom Ltd. and/or its
10# licensors, and may only be used, duplicated, modified or distributed pursuant
11# to the terms and conditions of a separate, written license agreement executed
12# between you and Broadcom Ltd. (an "Authorized License"). Except as set forth in
13# an Authorized License, Broadcom Ltd. grants no license (express or implied), right
14# to use, or waiver of any kind with respect to the Software, and Broadcom Ltd.
15# expressly reserves all rights in and to the Software and all intellectual
16# property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU HAVE
17# NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY
18# BROADCOM LTD AND DISCONTINUE ALL USE OF THE SOFTWARE.
19#
20# Except as expressly set forth in the Authorized License,
21#
22# 1. This program, including its structure, sequence and organization,
23# constitutes the valuable trade secrets of Broadcom Ltd., and you shall use
24# all reasonable efforts to protect the confidentiality thereof, and to
25# use this information only in connection with your use of Broadcom Ltd.
26# integrated circuit products.
27#
28# 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29# AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
30# WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
31# RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND
32# ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT,
33# FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
34# COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE
35# TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF USE OR
36# PERFORMANCE OF THE SOFTWARE.
37#
38# 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR
39# ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL,
40# INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY
41# WAY RELATING TO YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN
42# IF BROADCOM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES;
43# OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT ACTUALLY PAID FOR THE
44# SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE LIMITATIONS
45# SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY
46# LIMITED REMEDY.
47# :>
48#
49###############################################################################
50
51# This script is called from the main Makefile.
52# Prerequisites:
53# 1. BAL standalone or ofpal_of_agent binaries are built.
54# 2. Environment variables defined:
55# - BUILD_TARGET : bal_of_agent / bal_core
56# - BIN_RELEASE_FILE_PREFIX : binary release file prefix
57
58if [[ "$BIN_RELEASE_FILE_PREFIX" == "" ]]; then
59 echo BIN_RELEASE_FILE_PREFIX variable must be set
60 exit -1
61fi
62
63TMP_DIR=/tmp/bal_bin_release/`date +%d_%m_%Y_%H_%M_%S`
64BIN_RELEASE_FILE=$BIN_RELEASE_FILE_PREFIX.tar.gz
65BIN_RELEASE_DIR=$TMP_DIR/$BIN_RELEASE_FILE_PREFIX
66
67mkdir -p $BIN_RELEASE_DIR
68
69if [[ "$BUILD_TARGET" == "core" ]]; then
70 echo Generating BAL Release Archive $BIN_RELEASE_FILE
71 cp build/core/src/core/main/bal_core $BIN_RELEASE_DIR/
72elif [[ "$BUILD_TARGET" == "agent" ]]; then
73 echo Generating OF Agent Release Archive $BIN_RELEASE_FILE
74 cp build/agent/3rdparty/indigo/ofpal_of_agent $BIN_RELEASE_DIR/bcm_sdn_agent
75# The following are relevant only when BUILD_NC_AGENT=y, so they might not exist
76 if test -e build/agent/start_sdn_agent.sh; then cp build/agent/start_sdn_agent.sh $BIN_RELEASE_DIR; fi
77 if test -e build/agent/lib; then cp -ar build/agent/lib $BIN_RELEASE_DIR; fi
78 if test -e build/agent/bin; then cp -ar build/agent/bin $BIN_RELEASE_DIR; fi
79 if test -e build/agent/modules; then cp -ar build/agent/modules $BIN_RELEASE_DIR; fi
80 if test -e /usr/lib/libssl.so.10; then cp -ar /usr/lib/libssl.so.10 $BIN_RELEASE_DIR; fi
81 if test -e /usr/lib/libcrypto.so.10; then cp -ar /usr/lib/libcrypto.so.10 $BIN_RELEASE_DIR; fi
82else
83 echo BUILD_TARGET has unexpected value \"$BUILD_TARGET\". Must be \"core\" or \"agent\"
84 exit -1
85fi
86
87cp scripts/bal_autostart.ini $BIN_RELEASE_DIR/
88cp scripts/bal_config.ini $BIN_RELEASE_DIR/
89cp 3rdparty/bcm-sdk/rc/bal/rpc.soc.template $BIN_RELEASE_DIR
90
91cd $TMP_DIR
92tar -czf $BIN_RELEASE_FILE $BIN_RELEASE_FILE_PREFIX
93echo ./$BIN_RELEASE_FILE created
94