From 803204e6cb2e5ca17edea2f396796577d55444bb Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 28 Aug 2009 20:00:08 -0400 Subject: [PATCH] [scripts] add plymouth-generate-initrd script One useful way to use plymouth is by installing it into an auxillary initrd image, that overlays the primary one. This allows plymouth and its current theme to get updated indepedently of the kernel and the rest of the initrd stuff. plymouth-generate-initrd creates an initrd named: initrd-plymouth.img in /boot that is suitable for use a second initrd on the initrd line in grub.conf. --- scripts/Makefile.am | 3 ++- scripts/plymouth-generate-initrd | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 scripts/plymouth-generate-initrd diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 714bd03b..3de5046f 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,7 +1,7 @@ noinst_SCRIPTS = new-object.sh initrdscriptdir = $(libexecdir)/plymouth -initrdscript_SCRIPTS = plymouth-update-initrd plymouth-populate-initrd +initrdscript_SCRIPTS = plymouth-update-initrd plymouth-generate-initrd plymouth-populate-initrd sbinscriptsdir = $(sbindir) sbinscripts_SCRIPTS = plymouth-set-default-theme @@ -20,6 +20,7 @@ plymouth-set-default-theme: $(srcdir)/plymouth-set-default-theme.in $(srcdir)/plymouth-set-default-theme.in > plymouth-set-default-theme EXTRA_DIST= plymouth-update-initrd \ + plymouth-generate-initrd \ plymouth-populate-initrd.in \ plymouth-set-default-theme.in \ $(noinst_SCRIPTS) \ diff --git a/scripts/plymouth-generate-initrd b/scripts/plymouth-generate-initrd new file mode 100755 index 00000000..1a2ca831 --- /dev/null +++ b/scripts/plymouth-generate-initrd @@ -0,0 +1,24 @@ +#!/bin/bash + +[ -z "$DESTDIR" ] || exit 0 + +[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="/usr/libexec" +[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="/usr/share" +[ -z "$PLYMOUTH_POPULATE_INITRD" ] && PLYMOUTH_POPULATE_INITRD="$PLYMOUTH_LIBEXECDIR/plymouth/plymouth-populate-initrd" +[ -z "$PLYMOUTH_DESTDIR" ] && PLYMOUTH_DESTDIR="/boot" +[ -z "$PLYMOUTH_IMAGE_FILE" ] && PLYMOUTH_IMAGE_FILE="$PLYMOUTH_DESTDIR/initrd-plymouth.img" + +PLYMOUTH_INITRD_DIR="$(mktemp --tmpdir -d plymouth-XXXXXXX)" + +$PLYMOUTH_POPULATE_INITRD -t "$PLYMOUTH_INITRD_DIR" + +if [ $? -eq 0 ]; then + (cd $PLYMOUTH_INITRD_DIR; + # FIXME: might make sense to add a flag to plymouth-populate-initrd to + # skip these from the start + rm -f lib*/{ld*,libc*,libdl*,libm*,libz*,libpthread*} + find | cpio -Hnewc -o | gzip -9 > $PLYMOUTH_IMAGE_FILE + ) +fi + +rm -rf $PLYMOUTH_INITRD_DIR