-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlate_cmd
47 lines (36 loc) · 1.08 KB
/
late_cmd
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
#!/bin/sh -ex
gpg_key=60AA7B6F30434AE68E569963E50C6A0917C622B0
prefix="http://kernel.ubuntu.com/~kernel-ppa/mainline"
# otherwise, gpg keyring will be written to /
export HOME=/root
# Get latest version
version=`wget -O - -- "$prefix" | sed -n 's,.*href="\(v4\.[0-9]\+\(\.[0-9]\+\)\?\)/".*,\1,p' | sort -V | tail -n 1`
[ -n "$version" ]
echo "Install kernel version $version"
tmp=`mktemp -d`
cd -- "$tmp"
# Download and verify checksums
gpg --keyserver keyserver.ubuntu.com --recv-key "$gpg_key"
wget -O CHECKSUMS "$prefix/$version/CHECKSUMS"
wget -O CHECKSUMS.gpg "$prefix/$version/CHECKSUMS.gpg"
gpg --verify CHECKSUMS.gpg CHECKSUMS
# Download kernel debs
awk '/amd64.deb|all.deb/{print $2}' "$tmp/CHECKSUMS" | grep -v lowlatency | sort -u | while read deb; do
wget -O "$deb" "$prefix/$version/$deb"
done
# verify kernel debs
sha256sum -c --ignore-missing CHECKSUMS
# mount sysfs
need_umount=no
if mount -t sysfs sysfs /sys; then
need_umount=yes
fi
# install new kernel
dpkg -i *.deb
# unmount sysfs
if [ $need_umount = yes ]; then
umount /sys
fi
# cleanup
cd /
rm -r -- "$tmp"