From 5f51d84887eb1d26acd3125bb943b30c389d666b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 24 Apr 2023 23:49:23 +0200 Subject: [PATCH] i18n: support BSD sed in the txpush script --- ci/txpush.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ci/txpush.sh b/ci/txpush.sh index 449135790..666cddc4a 100755 --- a/ci/txpush.sh +++ b/ci/txpush.sh @@ -86,6 +86,15 @@ do done # XMLLINT is optional +if sed --version 2>&1 | grep -q GNU ; then + reinplace() { + sed -i'' "$@" + } +else + reinplace() { + sed -i '' "$@" + } +fi ### CREATE TRANSLATIONS # @@ -136,7 +145,7 @@ for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d | sort) ; d ${PYGETTEXT} -p ${MODULE_DIR}/lang -d ${MODULE_NAME} -o ${MODULE_NAME}.pot ${MODULE_DIR}/*.py POTFILE="${MODULE_DIR}/lang/${MODULE_NAME}.pot" if [ -f "$POTFILE" ]; then - sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE" + reinplace '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE" tx push --source -r calamares.${MODULE_NAME} fi else @@ -148,7 +157,7 @@ done if test -n "$SHARED_PYTHON" ; then ${PYGETTEXT} -p lang -d python -o python.pot $SHARED_PYTHON POTFILE="lang/python.pot" - sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE" + reinplace '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE" tx push --source -r calamares.python fi