mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-05-02 09:02:58 +00:00
Fix bashisms in patch-rework.sh script
This script has a '#!/bin/sh' shabang and might be running on a POSIX shell. So replace bash-specific constructions (pushd/popd, for((...)), read with '-u' option) to POSIX-shell equivalents. Signed-off-by: Led ledest@gmail.com
This commit is contained in:
parent
767aa9befc
commit
b50cde605a
@ -67,10 +67,10 @@ do_check_files_at_depth() {
|
|||||||
exec 6<&0
|
exec 6<&0
|
||||||
exec 7<"${flist}"
|
exec 7<"${flist}"
|
||||||
|
|
||||||
while read -u7 f; do
|
while read f; do
|
||||||
f="$( echo "${f}" |sed -r -e "s:^([^/]+/){${depth}}::;" )"
|
f="$( echo "${f}" |sed -r -e "s:^([^/]+/){${depth}}::;" )"
|
||||||
[ -f "${f}" ] || ret=1
|
[ -f "${f}" ] || ret=1
|
||||||
done
|
done </dev/fd/7
|
||||||
|
|
||||||
exec 7<&-
|
exec 7<&-
|
||||||
exec <&6
|
exec <&6
|
||||||
@ -106,16 +106,18 @@ $1=="+++" && mark==1 { nextfile; }
|
|||||||
>"diffstat.orig"
|
>"diffstat.orig"
|
||||||
printf " done\n"
|
printf " done\n"
|
||||||
|
|
||||||
pushd "${base}" >/dev/null 2>&1
|
cd "${base}"
|
||||||
|
|
||||||
# Check all files exist, up to depth 3
|
# Check all files exist, up to depth 3
|
||||||
printf " checking depth:"
|
printf " checking depth:"
|
||||||
for((d=0;d<4;d++)); do
|
d=0
|
||||||
|
while [ $d -lt 4 ]; do
|
||||||
printf " ${d}"
|
printf " ${d}"
|
||||||
if do_check_files_at_depth "../diffstat.orig" ${d}; then
|
if do_check_files_at_depth "../diffstat.orig" ${d}; then
|
||||||
printf " ok, using depth '${d}'\n"
|
printf " ok, using depth '${d}'\n"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
d=$((d + 1))
|
||||||
done
|
done
|
||||||
if [ ${d} -ge 4 ]; then
|
if [ ${d} -ge 4 ]; then
|
||||||
printf "\n"
|
printf "\n"
|
||||||
@ -133,7 +135,7 @@ $1=="+++" && mark==1 { nextfile; }
|
|||||||
printf " applying patch..."
|
printf " applying patch..."
|
||||||
if ! patch -g0 -F1 -f -p${d} <"${p}" >"../patch.out" 2>&1; then
|
if ! patch -g0 -F1 -f -p${d} <"${p}" >"../patch.out" 2>&1; then
|
||||||
printf " ERROR\n\n"
|
printf " ERROR\n\n"
|
||||||
popd >/dev/null 2>&1
|
cd - >/dev/null
|
||||||
printf "There was an error while applying:\n --> ${p} <--\n"
|
printf "There was an error while applying:\n --> ${p} <--\n"
|
||||||
printf "'${base}' was restored to the state it was prior to applying this faulty patch.\n"
|
printf "'${base}' was restored to the state it was prior to applying this faulty patch.\n"
|
||||||
printf "Here's the 'patch' command, and its output:\n"
|
printf "Here's the 'patch' command, and its output:\n"
|
||||||
@ -149,7 +151,7 @@ $1=="+++" && mark==1 { nextfile; }
|
|||||||
find . -type f -name '*.orig' -exec rm -f {} +
|
find . -type f -name '*.orig' -exec rm -f {} +
|
||||||
printf " done\n"
|
printf " done\n"
|
||||||
|
|
||||||
popd >/dev/null 2>&1
|
cd - >/dev/null
|
||||||
|
|
||||||
printf " re-diffing the patch..."
|
printf " re-diffing the patch..."
|
||||||
printf "%s\n\n" "${comment}" >"${dst}/${pname}"
|
printf "%s\n\n" "${comment}" >"${dst}/${pname}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user