]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Make using the version from the current directory explicit
authorJeremy Katz <katzj@redhat.com>
Thu, 18 Dec 2008 20:57:47 +0000 (15:57 -0500)
committerJeremy Katz <katzj@redhat.com>
Thu, 18 Dec 2008 20:57:47 +0000 (15:57 -0500)
Rather than looking at the contents of the current directory always, require
explicitly specifying --local to use those files

dracut

diff --git a/dracut b/dracut
index 9a439ca830d82c40551d0eeb58a4a0d07a097d33..ed6dd97f6e8c52a3b9d2506b2e8d1460acbb64b5 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -7,12 +7,6 @@
 # Copyright 2008, Red Hat, Inc.  Jeremy Katz <katzj@redhat.com>
 # 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