join $dsrc and $dracutbasedir

This commit is contained in:
Harald Hoyer 2009-10-27 09:28:53 +01:00
parent 07db0defa7
commit 5d791c0ea9
2 changed files with 13 additions and 11 deletions

16
dracut
View File

@ -108,7 +108,9 @@ export PATH
set -x
}
[[ $allowlocal && -f "$(readlink -f $(dirname $0))/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=$dracutbasedir
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $allowlocal && -f "$(readlink -f $(dirname $0))/dracut-functions" ]] && dracutbasedir="$(dirname $0)"
# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
@ -139,15 +141,15 @@ fw_dir=${fw_dir//:/ }
[[ $hostonly = yes ]] && hostonly="-h"
if [[ -f $dsrc/dracut-functions ]]; then
. $dsrc/dracut-functions
if [[ -f $dracutbasedir/dracut-functions ]]; then
. $dracutbasedir/dracut-functions
else
echo "Cannot find $dsrc/dracut-functions. Are you running from a git checkout?"
echo "Cannot find $dracutbasedir/dracut-functions. Are you running from a git checkout?"
echo "Try passing -l as an argument to $0"
exit 1
fi
dracutfunctions=$dsrc/dracut-functions
dracutfunctions=$dracutbasedir/dracut-functions
export dracutfunctions
# This is kinda legacy -- eventually it should go away.
@ -176,7 +178,7 @@ trap 'exit 1;' SIGINT # clean up after ourselves no matter how we die.
# Need to be able to have non-root users read stuff (rpcbind etc)
chmod 755 "$initdir"
export initdir hookdirs dsrc dracutmodules drivers \
export initdir hookdirs dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug beverbose no_kernel kernel_only \
add_drivers mdadmconf lvmconf
@ -192,7 +194,7 @@ fi
check_modules
#source our modules.
for moddir in "$dsrc/modules.d"/[0-9][0-9]*; do
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
if strstr "$mods_to_load" " $mod "; then
if [[ $kernel_only = yes ]]; then

View File

@ -26,7 +26,7 @@ strstr() { [[ $1 =~ $2 ]]; }
# Log initrd creation.
if ! [[ $dracutlogfile ]]; then
[[ $dsrc = /usr/share/dracut ]] && \
[[ $dracutbasedir = /usr/share/dracut ]] && \
dracutlogfile=/var/log/dracut.log || \
dracutlogfile=/tmp/dracut.log
# [[ -w $dracutlogfile ]] || dracutlogfile=/tmp/dracut.log
@ -271,7 +271,7 @@ inst_symlink() {
# find a rule in the usual places.
find_rule() {
[[ -f $1 ]] && { echo "$1"; return 0; }
for r in . /lib/udev/rules.d /etc/udev/rules.d $dsrc/rules.d; do
for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
done
return 1
@ -351,7 +351,7 @@ check_module_deps() {
# if we are already set to be loaded, we do not have to be checked again.
strstr "$mods_to_load" " $1 " && return
# turn a module name into a directory, if we can.
moddir=$(echo ${dsrc}/modules.d/??${1})
moddir=$(echo ${dracutbasedir}/modules.d/??${1})
[[ -d $moddir && -x $moddir/install ]] || return 1
# if we do not have a check script, we are unconditionally included
if [[ -x $moddir/check ]]; then
@ -385,7 +385,7 @@ should_source_module() {
}
check_modules() {
for moddir in "$dsrc/modules.d"/[0-9][0-9]*; do
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
# If we are already scheduled to be loaded, no need to check again.
strstr "$mods_to_load" " $mod " && continue