Fix sed on linux

This commit is contained in:
Matt Keeler 2018-06-22 17:21:42 -04:00
parent d48e2664b4
commit 9862175481
2 changed files with 6 additions and 4 deletions

View File

@ -32,8 +32,10 @@ CONSUL_PKG_NAME="consul"
if test "$(uname)" == "Darwin"
then
SED_EXT="-E"
alias sed_i="sed -i ''"
else
SED_EXT=""
alias sed_i="sed -i"
fi
CONSUL_BINARY_TYPE=oss
CONSUL_BINARY_TYPE=oss

View File

@ -623,7 +623,7 @@ function update_version {
local version="$2"
local prerelease="$3"
sed ${SED_EXT} -i "" -e "s/(Version[[:space:]]*=[[:space:]]*)\"[^\"]*\"/\1\"${version}\"/g" -e "s/(VersionPrerelease[[:space:]]*=[[:space:]]*)\"[^\"]*\"/\1\"${prerelease}\"/g" "${vfile}"
sed_i ${SED_EXT} -e "s/(Version[[:space:]]*=[[:space:]]*)\"[^\"]*\"/\1\"${version}\"/g" -e "s/(VersionPrerelease[[:space:]]*=[[:space:]]*)\"[^\"]*\"/\1\"${prerelease}\"/g" "${vfile}"
return $?
}
@ -658,7 +658,7 @@ function set_changelog_version {
rel_date=$(date +"%B %d, %Y")
fi
sed ${SED_EXT} -i "" -e "s/## UNRELEASED/## ${version} (${rel_date})/" "${changelog}"
sed_i ${SED_EXT} -e "s/## UNRELEASED/## ${version} (${rel_date})/" "${changelog}"
return $?
}
@ -678,7 +678,7 @@ function unset_changelog_version {
return 1
fi
sed ${SED_EXT} -i "" -e "1 s/^## [0-9]+\.[0-9]+\.[0-9]+ \([^)]*\)/## UNRELEASED/" "${changelog}"
sed_i ${SED_EXT} -e "1 s/^## [0-9]+\.[0-9]+\.[0-9]+ \([^)]*\)/## UNRELEASED/" "${changelog}"
return $?
}