Skip to content

Commit

Permalink
Created Dracut Module
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrTall committed Mar 11, 2023
1 parent 7db17c4 commit 6be3e10
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
7 changes: 7 additions & 0 deletions 51numlock/enable-numlock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
if [ -x /usr/bin/setleds ] ; then
INITTY=/dev/tty[1-8]
for tty in $INITTY ; do
setleds -D +num < $tty
done
fi
28 changes: 28 additions & 0 deletions 51numlock/module-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later

# Prerequisite check(s) for module.
check() {

# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries setleds || return 1

# Return 0 to always include the module.
return 0

}

# Module dependency requirements.
depends() {

# Return 0 to include the dependent module(s) in the initramfs.
return 0

}

# Install the required file(s) and directories for the module in the initramfs.
install() {
inst /usr/bin/setleds
inst_hook cmdline 99 "$moddir/enable-numlock.sh"
}
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# dracut-numlock
Dracut Module that enables numlock during the early boot process (luks prompt)

This is a [Dracut](https://github.com/dracutdevs/dracut) Module that enables numlock during the early boot process.
This can be handy if you use digits for unlocking your luks2 partition with a tpm or fido2 device.

## Dependencies

The module requires the `setleds` binary.

## Install

Copy the `51numlock` directory into the Dracut module directory.

``` bash
cp -ri 51numlock /usr/lib/dracut/modules.d
```

The module is enabled by default.

0 comments on commit 6be3e10

Please sign in to comment.