blob: 2cbda8a34fe97f8734c949ea51908bbe45dca6fd (
plain)
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
|
#!/bin/sh
#
# Author: Laura Abbott <labbott@fedoraproject.org>
#
# Apply a stable patch update to the Fedora tree. This takes care of
# - Downloading the patch from kernel.org
# - Uploading the source file
# - Removing old patch files
# - Updating the spec file stable version
# - Adding a proper changelog entry
#
# Based on steps from https://fedoraproject.org/wiki/Kernel/DayToDay#Stable_kernel_update
#
# Args: Stable version to update (e.g. 4.7.7, 4.8.1)
# update orgin
~/usr/bin/vanilla-kernel-helper.sh masterupdate
currentbranch=$(git symbolic-ref --short HEAD)
git merge --no-edit origin/${currentbranch%-user-thl-vanilla-fedora} || exit 1
if [ $# -lt 1 ]; then
echo "Need a version"
exit 1
fi
VERSION=`echo $1 | cut -d . -f 1`
if [ -z $VERSION ]; then
echo "Malformed version $1"
exit 1
fi
PATCHLEVEL=`echo $1 | cut -d . -f 2`
if [ -z $VERSION ]; then
echo "Malformed version $1"
exit 1
fi
SUBLEVEL=`echo $1 | cut -d . -f 3`
if [ -z $VERSION ]; then
echo "Malformed version $1"
exit 1
fi
if [ ! -f patch-$1.xz ]; then
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-$1.xz
if [ ! $? -eq 0 ]; then
echo "Download fail"
exit 1
fi
fi
if [ ! -f "patch-$1.sign" ]; then
wget "https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-$1.sign"
if [ ! $? -eq 0 ]; then
echo "Signature download failed"
exit 1
fi
fi
xzcat "patch-$1.xz" | gpg2 --verify "patch-$1.sign" -
if [ ! $? -eq 0 ]; then
echo "Patch file has invalid or untrusted signature!"
echo "See https://www.kernel.org/category/signatures.html"
exit 1
fi
grep $1 sources &> /dev/null
if [ ! $? -eq 0 ]; then
# thl is not an allowed uploader, skip this
# fedpkg upload patch-$1.xz
checksum=$(sha512sum patch-$1.xz)
echo "SHA512 (patch-$1.xz) = ${checksum:0:128}" >> sources
# Cryptic awk: search for the previous patch level (if one exists) and
# remove it from the source file
awk -v VER=$VERSION.$PATCHLEVEL.$((SUBLEVEL-1)) '$0 !~ VER { print $0; }' < sources > sources.tmp
mv sources.tmp sources
fi
# Update the stable level
awk -v STABLE=$SUBLEVEL '/%define stable_update/ \
{ print "%define stable_update " STABLE } \
!/%define stable_update/ { print $0 }' \
< kernel.spec > kernel.spec.tmp
mv kernel.spec.tmp kernel.spec
# Reset the base release for use with rpmdev-bumpspec
BASERELEASE=`cat kernel.spec | grep "%global baserelease" | cut -d ' ' -f 3 | head -c 1`50
#BASERELEASE=$(($BASERELEASE-1))
BASERELEASE=$BASERELEASE perl -p -i -e 's|%global baserelease.*|%global baserelease $ENV{'BASERELEASE'}|' kernel.spec
# do not generate changelog: avoids merge conflicts that are not worth the trouble
# rpmdev-bumpspec -c "Linux v$1" kernel.spec
git diff kernel.spec sources
sleep 1 || exit 1
git commit -m "Linux v$1" kernel.spec sources
|