Skip to content

Commit 7de9ffc

Browse files
aafeijoo-susejohannbg
authored andcommitted
fix(dracut.sh): do not ignore invalid config file or dir path
Fix issue #1136
1 parent 3d8e1ad commit 7de9ffc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

dracut.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -891,20 +891,26 @@ export DRACUT_LOG_LEVEL=warning
891891
[[ $dracutbasedir ]] || dracutbasedir="$dracutsysrootdir"/usr/lib/dracut
892892

893893
# if we were not passed a config file, try the default one
894-
if [[ ! -f $conffile ]]; then
894+
if [[ -z $conffile ]]; then
895895
if [[ $allowlocal ]]; then
896896
conffile="$dracutbasedir/dracut.conf"
897897
else
898898
conffile="$dracutsysrootdir/etc/dracut.conf"
899899
fi
900+
elif [[ ! -f $conffile ]]; then
901+
printf "%s\n" "dracut: Configuration file '$conffile' not found." >&2
902+
exit 1
900903
fi
901904

902-
if [[ ! -d $confdir ]]; then
905+
if [[ -z $confdir ]]; then
903906
if [[ $allowlocal ]]; then
904907
confdir="$dracutbasedir/dracut.conf.d"
905908
else
906909
confdir="$dracutsysrootdir/etc/dracut.conf.d"
907910
fi
911+
elif [[ ! -d $confdir ]]; then
912+
printf "%s\n" "dracut: Configuration directory '$confdir' not found." >&2
913+
exit 1
908914
fi
909915

910916
# source our config file

0 commit comments

Comments
 (0)