Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sh): shell meta module #2459

Closed
wants to merge 1 commit into from
Closed

Conversation

Henrik66
Copy link
Contributor

Improve shell selection

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

improve shell selection
@Henrik66 Henrik66 marked this pull request as draft July 30, 2023 12:53
@github-actions github-actions bot added modules Issue tracker for all modules base Issues related to the base module labels Jul 30, 2023
@Henrik66
Copy link
Contributor Author

Current version of this PR is based on this comment on another PR #2368 (comment)

@LaszloGombos
Copy link
Collaborator

@FGrose Can you please help us review and understand what this solution is lacking so that we can compare it with #2368 .

Would you be able to iterate on top of this PR if we manage to land this PR ?

What are the bugs/known issues on this simpler version of the PR ?

@FGrose
Copy link
Contributor

FGrose commented Jul 31, 2023

Complexities arise when we seek to properly support the 4 approved command shells (dash, bash, mksh, & busybox) in rd.debug & rd.live.debug modes. PR #2287 addresses a couple of bugs resulting from mksh having only local xtrace. The solution uses a feature introduced in bash-4.4 from 2016-09-15. This leads to the need to check the installed bash version after any native or 3rd party module might install it or link it to /bin/sh (as the squash module does in an installpost operation). Commit 7e265ec deals with the bash version check.

A supported, but less common feature of dracut is the ability to build divided initramfs images where, for example, 2 or more images are entered on the GRUB initrd/initrdefi command line. In this case, or in the case of building an incremental initramfs image with --rebuild, one might desire to have no command shell installed. For this, some mechanism to exclude the installation of a shell is needed. Commit 48c7205 addresses this.

The implicit installation of a command shell by dracut-install.c during the *** Resolving executable dependencies *** phase of dracut.sh means that an explicit call for a shell must occur before that phase of processing. Here is a simple test case:

  1. ln -sf mksh /bin/sh
  2. dracut /tmp/initrd-test.img -m selinux
    with the test PR feat(sh): shell meta module #2459, /usr/bin/mksh will be installed without the dependency /usr/bin/printf and without reporting mksh in /usr/lib/dracut/modules.txt.

Commit ef9faa2 is designed to run after all module checks have occurred and assures that a command shell is explicitly loaded before the executable dependencies are checked. It is also coded so that it does its work automatically and without the meta module name being included in /usr/lib/dracut/modules.txt.

@stale
Copy link

stale bot commented Sep 16, 2023

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

@stale stale bot added the stale communication is stuck label Sep 16, 2023
@stale stale bot closed this Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base Issues related to the base module modules Issue tracker for all modules stale communication is stuck
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants