summaryrefslogtreecommitdiff
path: root/patch.sh
blob: fc1a6a3d6b1bdcc5682fdf51de888ab1aaa30787 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /bin/bash

cd $1

for pch in ../*.patch; do
	printf "Applying patch %s...\n" "$pch"
	patch -Np1 < "$pch" | sed 's/^/--> /g'
	if [ "$?" == "0" ]; then
		printf "[OK] Applying patch %s [OK]\n" "$pch"
	else
		printf "[ERR!!!] Applying patch %s [ERR!!!]\n" "$pch"
		if [ "$2" != "skip" ]; then
			echo "assuming error is critical, aborting\n"
			exit 1
		fi
	fi

	touch ../patch.ok
done