dracut/0013-dracut.sh-add-DRACUT_P...

63 lines
1.6 KiB
Diff

From eab9b75c8a9b106d2f35faae0af51ab1c66e8da1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 22 Jul 2014 14:43:33 +0200
Subject: [PATCH] dracut.sh: add DRACUT_PATH
DRACUT_PATH can now be used to specify the PATH used by dracut
to search for binaries instead of the default
/usr/sbin:/sbin:/usr/bin:/bin
This should be set in the distribution config file
/usr/lib/dracut/dracut.conf.d/01-dist.conf
---
dracut.sh | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 3e1bf44..1844336 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -626,21 +626,10 @@ if ! [[ $outfile ]]; then
fi
fi
-for i in /usr/sbin /sbin /usr/bin /bin; do
- rl=$i
- if [ -L "$i" ]; then
- rl=$(readlink -f $i)
- fi
- if [[ "$NPATH" != *:$rl* ]] ; then
- NPATH+=":$rl"
- fi
-done
-export PATH="${NPATH#:}"
unset LC_MESSAGES
unset LC_CTYPE
export LC_ALL=C
export LANG=C
-unset NPATH
unset LD_LIBRARY_PATH
unset LD_PRELOAD
unset GREP_OPTIONS
@@ -685,6 +674,20 @@ for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); d
[[ -e $f ]] && . "$f"
done
+DRACUT_PATH=${DRACUT_PATH:-/usr/sbin /sbin /usr/bin /bin}
+
+for i in $DRACUT_PATH; do
+ rl=$i
+ if [ -L "$i" ]; then
+ rl=$(readlink -f $i)
+ fi
+ if [[ "$NPATH" != *:$rl* ]] ; then
+ NPATH+=":$rl"
+ fi
+done
+export PATH="${NPATH#:}"
+unset NPATH
+
# these optins add to the stuff in the config file
if (( ${#add_dracutmodules_l[@]} )); then
while pop add_dracutmodules_l val; do