MAJOR=4
MINOR=11
DEVNAME=tty11
     ˆ¾Äƒh¹¿Æ      MAJOR=4
MINOR=10
DEVNAME=tty10
  :   ˆl–Ým_Jõ2ÛR‚ „ …q–î	Å1hßÅ„ÿa–Ðz¾”Šj"Tâ�nãM\”Å£È '}    # Dracut Developer Guidelines

## git

Currently dracut lives on github.com and kernel.org.

* https://github.com/dracutdevs/dracut.git
* https://git.kernel.org/pub/scm/boot/dracut/dracut.git

Pull requests should be filed preferably on github nowadays.

### Code Format

It is recommended, that you install a plugin for your editor, which reads in `.editorconfig`.
Additionally `emacs` and `vim` config files are provided for convenience.

To reformat C files use `astyle`:
```console
$ astyle --options=.astylerc <FILE>
```

For convenience there is also a Makefile `indent-c` target `make indent-c`.

To reformat shell files use `shfmt`:

```console
$ shfmt_version=3.2.4
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w -s .
```

or

```console
$ GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
$ $GOPATH/bin/shfmt -w -s .
```

or if `shfmt` is already in your `PATH`, use `make indent`.

Some IDEs already have support for shfmt.

For convenience the `make indent` Makefile target also calls shfmt, if it is in `$PATH`.

### Commit Messages

Commit messages should answer these questions:

* What?: a short summary of what you changed in the subject line.
* Why?: what the intended outcome of the change is (arguably the most important piece of information that should go into a message).
* How?: if multiple approaches for achieving your goal were available, you also want to explain why you chose the used implementation strategy.
  Note that you should not explain how your change achieves your goal in your commit message.
  That should be obvious from the code itself.
  If you cannot achieve that clarity with the used programming language, use comments within the code instead.

The commit message is primarily the place for documenting the why.

Commit message titles should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).

Format is `<type>[optional scope]: <description>`, where `type` is one of:

* fix: A bug fix
* feat: A new feature
* perf: A code change that improves performance
* refactor: A code change that neither fixes a bug nor adds a feature
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* test: Adding missing tests or correcting existing tests
* docs: Documentation only changes
* revert: Reverts a previous commit
* chore: Other changes that don't modify src or test files
* build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)

`scope` should be the module name (without numbers) or:

* cli: for the dracut command line interface
* rt: for the dracut initramfs runtime logic
* functions: for general purpose dracut functions

Commit messages are checked with [Commisery](https://github.com/tomtom-international/commisery).

## Writing modules

Some general rules for writing modules:

* Use one of the inst family of functions to actually install files
  on to the initramfs.  They handle mangling the pathnames and (for binaries,
  scripts, and kernel modules) installing dependencies as appropriate so
  you do not have to.
* Scripts that end up on the initramfs should be POSIX compliant. dracut
  will try to use /bin/dash as /bin/sh for the initramfs if it is available,
  so you should install it on your system -- dash aims for strict POSIX
  compliance to the extent possible.
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
  and having a bashism break your user's ability to boot really sucks.
* Generator modules should have a two digit numeric prefix -- they run in
  ascending sort order. Anything in the 90-99 range is stuff that dracut
  relies on, so try not to break those hooks.
* Hooks must