0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-21 21:23:08 -05:00
LibreWolf/scripts/check-patchfail.sh
2022-06-01 20:15:40 +02:00

68 lines
1.3 KiB
Bash
Executable file

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
failed_patches=
echo "Removing '$tmpdir'..."
rm -rf $tmpdir
mkdir $tmpdir
cd $tmpdir
echo "Extracting '$firefox'..."
tar xf ../$firefox
cd firefox-$(cat ../version)
echo ""
echo "Testing patches..."
for curpatch in $(cat ../../assets/patches.txt); do
echo ""
echo "==> $curpatch:"
echo ""
patch $* -p1 -i ../../$curpatch > ../patch.tmp
cat ../patch.tmp
######################
s=""
for j in $(grep -n rej$ ../patch.tmp | awk '{ print $(NF); }'); do
s="$s $j"
echo "---[snip]---------- --> $j:"
cat $j
echo "---[snip]----------"
done
s=$s
if [ ! -z "$s" ]; then
failed_patches="$failed_patches [$curpatch]"
fi
#######################
rm -f ../patch.tmp
#patch -R -p1 -i ../../$i
done
cd ../..
echo ""
echo "Removing '$tmpdir'..."
rm -rf $tmpdir
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