--- /dev/null
+#!/bin/sh
+# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/47-initramfs
+# Purpose: Rebuild initramfs in chroot
+# Authors: grml-team (grml.org)
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2 or any later version.
+################################################################################
+
+set -u
+set -e
+
+echo "Rebuilding initramfs"
+
+for initrd in "$(basename $target/boot/vmlinuz-*)" ; do
+ if ! $ROOTCMD update-initramfs -k "${initrd##vmlinuz-}" -c ; then
+ echo "Creating fresh initrd did not work, trying update instead:"
+ $ROOTCMD update-initramfs -k "${initrd##vmlinuz-}" -u
+ fi
+done