1
|
flash_kernel() {
|
2
|
if mountpoint -q /boot; then
|
3
|
major=$(mountpoint -d /boot | cut -f 1 -d ':')
|
4
|
minor=$(mountpoint -d /boot | cut -f 2 -d ':')
|
5
|
else
|
6
|
major=$(mountpoint -d / | cut -f 1 -d ':')
|
7
|
minor=$(mountpoint -d / | cut -f 2 -d ':')
|
8
|
fi
|
9
|
device=$(awk {'if ($1 == "'$major'" && $2 == "'$minor'") print $4 '} /proc/partitions)
|
10
|
device="/dev/${device/%2/1}"
|
11
|
|
12
|
echo "A new kernel version needs to be flashed onto $device."
|
13
|
echo "Do you want to do this now? [y|N] "
|
14
|
read -r shouldwe
|
15
|
if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
16
|
dd if=/boot/vmlinux.kpart of=$device
|
17
|
sync
|
18
|
else
|
19
|
echo "You can do this later by running:"
|
20
|
echo "# dd if=/boot/vmlinux.kpart of=$device"
|
21
|
fi
|
22
|
}
|
23
|
|
24
|
post_install () {
|
25
|
flash_kernel
|
26
|
}
|
27
|
|
28
|
post_upgrade() {
|
29
|
flash_kernel
|
30
|
}
|