travis: fix 'sed -i' command for MacOS

This commit is contained in:
Ralph Lange
2019-11-19 11:26:50 +01:00
parent be057792d2
commit d84eb6e857

View File

@@ -2,6 +2,14 @@
# #
# This file is sourced by the executable scripts # This file is sourced by the executable scripts
# Portable version of 'sed -i' (that MacOS doesn't provide)
# sedi (cmd, file)
# Do the equivalent of "sed -i cmd file"
sedi () {
cat $2 | sed "$1" > $2.tmp$$; mv -f $2.tmp$$ $2
}
# Travis log fold control # Travis log fold control
# from https://github.com/travis-ci/travis-rubies/blob/build/build.sh # from https://github.com/travis-ci/travis-rubies/blob/build/build.sh
@@ -58,7 +66,7 @@ update_release_local() {
existing_line=$(grep "${var}=" ${release_local}) existing_line=$(grep "${var}=" ${release_local})
if [ "${existing_line}" != "${updated_line}" ] if [ "${existing_line}" != "${updated_line}" ]
then then
sed -i "s|${var}=.*|${var}=${place}|g" ${release_local} sedi "s|${var}=.*|${var}=${place}|g" ${release_local}
fi fi
else else
echo "$var=$place" >> ${release_local} echo "$var=$place" >> ${release_local}
@@ -67,7 +75,7 @@ update_release_local() {
if [ $ret -eq 0 ] if [ $ret -eq 0 ]
then then
base_line=$(grep "EPICS_BASE=" ${release_local}) base_line=$(grep "EPICS_BASE=" ${release_local})
sed -i 's|EPICS_BASE=||g' ${release_local} sedi 's|EPICS_BASE=||g' ${release_local}
echo ${base_line} >> ${release_local} echo ${base_line} >> ${release_local}
fi fi
fi fi