-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpatch.sh
executable file
·58 lines (48 loc) · 1.14 KB
/
patch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
BASEDIR=$(dirname "$0")
src_dir="HandBrake"
help="Usage: patch.sh [src_dir=\"HandBrake\"] [options]
The src_dir is the directory that contains the HandBrake source code (defaults to \"HandBrake\)
-c --clone -> option that clone the repo to src_dir
-h --help -> print usage message
If no directory is found, the program exits"
if [ "$#" -gt 2 ]; then
echo "$help"
exit 1
fi
for (( i=1; i <= "$#"; i++ )); do
case ${!i} in
-h | --help)
echo "$help"
exit 1
;;
-c | --clone)
if [ "$i" -lt "$#" ]; then
echo "$help"
exit 1
fi
rm -rf HandBrake
git clone https://github.com/HandBrake/HandBrake.git
;;
-*)
echo "${!i} option doesn't exists!"
echo "$help"
exit 1
;;
*)
src_dir=$1
;;
esac
done
if [ ! -d "$src_dir" ]; then
echo "$src_dir directory doesn't exists!"
echo "$help"
exit 1
fi
for filename in $BASEDIR/patches/*.patch; do
patch -t -N -p1 -d $src_dir < "$filename" || exit 1
done
# The flatpak build refers to the latest commit, so we add a commit that includes the patches
cd $src_dir
git add .
git -c user.name='deadbeef' -c user.email='deadbeef' commit -m "Patch"