Add dracut support
authorDaniel Winzen <daniel@danwin1210.de>
Fri, 1 Jul 2022 20:05:34 +0000 (22:05 +0200)
committerDaniel Winzen <daniel@danwin1210.de>
Fri, 1 Jul 2022 20:05:34 +0000 (22:05 +0200)
chroot-script
config
grml-debootstrap

index 101764d..25bd600 100755 (executable)
@@ -574,7 +574,12 @@ initrd() {
   # generate initrd
   if [ -n "$INITRD" ] ; then
      echo "Generating initrd."
-     update-initramfs -c -t -k "$KERNELVER"
+     if [ "$INITRD_GENERATOR" = 'dracut' ] ; then
+         DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL dracut
+         dracut -N --kver "$KERNELVER" --fstab --add-fstab /etc/fstab --force
+     else
+         update-initramfs -c -t -k "$KERNELVER"
+     fi
   fi
 }
 # }}}
diff --git a/config b/config
index fb55f21..107ef1a 100644 (file)
--- a/config
+++ b/config
 # Default: 'yes'
 # UPGRADE_SYSTEM='no'
 
-# Explicit generation of initrd via update-initramfs.
+# Explicit generation of initrd via selected initrd generator.
 # Default: 'yes'
 # INITRD='no'
 
+# Which generator to use for initrd creation.
+# Supported values: 'dracut', 'initramfs-tools'
+# Default: 'initramfs-tools'
+# INITRD_GENERATOR='initramfs-tools'
+
 # If the specified file exists its content will be displayed at the end of the
 # installation process.
 # Useful for checking for errors and display warning message.
index 9e5cee3..2ed2964 100755 (executable)
@@ -63,6 +63,7 @@ MNTPOINT="/mnt/debootstrap.$$"
 [ -n "$FORCE" ] || FORCE=''
 [ -n "$HOSTNAME" ] || HOSTNAME='grml'
 [ -n "$INITRD" ] || INITRD='yes'
+[ -n "$INITRD_GENERATOR" ] || INITRD_GENERATOR='initramfs-tools'
 [ -n "$INSTALL_NOTES" ] || INSTALL_NOTES='/etc/debootstrap/install_notes'
 [ -n "$LOCALES" ] || LOCALES='yes'
 [ -n "$MIRROR" ] || MIRROR="$FALLBACK_MIRROR"
@@ -1691,6 +1692,7 @@ preparechroot() {
   [ -n "$GRUB" ]                && echo "GRUB='$(sed "s,','\\\\'',g" <<<"${GRUB}")'"                               >> "$CHROOT_VARIABLES"
   [ -n "$HOSTNAME" ]            && echo "HOSTNAME='$(sed "s,','\\\\'',g" <<<"${HOSTNAME}")'"                       >> "$CHROOT_VARIABLES"
   [ -n "$INITRD" ]              && echo "INITRD='$(sed "s,','\\\\'',g" <<<"${INITRD}")'"                           >> "$CHROOT_VARIABLES"
+  [ -n "$INITRD_GENERATOR" ]    && echo "INITRD_GENERATOR='$(sed "s,','\\\\'',g" <<<"${INITRD_GENERATOR}")'"       >> "$CHROOT_VARIABLES"
   [ -n "$INSTALL_NOTES" ]       && echo "INSTALL_NOTES='$(sed "s,','\\\\'',g" <<<"${INSTALL_NOTES}")'"             >> "$CHROOT_VARIABLES"
   [ -n "$ISODIR" ]              && echo "ISODIR='$(sed "s,','\\\\'',g" <<<"${ISO}")'"                              >> "$CHROOT_VARIABLES"
   [ -n "$ISO" ]                 && echo "ISO='$(sed "s,','\\\\'',g" <<<"${ISO}")'"                                 >> "$CHROOT_VARIABLES"