forked from bmc08gt/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel-merge
More file actions
executable file
·101 lines (80 loc) · 2.04 KB
/
Copy pathkernel-merge
File metadata and controls
executable file
·101 lines (80 loc) · 2.04 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# Script to make pulling down upstream kernel revisions
#set -x
here=`pwd`
upstream=/elmo/source/3.10.y
#debugging flag
debug=false
# accept input as desired upstream kernel revision
revision=$1
print=$2 # y or n
# variables used in script
revision_file=
version=
patchlevel=
sublevel=
# print out of supported releases and patchlevels
supported_releases="3.x"
supported_3_patchlevels="3.0, 3.4, 3.10"
#####
if [ -z $revision ]; then
echo "Desired revision not provided..."
exit 0
fi
function get_kernel_specs() {
version=$(echo $revision | cut -d '.' -f1)
patchlevel=$(echo $revision | cut -d '.' -f2)
sublevel=$(echo $revision | cut -d '.' -f3)
if [ "$version" != "3" ]; then
echo "Supported linux kernel releases are ${supported_releases}"
exit 0
fi
if [ "$patchlevel" != "0" ] && [ "$patchlevel" != "4" ] && [ "$patchlevel" != "10" ]; then
echo "Supported patchlevels of linux release $version.x are ${supported_3_patchlevels}"
exit 0
fi
}
function fetch_upstream() {
branch=linux-$version.$patchlevel.y
if git ls-remote linux > /dev/null; then
git fetch linux $branch
else
git remote add linux https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch linux $branch
fi
}
function create_array() {
# Create array of commit SHA1's for cherry-picking
cd $upstream
git fetch linux
presublevel=$(($sublevel-1))
prerevision=${version}.${patchlevel}.${presublevel}
list=`git rev-list HEAD --reverse --no-merges v${prerevision}..v${revision}`
if [ "$print" == "y" ]; then
print_array
cd -
exit 0
fi
cd -
}
function print_array() {
for commit in ${list[@]}; do
echo $commit
done
}
function pick() {
for commit in ${list[@]}; do
git cherry-pick $commit
done
}
function checkout_staging_branch() {
git checkout -b $revision
}
function run() {
get_kernel_specs
fetch_upstream
create_array
checkout_staging_branch
pick
}
run