-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpatch-kernel.sh
executable file
·59 lines (52 loc) · 1.46 KB
/
patch-kernel.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
59
#!/bin/sh
set -eu
# Usage info
show_help() {
cat << EOF
Usage: ${0##*/} [-hv] [-k] [KERNEL VERSION]
Do stuff with FILE and write the result to standard output. With no FILE
or when FILE is -, read standard input.
-a kernel architecture to use for search configuration file.
-h display this help and exit
-k use the kernel version for search configuration file.
-v verbose mode. Can be used multiple times for increased
verbosity.
EOF
}
# Initialize our own variables:
kernel_version=""
kernel_arch="amd64"
SCRIPT_DIR=$(cd "$(dirname "$0")"|| exit;pwd)
verbose=0
OPTIND=1
# Resetting OPTIND is necessary if getopts was used previously in the script.
# It is a good idea to make OPTIND local if you process options in a function.
while getopts a:hvk: opt; do
case $opt in
a)
kernel_arch=$OPTARG
;;
h)
show_help
exit 0
;;
v) verbose=$((verbose+1))
;;
k) kernel_version=$OPTARG
;;
*)
show_help >&2
exit 1
;;
esac
done
shift "$((OPTIND-1))" # Shift off the options and optional --.
kernel_arch_target="x86_64"
if [ "$kernel_arch" = "arm" ]; then
kernel_arch_target="arm"
fi
# End of file
for i in ../linux-patches/*.patch; do
echo "${i}"
yes "" | patch -p1 --no-backup-if-mismatch -f -N -s -d "${SCRIPT_DIR}"/kernel-sources/linux-*/ < "${i}";
done