From b99dbd3ae3a3f439335c8d56d9e3a641a35fe566 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 29 May 2012 14:30:26 +0200 Subject: [PATCH] dracut: add support for kernel hooks. --- srcpkgs/dracut/files/kernel-hook-postinst | 15 +++++++++++++++ srcpkgs/dracut/files/kernel-hook-postrm | 13 +++++++++++++ srcpkgs/dracut/template | 10 +++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/dracut/files/kernel-hook-postinst create mode 100644 srcpkgs/dracut/files/kernel-hook-postrm diff --git a/srcpkgs/dracut/files/kernel-hook-postinst b/srcpkgs/dracut/files/kernel-hook-postinst new file mode 100644 index 00000000000..4454e7a0fe9 --- /dev/null +++ b/srcpkgs/dracut/files/kernel-hook-postinst @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Kernel post-install hook for dracut. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +if [ ! -x /usr/bin/dracut ]; then + exit 0 +fi + +dracut --xz --force ${VERSION} +exit $? diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm new file mode 100644 index 00000000000..f35d076193b --- /dev/null +++ b/srcpkgs/dracut/files/kernel-hook-postrm @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Kernel post-remove hook for dracut. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +if [ -f /boot/initramfs-${VERSION}.img ]; then + rm -f /boot/initramfs-${VERSION}.img +fi +exit $? diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template index 2fb83ef6de5..bc2ae9a4f9f 100644 --- a/srcpkgs/dracut/template +++ b/srcpkgs/dracut/template @@ -1,7 +1,7 @@ # Template file for 'dracut' pkgname=dracut version=018 -revision=2 +revision=3 noarch=yes build_style=gnu-makefile make_build_args="sysconfdir=/etc systemdsystemunitdir=/lib/systemd/system" @@ -36,3 +36,11 @@ pre_install() { # fix path to busybox. sed -i "s|/sbin/busybox|/bin/busybox|g" modules.d/05busybox/module-setup.sh } + +post_install() { + # kernel hooks. + vinstall ${FILESDIR}/kernel-hook-postinst \ + 755 etc/kernel.d/post-install 10-dracut + vinstall ${FILESDIR}/kernel-hook-postrm \ + 755 etc/kernel.d/post-remove 10-dracut +}