]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
[PATCH 39/50] Prefer /bin/dash as /bin/sh on the initrd if it is available.
authorVictor Lowther <victor.lowther@gmail.com>
Fri, 13 Feb 2009 12:43:04 +0000 (04:43 -0800)
committerDave Jones <davej@redhat.com>
Mon, 16 Feb 2009 18:56:42 +0000 (13:56 -0500)
This is mainly for testing purposes -- if something non-POSIX is added to the
on initrd scripts, dash will die horribly.

dracut

diff --git a/dracut b/dracut
index 530524c0bee9095038c8581cf8e36596671a0faf..186d6adc3d4043d4feafc87e272d0a9f3205b1dc 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -43,7 +43,7 @@ initdir=$(mktemp -d -t initramfs.XXXXXX)
 trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
 
 # executables that we have to have
-exe="/bin/bash /bin/mount /bin/mknod /bin/mkdir /sbin/modprobe /sbin/udevd /sbin/udevadm /sbin/nash /sbin/pidof /bin/sleep /usr/sbin/chroot /bin/echo /bin/cat"
+exe="/bin/bash /bin/mount /bin/mknod /bin/mkdir /sbin/modprobe /sbin/udevd /sbin/udevadm /sbin/nash /sbin/pidof /bin/sleep /usr/sbin/chroot /bin/echo /bin/cat /bin/sed"
 lvmexe="/sbin/lvm"
 cryptexe="/sbin/cryptsetup"
 # and some things that are nice for debugging
@@ -56,6 +56,12 @@ for binary in $exe $debugexe $udevexe $lvmexe $cryptexe ; do
   inst $binary
 done
 
+# Prefer dash as /bin/sh if it is available.
+if [[ -f /bin/dash ]]; then
+    inst /bin/dash
+    ln -sf /bin/dash "${initdir}/bin/sh"
+fi
+
 # FIXME: would be nice if we didn't have to know which rules to grab....
 # ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
 # of the rules we want so that we just copy those in would be best