FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 03-04-2011, 11:55 AM
Ben Hutchings
 
Default 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>
---
kernel/postinst.d/initramfs-tools | 23 ++++++++++-------------
kernel/postrm.d/initramfs-tools | 23 ++++++++++-------------
update-initramfs | 29 ++++++++++++++++++++---------
3 files changed, 40 insertions(+), 35 deletions(-)

diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools
index b36d713..18202e4 100755
--- a/kernel/postinst.d/initramfs-tools
+++ b/kernel/postinst.d/initramfs-tools
@@ -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}" -a "$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
diff --git a/kernel/postrm.d/initramfs-tools b/kernel/postrm.d/initramfs-tools
index 36fb61f..850dda0 100755
--- a/kernel/postrm.d/initramfs-tools
+++ b/kernel/postrm.d/initramfs-tools
@@ -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}" -a "$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
diff --git a/update-initramfs b/update-initramfs
index ba17260..96bcb1f 100755
--- a/update-initramfs
+++ b/update-initramfs
@@ -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()
{
--
1.7.4.1
 
Old 03-27-2011, 07:41 PM
maximilian attems
 
Default update-initramfs: Depend on kernel hook scripts rather than $ramdisk invocation

On Fri, 04 Mar 2011, Ben Hutchings wrote:

> 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>
> ---
> kernel/postinst.d/initramfs-tools | 23 ++++++++++-------------
> kernel/postrm.d/initramfs-tools | 23 ++++++++++-------------
> update-initramfs | 29 ++++++++++++++++++++---------
> 3 files changed, 40 insertions(+), 35 deletions(-)
>

thank you applied with minor change and pushed out to ben/hook_pol.


--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110327194136.GC22442@stro.at">http://lists.debian.org/20110327194136.GC22442@stro.at
 

Thread Tools




All times are GMT. The time now is 11:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org