Skip to content

Commit 0ad456f

Browse files
committed
feat(numlock): add module to turn Num Lock on
This module adds setleds and a shell script to turn Num Lock on. Useful when you have to type a password or a PIN to unlock a volume.
1 parent 4d59421 commit 0ad456f

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

modules.d/90numlock/module-setup.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/bash
2+
# This file is part of dracut.
3+
# SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
# Prerequisite check(s) for module.
6+
check() {
7+
8+
# If the binary(s) requirements are not fulfilled the module can't be installed.
9+
require_binaries setleds || return 1
10+
11+
# Return 255 to only include the module, if another module requires it.
12+
return 255
13+
14+
}
15+
16+
# Module dependency requirements.
17+
depends() {
18+
19+
# This module has external dependency on other module(s).
20+
echo base
21+
# Return 0 to include the dependent module(s) in the initramfs.
22+
return 0
23+
24+
}
25+
26+
# Install the required file(s) and directories for the module in the initramfs.
27+
install() {
28+
29+
inst_multiple \
30+
setleds
31+
32+
inst_hook initqueue/settled 90 "$moddir/numlock.sh"
33+
34+
}

modules.d/90numlock/numlock.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/sh
2+
i=1
3+
while [ "${i}" -le 6 ]; do
4+
setleds -D +num < /dev/tty"${i}"
5+
i=$((i + 1))
6+
done

0 commit comments

Comments
 (0)