Fix script so that it works with GNU `sed`

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2018-06-11 14:53:37 +02:00
parent 4ba78de407
commit e3d86beab2
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
1 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,10 @@ usage() {
printf " %s develop-g12345678\n" "$(basename "$0")" printf " %s develop-g12345678\n" "$(basename "$0")"
} }
sedi () {
sed --version >/dev/null 2>&1 && sed -i -- "$@" || sed -i "" "$@"
}
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage usage
exit 1 exit 1
@ -23,5 +27,5 @@ fi
STATUSGO_VERSION=$1 STATUSGO_VERSION=$1
sed -i '' -e "s/\(<version>\).*\(<\/version>\)/\1$STATUSGO_VERSION\2/" modules/react-native-status/ios/RCTStatus/pom.xml sedi "s/\(<version>\).*\(<\/version>\)/\1$STATUSGO_VERSION\2/" modules/react-native-status/ios/RCTStatus/pom.xml
sed -i '' -e "s/\(statusGoVersion = '\).*\('\)/\1$STATUSGO_VERSION\2/" modules/react-native-status/android/build.gradle sedi "s/\(statusGoVersion = '\).*\('\)/\1$STATUSGO_VERSION\2/" modules/react-native-status/android/build.gradle