Ubuntu's dracut package ships an `update-initramfs` command with the
same interface as initramfs-tools'. The difference is that it calls
dracut instead of mkinitramfs.
When installing dracut without purging initramfs-tools,
`/etc/kernel/postinst.d/initramfs-tools` will still execute
`update-initramfs` (in addition to dracut's kernel postinst hook).
So query the newly add `--version` parameter to determine which package
provided the `update-initramfs` script. Only run the kernel postinst
hook when the provider matches.
Scripts can be run as `sh $script`. In this case `-e` on the shebang is
ignored.
So explicitly call `set -e` instead of specifying `-e` on the shebang.
The direct invocation of update-initramfs in kernel package maintainer
scripts was removed in:
- Debian linux 2.6.39-1, thus in wheezy
- Ubuntu linux 4.15.0-18.19 (I think), thus in bionic
- kernel-package 12.001, thus in Debian squeeze and Ubuntu lucid
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Sometimes globbing and word splitting is wanted. Therefore explicitly
disable the check for these line.
Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
This reverts commit b19d13e7049cc971aeaec30cb06740056407ddf6.
Binary packages built by linux-signed now contain a full kernel
and invoke the same hook scripts.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
We test whether /usr/sbin/update-initramfs exists, but then invoke it
as 'update-initramfs'. Change the test to look in $PATH.
Closes: #768913
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
when creating kernel package by other means than make-kpkg
(e.g. using the kernel's make deb-pkg target), initrd creation
cannot be disabled easily, since the appropriate script checks
whether $KERNEL_PACKAGE_VERSION is set, for a reason that seems
entirely unclear to me. The patch below removes the superfluous
check.
Remove it from postrm script too. -maks
Closes: #664171
Signed-off-by: maximilian attems <max@stro.at>
When removing initramfs-tools, it leaves the kernel script around,
which now fails at:
/etc/kernel/postinst.d/initramfs-tools: update-initramfs: not found
Closes: #669345
[ Make that patch applyable -maks ]
Signed-off-by: maximilian attems <max@stro.at>
Official Debian and Ubuntu kernel packages will invoke us directly as
part of the $ramdisk handling inherited from kernel-package. They
will later run our hook script, as will custom packages made with
'make-kpkg' or the upstream 'make deb-pkg'.
Currently, for official packages we perform an update on the first
invocation (possibly deferred using dpkg triggers) and then ignore the
second. However, the long-term plan is to remove that first
invocation. Therefore, ignore the first invocation and perform the
update on the second.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[ Use && op, we make the effort to not use -a evaluation. -maks ]
Signed-off-by: maximilian attems <max@stro.at>
Reviewed-by: Michael Prokop <mika@debian.org>
We should not continue after a command unexpectedly fails.
Change the $INITRD test so that failure is not treated as unexpected.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: maximilian attems <max@stro.at>
Reviewed-by: Michael Prokop <mika@debian.org>
The version argument is mandatory and we should complain if some package
doesn't pass it rather than quietly failing to do our job.
However, making package removal fail is generally unhelpful, so
continue to return 0 from the postrm hook.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[ Prefix new warnings as of 3a02c6f37d with W: -maks ]
Signed-off-by: maximilian attems <max@stro.at>
Reviewed-by: Michael Prokop <mika@debian.org>
Do not create an initial RAM file system image for a custom kernel
created by make-kpkg if one was not requested by the --initrd flag of
make-kpkg.
Signed-off-by: maximilian attems <maks@debian.org>
/etc/kernel/postrm.d/initramfs-tools: line 12: =: command not found
It says:
${bootdir}= $(dirname "$2")
which should be:
bootdir=$(dirname "$2")
Tested-by: Matthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: maximilian attems <maks@debian.org>
This reverts commit c5a45496b9c72e41333e213979d43fbcff34da9f.
hinders removal of other package linux-image postinst call also
the /etc/kernel structure, thus delete needs a takeover and this
is postlenny material.
thanks Vincent Danjean <vdanjean@debian.org> for report.
(closes: #499270)