mirror of
https://salsa.debian.org/kernel-team/initramfs-tools.git
synced 2026-01-26 15:39:08 +00:00
update-initramfs: Depend on kernel hook scripts rather than $ramdisk invocation
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>
This commit is contained in:
parent
58ee42c5eb
commit
7866542a5d
@ -9,19 +9,16 @@ if [ -z "${version}" ]; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# kernel-package passes an extra arg
|
||||
# exit if custom kernel does not need an initramfs
|
||||
if [ -n "${KERNEL_PACKAGE_VERSION}" ] && [ "$INITRD" = 'No' ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# absolute file name of kernel image may be passed as a second argument;
|
||||
# create the initrd in the same directory
|
||||
if [ -n "$2" ]; then
|
||||
if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
|
||||
# exit if custom kernel does not need an initramfs
|
||||
if [ "$INITRD" = 'No' ]; then
|
||||
exit 0
|
||||
fi
|
||||
bootdir=$(dirname "$2")
|
||||
bootopt="-b ${bootdir}"
|
||||
else
|
||||
# official Debian linux-images take care themself
|
||||
exit 0
|
||||
fi
|
||||
bootdir=$(dirname "$2")
|
||||
bootopt="-b ${bootdir}"
|
||||
fi
|
||||
|
||||
# avoid running multiple times
|
||||
@ -33,4 +30,4 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then
|
||||
fi
|
||||
|
||||
# we're good - create initramfs. update runs do_bootloader
|
||||
update-initramfs -c -t -k "${version}" ${bootopt} >&2
|
||||
INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -t -k "${version}" ${bootopt} >&2
|
||||
|
||||
@ -9,19 +9,16 @@ if [ -z "${version}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# kernel-package passes an extra arg
|
||||
# exit if custom kernel does not need an initramfs
|
||||
if [ -n "${KERNEL_PACKAGE_VERSION}" ] && [ "$INITRD" = 'No' ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# absolute file name of kernel image may be passed as a second argument;
|
||||
# create the initrd in the same directory
|
||||
if [ -n "$2" ]; then
|
||||
if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
|
||||
# exit if custom kernel does not need an initramfs
|
||||
if [ "$INITRD" = 'No' ]; then
|
||||
exit 0
|
||||
fi
|
||||
bootdir=$(dirname "$2")
|
||||
bootopt="-b ${bootdir}"
|
||||
else
|
||||
# official linux-images take care themself
|
||||
exit 0
|
||||
fi
|
||||
bootdir=$(dirname "$2")
|
||||
bootopt="-b ${bootdir}"
|
||||
fi
|
||||
|
||||
# avoid running multiple times
|
||||
@ -33,4 +30,4 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then
|
||||
fi
|
||||
|
||||
# delete initramfs
|
||||
update-initramfs -d -t -k "${version}" ${bootopt} >&2
|
||||
INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -d -t -k "${version}" ${bootopt} >&2
|
||||
|
||||
@ -14,17 +14,28 @@ set -e
|
||||
|
||||
[ -r ${CONF} ] && . ${CONF}
|
||||
|
||||
if $USETRIGGERS \
|
||||
&& [ x"${DPKG_MAINTSCRIPT_PACKAGE:-}" != x ] \
|
||||
&& [ $# = 1 ] \
|
||||
&& [ x"$1" = x-u ] \
|
||||
&& dpkg-trigger --check-supported 2>/dev/null
|
||||
then
|
||||
if dpkg-trigger --no-await update-initramfs; then
|
||||
echo "update-initramfs: deferring update (trigger activated)"
|
||||
case "$DPKG_MAINTSCRIPT_PACKAGE" in
|
||||
linux-image-*)
|
||||
if [ -z "$INITRAMFS_TOOLS_KERNEL_HOOK" ]; then
|
||||
# kernel maintainer script called us directly; ignore
|
||||
# it and let the hook script handle it instead
|
||||
echo "update-initramfs: deferring update (hook will be called later)"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
?*)
|
||||
if $USETRIGGERS \
|
||||
&& [ $# = 1 ] \
|
||||
&& [ x"$1" = x-u ] \
|
||||
&& dpkg-trigger --check-supported 2>/dev/null
|
||||
then
|
||||
if dpkg-trigger --no-await update-initramfs; then
|
||||
echo "update-initramfs: deferring update (trigger activated)"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
usage()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user