-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(_sh): assure proper installation of a command shell
If one of the supported shells is not in the add modules list, use the realpath of /bin/sh, if it passes check_module. Otherwise, use one of the supported shells. Fail if none of them passes. This scheme assures that implicitly installed command shells pass through their module-setup.sh with all their dependencies. Completes fix to #1530 augmenting #1534.
- Loading branch information
Showing
5 changed files
with
52 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# This file is part of dracut. | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
# Prerequisite check(s) for module. | ||
check() { | ||
|
||
local shells _shell _s | ||
|
||
# Assure a command shell. | ||
[[ " $add_dracutmodules $force_add_dracutmodules " == @(*\ dash\ *|*\ bash\ *|*\ mksh\ *|*\ busybox\ *) ]] || { | ||
shells='dash bash mksh busybox' | ||
_shell=$(realpath -e /bin/sh) | ||
_shell=${_shell##*/} | ||
{ [[ "$_shell" ]] && check_module "$_shell"; } || { | ||
for _s in $_shell ${shells/$_shell/}; do | ||
check_module "$_s" || continue | ||
# We only want to return 255 since this is a meta module. | ||
return 255 | ||
done | ||
dfatal "One of '$shells' must be made available." | ||
exit 1 | ||
} | ||
} | ||
return 1 | ||
} | ||
|
||
# Module dependency requirements. | ||
depends() { | ||
|
||
return 0 | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters