#!/bin/bash ########################################################################### # # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file gen_common_defs.sh # # @author (last) Quang Nguyen # @date (last) 06-Jan-2021 # @author (original) Quang Nguyen # @date (original) 06-Jan-2020 # ############################################################################ if [[ "$1" == "-h" || "$1" == "--help" || $# -eq 0 ]]; then currentFile=$(basename "$0") echo "Usage: ./$currentFile " exit 1 fi OUTPUT_FILE=$1 COMMON_REPO=$2 COMMON_BRANCH=$3 PREFIX_MATCH=$4 CPP_HEADER=$5 rm -rf "$COMMON_REPO" git clone -b "$COMMON_BRANCH" ssh://git@dvm-linux02:7999/comm/common.git "$COMMON_REPO" if [ $? -ne 0 ]; then echo "Could not clone common"; exit 1; fi grep -oh "$PREFIX_MATCH.* = .*," -- "$COMMON_REPO/$CPP_HEADER" > "$OUTPUT_FILE" if [ $? -ne 0 ]; then echo "Error during grep"; exit 1; fi