Skip to content

Commit

Permalink
fix(dracut.sh): do not ignore invalid config file or dir path
Browse files Browse the repository at this point in the history
Fix issue #1136
  • Loading branch information
aafeijoo-suse authored and johannbg committed Dec 11, 2021
1 parent 3d8e1ad commit 7de9ffc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -891,20 +891,26 @@ export DRACUT_LOG_LEVEL=warning
[[ $dracutbasedir ]] || dracutbasedir="$dracutsysrootdir"/usr/lib/dracut

# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
if [[ -z $conffile ]]; then
if [[ $allowlocal ]]; then
conffile="$dracutbasedir/dracut.conf"
else
conffile="$dracutsysrootdir/etc/dracut.conf"
fi
elif [[ ! -f $conffile ]]; then
printf "%s\n" "dracut: Configuration file '$conffile' not found." >&2
exit 1
fi

if [[ ! -d $confdir ]]; then
if [[ -z $confdir ]]; then
if [[ $allowlocal ]]; then
confdir="$dracutbasedir/dracut.conf.d"
else
confdir="$dracutsysrootdir/etc/dracut.conf.d"
fi
elif [[ ! -d $confdir ]]; then
printf "%s\n" "dracut: Configuration directory '$confdir' not found." >&2
exit 1
fi

# source our config file
Expand Down

0 comments on commit 7de9ffc

Please sign in to comment.