diff options
author | Liam Fallon <liam.fallon@est.tech> | 2022-03-03 09:22:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-03-03 09:22:21 +0000 |
commit | f3dfc58bbc0536c089eac2dfe1068bb987f6924c (patch) | |
tree | c1446628e1d35b543b6ef8daf076afafb9f611be /integration/src/release_scripts/updateParentRef.sh | |
parent | 62b0f5d9ac022213751d19ee718932e2c268babe (diff) | |
parent | d7d9a664cb6d45b1019f8ac897feac512e5b37e8 (diff) |
Merge "Update release scripts for branches"
Diffstat (limited to 'integration/src/release_scripts/updateParentRef.sh')
-rwxr-xr-x | integration/src/release_scripts/updateParentRef.sh | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/integration/src/release_scripts/updateParentRef.sh b/integration/src/release_scripts/updateParentRef.sh index 0f10cfbb..0f72aa53 100755 --- a/integration/src/release_scripts/updateParentRef.sh +++ b/integration/src/release_scripts/updateParentRef.sh @@ -22,7 +22,7 @@ set -e -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") # Use the bash internal OSTYPE variable to check for MacOS if [[ "$OSTYPE" == "darwin"* ]] @@ -107,22 +107,24 @@ then exit 1 fi -pom_lines=`wc -l $pom_file | $SED 's/^[ \t]*//' | cut -f1 -d' '` -parent_start_line=`grep -n '^[\t ]*<parent>[\t ]*$' $pom_file | cut -f1 -d':'` -parent_end_line=`grep -n '^[\t ]*</parent>[\t ]*$' $pom_file | cut -f1 -d':'` +pom_lines=$(wc -l "$pom_file" | $SED 's/^[ \t]*//' | cut -f1 -d' ') +parent_start_line=$(grep -n '^[\t ]*<parent>[\t ]*$' "$pom_file" | cut -f1 -d':') +parent_end_line=$(grep -n '^[\t ]*</parent>[\t ]*$' "$pom_file" | cut -f1 -d':') pom_head_lines=$((parent_start_line-1)) pom_tail_lines=$((pom_lines-parent_end_line)) pom_temp_file=$(mktemp) -head -$pom_head_lines $pom_file > $pom_temp_file -echo " <parent>" >> $pom_temp_file -echo " <groupId>$group_id</groupId>" >> $pom_temp_file -echo " <artifactId>$artifact_id</artifactId>" >> $pom_temp_file -echo " <version>$version</version>" >> $pom_temp_file -echo " <relativePath />" >> $pom_temp_file -echo " </parent>" >> $pom_temp_file -tail -$pom_tail_lines $pom_file >> $pom_temp_file - -mv $pom_temp_file $pom_file +{ + head -$pom_head_lines "$pom_file" + echo " <parent>" + echo " <groupId>$group_id</groupId>" + echo " <artifactId>$artifact_id</artifactId>" + echo " <version>$version</version>" + echo " <relativePath />" + echo " </parent>" + tail -$pom_tail_lines "$pom_file" +} > "$pom_temp_file" + +mv "$pom_temp_file" "$pom_file" |