[arch-dev-public] [PATCH 1/1] move initramfs generation from install script to pacman hook

Christian Hesse list at eworm.de
Wed May 18 11:55:40 UTC 2016


From: Christian Hesse <mail at eworm.de>

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 PKGBUILD             |  5 +++++
 linux-initramfs.hook | 11 +++++++++++
 linux.install        |  4 ----
 3 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 linux-initramfs.hook

diff --git a/PKGBUILD b/PKGBUILD
index 1a40499..1ba2e60 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -20,6 +20,7 @@ source=("https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz"
         'config' 'config.x86_64'
         # standard config files for mkinitcpio ramdisk
         'linux.preset'
+        'linux-initramfs.hook'
         'change-default-console-loglevel.patch')
 
 sha256sums=('a93771cd5a8ad27798f22e9240538dfea48d3a2bf2a6a6ab415de3f02d25d866'
@@ -27,6 +28,7 @@ sha256sums=('a93771cd5a8ad27798f22e9240538dfea48d3a2bf2a6a6ab415de3f02d25d866'
             'b32a4fbd92cf561bca86bb65319a16be853fb8ea7bdd5f12974bd0d054d4c1f9'
             'e91660a413baa66fb3269f03ceb85bda1df493b2fec404e9bb0269ad9a2d67a8'
             'f0d90e756f14533ee67afda280500511a62465b4f76adcc5effa95a40045179c'
+            '2d4424928ae3c5f63ee618b4685580f4bd24faf1778553dbd961f85a88ea0910'
             '1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99')
 validpgpkeys=(
               'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
@@ -144,6 +146,9 @@ _package() {
 
   # add vmlinux
   install -D -m644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux" 
+
+  # install pacman hook
+  install -D -m644 "${srcdir}/linux-initramfs.hook" "${pkgdir}/usr/share/libalpm/hooks/linux-initramfs.hook"
 }
 
 _package-headers() {
diff --git a/linux-initramfs.hook b/linux-initramfs.hook
new file mode 100644
index 0000000..a32248e
--- /dev/null
+++ b/linux-initramfs.hook
@@ -0,0 +1,11 @@
+[Trigger]
+Type = File
+Operation = Install
+Operation = Upgrade
+Target = boot/vmlinuz-linux
+Target = usr/lib/initcpio/*
+
+[Action]
+Description = Updating Arch Linux initramfs image
+When = PostTransaction
+Exec = /usr/bin/mkinitcpio -p linux
diff --git a/linux.install b/linux.install
index dd2fa5c..15dc8b6 100644
--- a/linux.install
+++ b/linux.install
@@ -8,8 +8,6 @@ post_install () {
   # updating module dependencies
   echo ">>> Updating module dependencies. Please wait ..."
   depmod ${KERNEL_VERSION}
-  echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..."
-  mkinitcpio -p linux${KERNEL_NAME}
 }
 
 post_upgrade() {
@@ -20,8 +18,6 @@ post_upgrade() {
   # updating module dependencies
   echo ">>> Updating module dependencies. Please wait ..."
   depmod ${KERNEL_VERSION}
-  echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..."
-  mkinitcpio -p linux${KERNEL_NAME}
 
   if [ $(vercmp $2 3.13) -lt 0 ]; then
     echo ">>> WARNING: AT keyboard support is no longer built into the kernel."
-- 
2.8.2


More information about the arch-dev-public mailing list