From efa42422cd6247054a1ecab5afea82c060a23160 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Sun, 3 Mar 2024 21:19:09 +0900 Subject: [PATCH] BSD sed inplace args fix --- sysroot/relocate-sdk.patch | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/sysroot/relocate-sdk.patch b/sysroot/relocate-sdk.patch index 74e00a7..e27315b 100644 --- a/sysroot/relocate-sdk.patch +++ b/sysroot/relocate-sdk.patch @@ -1,16 +1,26 @@ diff --git a/relocate-sdk.sh b/relocate-sdk.sh --- a/relocate-sdk.sh (date 1687254851000) -+++ b/relocate-sdk.sh (date 1687703200191) -@@ -43,10 +43,10 @@ ++++ b/relocate-sdk.sh (date 1699325031602) +@@ -39,14 +39,20 @@ + + # Make sure file uses the right language + export LC_ALL=C ++# Proper in-place argument for sed ++if sed --version 1>/dev/null 2>&1; then ++ SED_INPLACE_ARGS="-i" ++else # BSD sed ++ SED_INPLACE_ARGS="-i ''" ++fi + # Replace the old path with the new one in all text files grep -lr "${OLDPATH}" . | while read -r FILE ; do if file -b --mime-type "${FILE}" | grep -q '^text/' && [ "${FILE}" != "${LOCFILE}" ] then - sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}" -+ sed -i "" "s|${OLDPATH}|${NEWPATH}|g" "${FILE}" ++ sed ${SED_INPLACE_ARGS} "s|${OLDPATH}|${NEWPATH}|g" "${FILE}" fi done - + # At the very end, we update the location file to not break the # SDK if this script gets interruted. -sed -i "s|${OLDPATH}|${NEWPATH}|g" ${LOCFILE} -+sed -i "" "s|${OLDPATH}|${NEWPATH}|g" ${LOCFILE} ++sed ${SED_INPLACE_ARGS} "s|${OLDPATH}|${NEWPATH}|g" ${LOCFILE}