0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-22 05:33:03 -05:00
LibreWolf/scripts/check-patchfail.sh

69 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2022-04-11 00:01:53 -05:00
tmpdir="tmpdir92"
if [ ! -f version ]; then
echo "error: 'version' does not exist. Are you in the right folder?"
exit 1
fi
firefox=firefox-$(cat version).source.tar.xz
if [ ! -f "$firefox" ]; then
echo "error: '$firefox' does not exist."
exit 1
fi
2022-04-13 06:05:14 -05:00
failed_patches=
2022-04-11 00:01:53 -05:00
2022-04-11 00:06:01 -05:00
echo "Removing '$tmpdir'..."
2022-04-11 00:01:53 -05:00
rm -rf $tmpdir
mkdir $tmpdir
cd $tmpdir
2022-04-11 00:06:01 -05:00
echo "Extracting '$firefox'..."
2022-04-11 00:01:53 -05:00
tar xf ../$firefox
cd firefox-$(cat ../version)
2022-04-11 00:06:01 -05:00
echo ""
echo "Testing patches..."
2022-04-11 04:35:30 -05:00
2022-06-01 13:15:40 -05:00
for curpatch in $(cat ../../assets/patches.txt); do
2022-04-11 04:35:30 -05:00
echo ""
2022-06-01 13:15:40 -05:00
echo "==> $curpatch:"
2022-04-11 04:35:30 -05:00
echo ""
2022-06-01 13:15:40 -05:00
patch $* -p1 -i ../../$curpatch > ../patch.tmp
2022-04-11 04:35:30 -05:00
cat ../patch.tmp
2022-06-01 13:15:40 -05:00
######################
2022-04-11 04:35:30 -05:00
s=""
for j in $(grep -n rej$ ../patch.tmp | awk '{ print $(NF); }'); do
s="$s $j"
2022-06-01 13:15:40 -05:00
echo "---[snip]---------- --> $j:"
cat $j
echo "---[snip]----------"
2022-04-11 04:35:30 -05:00
done
s=$s
2022-06-01 13:15:40 -05:00
2022-04-11 04:35:30 -05:00
if [ ! -z "$s" ]; then
2022-06-01 13:15:40 -05:00
failed_patches="$failed_patches [$curpatch]"
2022-04-11 04:35:30 -05:00
fi
2022-06-01 13:15:40 -05:00
#######################
2022-04-11 04:35:30 -05:00
rm -f ../patch.tmp
#patch -R -p1 -i ../../$i
2022-04-11 00:01:53 -05:00
done
cd ../..
2022-04-11 04:35:30 -05:00
echo ""
2022-04-11 00:06:01 -05:00
echo "Removing '$tmpdir'..."
2022-04-11 00:01:53 -05:00
rm -rf $tmpdir
2022-04-13 06:05:14 -05:00
echo ""
if [ ! -z "$failed_patches" ]; then
echo $failed_patches
echo ""
echo "error: Some patches failed!"
exit 1
else
echo "success: All patches where applied successfully."
exit 0
fi