]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
50-dracut.install: install pregenerated initrd
authorHarald Hoyer <harald@redhat.com>
Fri, 15 Aug 2014 12:58:34 +0000 (14:58 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 15 Aug 2014 12:58:34 +0000 (14:58 +0200)
If there is an already pregenerated initrd at the same location as the
kernel install that and do not generate a new one.

50-dracut.install

index b0cc7c3c8b456f436c41857f65b9006941cba028..ad5fc0e7a09520c184e0d963eafd0c05d5265f95 100755 (executable)
@@ -10,6 +10,16 @@ KERNEL_IMAGE="$4"
 ret=0
 case "$COMMAND" in
     add)
+        INITRD_IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
+        if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
+            # we found an initrd at the same place as the kernel
+            # use this and don't generate a new one
+            cp "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/initrd" \
+                && chown root:root "$BOOT_DIR_ABS/initrd" \
+                && chmod 0600 "$BOOT_DIR_ABS/initrd" \
+                && exit 0
+        fi
+
         if [[ -f /etc/kernel/cmdline ]]; then
             readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
         fi