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
[[ $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.
# 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
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
# 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
# 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
# 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
}
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