Skip to content

Commit

Permalink
fix(base): source hooks without exec
Browse files Browse the repository at this point in the history
Patch 2fabaaa changed the behaviour for `dash`
under the assumption, that dash does not take parameters for `.` aka
`source`. Although this is true, the original positional parameters of
the `source_all` function are still in place, so everything is
fine with the old way of sourcing.
  • Loading branch information
haraldh committed Mar 31, 2021
1 parent 36af051 commit 8059bcb
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions modules.d/99base/dracut-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,9 @@ source_all() {
[ "$_dir" ] && [ -d "/$_dir" ] || return
for f in "/$_dir"/*.sh; do
if [ -e "$f" ]; then
# dash can't source with parameters
if [ -z "$BASH" ] && [ $# -gt 0 ]; then
[ -x "$f" ] || chmod 0755 "$f"
"$f" "$@"
else
# shellcheck disable=SC1090
# shellcheck disable=SC2240
. "$f" "$@"
fi
# shellcheck disable=SC1090
# shellcheck disable=SC2240
. "$f" "$@"
fi
done
}
Expand Down

0 comments on commit 8059bcb

Please sign in to comment.