]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - debian/templates/image.postinst.in
ACPI / CPPC: Fix invalid PCC channel status errors
[mirror_ubuntu-bionic-kernel.git] / debian / templates / image.postinst.in
1 #!/bin/sh
2 set -e
3
4 version=@abiname@@localversion@
5 image_path=/boot/@image-stem@-$version
6
7 #
8 # When we install linux-image we have to run kernel postinst.d support to
9 # generate the initramfs, create links etc. Should it have an associated
10 # linux-image-extra package and we install that we also need to run kernel
11 # postinst.d, to regenerate the initramfs. If we are installing both at the
12 # same time, we necessarily trigger kernel postinst.d twice. As this includes
13 # rebuilding the initramfs and reconfiguring the boot loader this is very time
14 # consuming.
15 #
16 # Similarly for removal when we remove the linux-image-extra package we need to
17 # run kernel postinst.d handling in order to pare down the initramfs to
18 # linux-image contents only. When we remove the linux-image need to remove the
19 # now redundant initramfs. If we are removing both at the same time, then
20 # we will rebuilt the initramfs and then immediatly remove it.
21 #
22 # Switches to using a trigger against the linux-image package for all
23 # postinst.d and postrm.d handling. On installation postinst.d gets triggered
24 # twice once by linux-image and once by linux-image-extra. As triggers are
25 # non-cumulative we will only run this processing once. When removing both
26 # packages we will trigger postinst.d from linux-image-extra and then in
27 # linux-image postrm.d we effectivly ignore the pending trigger and simply run
28 # the postrm.d. This prevents us from rebuilding the initramfs.
29 #
30 if [ "$1" = triggered ]; then
31 trigger=/usr/lib/linux/triggers/$version
32 if [ -f "$trigger" ]; then
33 sh "$trigger"
34 rm -f "$trigger"
35 fi
36 exit 0
37 fi
38
39 if [ "$1" != configure ]; then
40 exit 0
41 fi
42
43 depmod $version
44
45 if [ -f /lib/modules/$version/.fresh-install ]; then
46 change=install
47 else
48 change=upgrade
49 fi
50 linux-update-symlinks $change $version $image_path
51 rm -f /lib/modules/$version/.fresh-install
52
53 if [ -d /etc/kernel/postinst.d ]; then
54 mkdir -p /usr/lib/linux/triggers
55 cat - >/usr/lib/linux/triggers/$version <<EOF
56 DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \
57 --arg=$image_path /etc/kernel/postinst.d
58 EOF
59 dpkg-trigger --no-await linux-update-$version
60 fi
61
62 exit 0