]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
added plymouth with crypt handling
authorHarald Hoyer <harald@redhat.com>
Thu, 5 Mar 2009 16:16:56 +0000 (17:16 +0100)
committerHarald Hoyer <harald@redhat.com>
Thu, 5 Mar 2009 16:16:56 +0000 (17:16 +0100)
dracut.conf
modules.d/91plymouth/63-luks.rules [new file with mode: 0644]
modules.d/91plymouth/install [new file with mode: 0755]
modules.d/91plymouth/plymouth-ask.sh [new file with mode: 0755]
modules.d/91plymouth/plymouth-newroot.sh [new file with mode: 0755]
modules.d/91plymouth/plymouth-populate-initrd [new file with mode: 0755]
modules.d/91plymouth/plymouth-start.sh [new file with mode: 0755]

index bd8f4af4c7f6c11c26c50e14168f7f7d7e0a1679..51c579f114d20fee7d89c93c86fada5dbb99c1c1 100644 (file)
@@ -1,2 +1,2 @@
 # specify the dracut modules to use
-dracutmodules="redhat-i18n crypt kernel-modules lvm terminfo udev-rules base dmraid"
+dracutmodules="redhat-i18n kernel-modules lvm terminfo udev-rules base dmraid plymouth"
diff --git a/modules.d/91plymouth/63-luks.rules b/modules.d/91plymouth/63-luks.rules
new file mode 100644 (file)
index 0000000..5463139
--- /dev/null
@@ -0,0 +1,13 @@
+# hacky rules to try to try unlocking dm-crypt devs
+#
+# Copyright 2008, Red Hat, Inc.
+# Jeremy Katz <katzj@redhat.com>
+
+
+SUBSYSTEM!="block", GOTO="luks_end"
+ACTION!="add|change", GOTO="luks_end"
+
+KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
+ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="plymouth-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
+
+LABEL="luks_end"
diff --git a/modules.d/91plymouth/install b/modules.d/91plymouth/install
new file mode 100755 (executable)
index 0000000..ccc14cf
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+echo "installing plymouth"
+. "$moddir"/plymouth-populate-initrd  -t "$initdir"
+inst_hook pre-udev 10 "$moddir"/plymouth-start.sh
+inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
+inst_rules "$moddir/63-luks.rules"
+inst "$moddir"/plymouth-ask.sh /lib/udev/plymouth-ask
+inst cryptsetup
+
diff --git a/modules.d/91plymouth/plymouth-ask.sh b/modules.d/91plymouth/plymouth-ask.sh
new file mode 100755 (executable)
index 0000000..fadb502
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+[ -b /dev/mapper/$2 ] || exec /bin/plymouth ask-for-password --command="/sbin/cryptsetup luksOpen -T1 $1 $2"
+
diff --git a/modules.d/91plymouth/plymouth-newroot.sh b/modules.d/91plymouth/plymouth-newroot.sh
new file mode 100755 (executable)
index 0000000..c6f8c6d
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+[ -x /bin/plymouth ] && /bin/plymouth --newroot=$NEWROOT
+
diff --git a/modules.d/91plymouth/plymouth-populate-initrd b/modules.d/91plymouth/plymouth-populate-initrd
new file mode 100755 (executable)
index 0000000..930da3c
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/bash
+
+[ -z "$DESTDIR" ] || exit 0
+
+[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
+[ -z "$DATADIR" ] && DATADIR="/usr/share"
+[ -z "$SYSTEMMAP" ] && SYSTEM_MAP="/boot/System.map-$(/bin/uname -r)"
+if [ -z "$LIB" ]; then
+  if $(echo nash-showelfinterp /proc/$$/exe | /sbin/nash --forcequiet | grep -q lib64); then
+    LIB="lib64"
+  else
+    LIB="lib"
+  fi
+fi
+[ -z "$LIBDIR" ] && LIBDIR="/usr/$LIB"
+[ -z "$BINDIR" ] && BINDIR="/usr/bin"
+[ -z "$GRUB_MENU_TITLE" ] && GRUB_MENU_TITLE="Graphical Bootup"
+[ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
+[ -z "$PLYMOUTH_PLUGIN_NAME" ] && PLYMOUTH_PLUGIN_NAME=$(plymouth-set-default-plugin)
+
+function usage() {
+    local output="/dev/stdout"
+    local rc=0
+    if [ "$1" == "error" ]; then
+        output="/dev/stderr"
+        rc=1
+    fi
+
+    echo "usage: plymouth [ --verbose | -v ] { --targetdir | -t } <initrd_directory>" > $output
+    exit $rc
+}
+
+verbose=false
+INITRDDIR=""
+while [ $# -gt 0 ]; do
+    case $1 in
+        --verbose|-v)
+            verbose=true
+            ;;
+        --targetdir|-t)
+            shift
+            INITRDDIR="$1"
+            ;;
+        --help|-h)
+            usage normal
+            ;;
+        *)
+            usage error
+            break
+            ;;
+    esac
+    shift
+done
+
+[ -z "$INITRDDIR" ] && usage error
+
+inst /sbin/plymouthd $INITRDDIR /bin/plymouthd
+inst /bin/plymouth $INITRDDIR
+inst ${LIBDIR}/plymouth/text.so $INITRDDIR
+inst ${LIBDIR}/plymouth/details.so $INITRDDIR
+inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR
+inst /etc/system-release $INITRDDIR
+mkdir -p ${INITRDDIR}${DATADIR}/plymouth
+
+if [ -z "$PLYMOUTH_PLUGIN_NAME" ]; then
+    echo "No default plymouth plugin is set" > /dev/stderr
+    exit 1
+fi
+
+if [ ! -f ${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN_NAME}.so ]; then
+    echo "The default plymouth plugin (${PLYMOUTH_PLUGIN_NAME}) doesn't exist" > /dev/stderr
+    exit 1
+fi
+
+inst ${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN_NAME}.so $INITRDDIR
+
+if [ -f ${LIBDIR}/plymouth/default.so ]; then
+    inst ${LIBDIR}/plymouth/default.so $INITRDDIR
+fi
+
+if [ -d ${DATADIR}/plymouth/${PLYMOUTH_PLUGIN_NAME} ]; then
+    for x in ${DATADIR}/plymouth/${PLYMOUTH_PLUGIN_NAME}/* ; do
+        [ ! -f "$x" ] && break
+        inst $x $INITRDDIR
+    done
+fi
+
+# vim:ts=8:sw=4:sts=4:et
diff --git a/modules.d/91plymouth/plymouth-start.sh b/modules.d/91plymouth/plymouth-start.sh
new file mode 100755 (executable)
index 0000000..07273c6
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+mknod /dev/null c 1 3
+mknod /dev/zero c 1 5
+mknod /dev/systty c 4 0
+mknod /dev/tty c 5 0
+mknod /dev/console c 5 1
+mknod /dev/ptmx c 5 2
+mknod /dev/fb c 29 0
+mknod /dev/tty0 c 4 0
+mknod /dev/tty1 c 4 1
+mknod /dev/tty2 c 4 2
+mknod /dev/tty3 c 4 3
+mknod /dev/tty4 c 4 4
+mknod /dev/tty5 c 4 5
+mknod /dev/tty6 c 4 6
+mknod /dev/tty7 c 4 7
+mknod /dev/tty8 c 4 8
+mknod /dev/tty9 c 4 9
+mknod /dev/tty10 c 4 10
+mknod /dev/tty11 c 4 11
+mknod /dev/tty12 c 4 12
+mknod /dev/ttyS0 c 4 64
+mknod /dev/ttyS1 c 4 65
+mknod /dev/ttyS2 c 4 66
+mknod /dev/ttyS3 c 4 67
+/lib/udev/console_init tty0
+
+[ -x /bin/plymouthd ] && /bin/plymouthd 
+[ -x /bin/plymouth ] && /bin/plymouth --show-splash
+