Update /etc/grml_version in GRMLBASE script instead of grml-live
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 47-initramfs
diff --git a/etc/grml/fai/config/scripts/GRMLBASE/47-initramfs b/etc/grml/fai/config/scripts/GRMLBASE/47-initramfs
new file mode 100755 (executable)
index 0000000..2302584
--- /dev/null
@@ -0,0 +1,19 @@
+#!/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