diff options
author | Jake Potrebic <[email protected]> | 2020-11-19 07:47:22 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-19 10:47:22 -0500 |
commit | e6d7bdca1d2bb0fb752ccfac2882f32a2a61d088 (patch) | |
tree | 4d39fbcce8e7f003a4b2127f72b7186ca4adcc31 /scripts | |
parent | 7ae47d4eb33fd7b2baf6c80a95afa4ff1c1d15e3 (diff) | |
download | Paper-e6d7bdca1d2bb0fb752ccfac2882f32a2a61d088.tar.gz Paper-e6d7bdca1d2bb0fb752ccfac2882f32a2a61d088.zip |
[CI-SKIP] fixed sed -i for bsd sed (#4782)
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/init.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/init.sh b/scripts/init.sh index 25aa24bcf7..3b85343d6c 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -11,6 +11,18 @@ nms="$spigotdecompiledir/net/minecraft/server" cb="src/main/java/net/minecraft/server" gitcmd="git -c commit.gpgsign=false" +# https://stackoverflow.com/a/38595160 +# https://stackoverflow.com/a/800644 +if sed --version >/dev/null 2>&1; then + strip_cr() { + sed -i -- "s/\r//" "$@" + } +else + strip_cr () { + sed -i "" "s/$(printf '\r')//" "$@" + } +fi + patch=$(which patch 2>/dev/null) if [ "x$patch" == "x" ]; then patch="$basedir/hctap.exe" @@ -53,7 +65,7 @@ do echo "Patching $file < $patchFile" set +e - sed -i 's/\r//' "$nms/$file" > /dev/null + strip_cr "$nms/$file" > /dev/null set -e "$patch" -s -d src/main/java/ "net/minecraft/server/$file" < "$patchFile" |