From 5c481d345fe5da7f163b6d9c012d3260cd2203e7 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 18 Dec 2008 15:57:47 -0500 Subject: [PATCH] Make using the version from the current directory explicit Rather than looking at the contents of the current directory always, require explicitly specifying --local to use those files --- dracut | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dracut b/dracut index 9a439ca..ed6dd97 100755 --- a/dracut +++ b/dracut @@ -7,12 +7,6 @@ # Copyright 2008, Red Hat, Inc. Jeremy Katz # GPLv2 header here -if [ -f ./dracut-functions ]; then - source ./dracut-functions -else - source /usr/libexec/dracut/functions -fi - [ -f /etc/dracut.conf ] && . /etc/dracut.conf while [ $# -gt 0 ]; do @@ -29,6 +23,10 @@ while [ $# -gt 0 ]; do set -x shift ;; + -l|--local) + allowlocal="yes" + shift + ;; *) break esac @@ -50,6 +48,16 @@ if [ -f "$outfile" -a -z "$force" ]; then exit 1 fi +if [ -n "$allowlocal" -a -f ./init ]; then + source ./dracut-functions + initfile=./init + switchroot=./switchroot +else + source /usr/libexec/dracut/functions + initfile=/usr/libexec/dracut/init + switchroot=/usr/libexec/dracut/switch_root +fi + initdir=$(mktemp -d -t initramfs.XXXXXX) # executables that we have to have @@ -78,8 +86,8 @@ done for f in $(find /lib/terminfo -type f) ; do cp --parents $f "$initdir" ; done # install our files -cp init $initdir/init -cp switch_root $initdir/sbin/switch_root +cp $initfile $initdir/init +cp $switchroot $initdir/sbin/switch_root # and create some directory structure mkdir -p $initdir/etc $initdir/proc $initdir/sys $initdir/sysroot $initdir/dev/pts -- 2.7.4