Package: vmdebootstrap
Version: 1.0-1
Severity: wishlist
Tags: patch upstream

Dear Maintainer,

Currently, vmdebootstrap calls update-initramfs -u to update the
initramfs at the end. This will only support initramfs-tools, but not
alternative initramfs implementations such as dracut.

Instead of directly calling update-initramfs -u, a better way to update
the initramfs would be to tell dpkg to execute the proper triggers:

dpkg-trigger --by-package vmdebootstrap update-initramfs
dpkg --triggers-only -a

This will work with any initramfs implementation, regardless of which
initramfs is installed. It is also completely harmless if no package
that implements this is installed, so it may be run unconditionally.

I've attached a patch (against the codehelp/modules branch) that
implements this.

Would be great if that could be included in vmdebootstrap.

Regards,
Christian
From 4400c1a83b7178b6c7646c763393576750b5c0be Mon Sep 17 00:00:00 2001
From: Christian Seiler <christ...@iwakd.de>
Date: Wed, 7 Oct 2015 15:35:21 +0200
Subject: [PATCH 1/2] update_initramfs: support alternative initramfs
 implementations

Invoke dpkg triggers to update the initramfs. This way, alternative
initramfs implementations such as dracut will automatically be
supported.
---
 vmdebootstrap/filesystem.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vmdebootstrap/filesystem.py b/vmdebootstrap/filesystem.py
index 796f7d8..b9d784a 100644
--- a/vmdebootstrap/filesystem.py
+++ b/vmdebootstrap/filesystem.py
@@ -67,10 +67,12 @@ class Filesystem(Base):
         rootdir = self.devices['rootdir']
         if not rootdir:
             raise cliapp.AppException("rootdir not set")
-        cmd = os.path.join('usr', 'sbin', 'update-initramfs')
-        if os.path.exists(os.path.join(str(rootdir), cmd)):
-            self.message("Updating the initramfs")
-            runcmd(['chroot', rootdir, cmd, '-u'])
+        self.message("Updating the initramfs")
+        # we don't know if initramfs-tools or dracut is
+        # installed, so just tell dpkg to run the right
+        # trigger
+        runcmd(['chroot', rootdir, 'dpkg-trigger', '--by-package', 'vmdebootstrap', 'update-initramfs'])
+        runcmd(['chroot', rootdir, 'dpkg', '--triggers-only', '-a'])
 
     def setup_kpartx(self):
         bootindex = None
-- 
2.1.4

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to