X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=integration%2Fsrc%2Frelease_scripts%2FupdateParentRef.sh;h=0f10cfbb4c669f3a98fc5c3312cb768a1ec9d9fc;hb=b76315a09b466166a6eec6f0b22f58d3e432c7b9;hp=831d6c39c8f9b476e5ba1cc50c85903badf49864;hpb=5946bbfbefc9305961e72681f3bf161e16dfcd5d;p=policy%2Fparent.git diff --git a/integration/src/release_scripts/updateParentRef.sh b/integration/src/release_scripts/updateParentRef.sh index 831d6c39..0f10cfbb 100755 --- a/integration/src/release_scripts/updateParentRef.sh +++ b/integration/src/release_scripts/updateParentRef.sh @@ -4,7 +4,7 @@ # ============LICENSE_START================================================ # ONAP # ========================================================================= -# Copyright (C) 2021 Nordix Foundation. +# Copyright (C) 2021-2022 Nordix Foundation. # ========================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,8 +20,18 @@ # ============LICENSE_END================================================== # +set -e + SCRIPT_NAME=`basename $0` +# Use the bash internal OSTYPE variable to check for MacOS +if [[ "$OSTYPE" == "darwin"* ]] +then + SED="gsed" +else + SED="sed" +fi + usage() { echo "" @@ -97,9 +107,9 @@ then exit 1 fi -pom_lines=`wc -l $pom_file | sed 's/^[ \t]*//' | cut -f1 -d' '` -parent_start_line=`grep -n '^[\t ]*[\t*]*$' $pom_file | cut -f1 -d':'` -parent_end_line=`grep -n '^[\t ]*[\t*]*$' $pom_file | cut -f1 -d':'` +pom_lines=`wc -l $pom_file | $SED 's/^[ \t]*//' | cut -f1 -d' '` +parent_start_line=`grep -n '^[\t ]*[\t ]*$' $pom_file | cut -f1 -d':'` +parent_end_line=`grep -n '^[\t ]*[\t ]*$' $pom_file | cut -f1 -d':'` pom_head_lines=$((parent_start_line-1)) pom_tail_lines=$((pom_lines-parent_end_line))