Skip to content

Commit efa4242

Browse files
committed
BSD sed inplace args fix
1 parent e354610 commit efa4242

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

sysroot/relocate-sdk.patch

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
diff --git a/relocate-sdk.sh b/relocate-sdk.sh
22
--- a/relocate-sdk.sh (date 1687254851000)
3-
+++ b/relocate-sdk.sh (date 1687703200191)
4-
@@ -43,10 +43,10 @@
3+
+++ b/relocate-sdk.sh (date 1699325031602)
4+
@@ -39,14 +39,20 @@
5+
6+
# Make sure file uses the right language
7+
export LC_ALL=C
8+
+# Proper in-place argument for sed
9+
+if sed --version 1>/dev/null 2>&1; then
10+
+ SED_INPLACE_ARGS="-i"
11+
+else # BSD sed
12+
+ SED_INPLACE_ARGS="-i ''"
13+
+fi
14+
# Replace the old path with the new one in all text files
515
grep -lr "${OLDPATH}" . | while read -r FILE ; do
616
if file -b --mime-type "${FILE}" | grep -q '^text/' && [ "${FILE}" != "${LOCFILE}" ]
717
then
818
- sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}"
9-
+ sed -i "" "s|${OLDPATH}|${NEWPATH}|g" "${FILE}"
19+
+ sed ${SED_INPLACE_ARGS} "s|${OLDPATH}|${NEWPATH}|g" "${FILE}"
1020
fi
1121
done
12-
22+
1323
# At the very end, we update the location file to not break the
1424
# SDK if this script gets interruted.
1525
-sed -i "s|${OLDPATH}|${NEWPATH}|g" ${LOCFILE}
16-
+sed -i "" "s|${OLDPATH}|${NEWPATH}|g" ${LOCFILE}
26+
+sed ${SED_INPLACE_ARGS} "s|${OLDPATH}|${NEWPATH}|g" ${LOCFILE}

0 commit comments

Comments
 (0)