Skip to content

Commit f4ea5f8

Browse files
committed
fix(dash): minor cleanups
- Remove hard coded path to binary - Add missing license header - Document sections - refactor install section
1 parent 6c67329 commit f4ea5f8

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

modules.d/00dash/module-setup.sh

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/bin/bash
2+
# This file is part of dracut.
3+
# SPDX-License-Identifier: GPL-2.0-or-later
24

3-
# called by dracut
5+
# Prerequisite check(s) for module.
46
check() {
5-
require_binaries /bin/dash
7+
8+
# If the binary(s) requirements are not fulfilled the module can't be installed.
9+
require_binaries dash || return 1
10+
11+
# Return 255 to only include the module, if another module requires it.
12+
return 255
13+
614
}
715

8-
# called by dracut
16+
# Module dependency requirements.
917
depends() {
18+
19+
# Return 0 to include the dependent module(s) in the initramfs.
1020
return 0
21+
1122
}
1223

13-
# called by dracut
24+
# Install the required file(s) and directories for the module in the initramfs.
1425
install() {
15-
# If another shell is already installed, do not use dash
16-
[[ -x $initdir/bin/sh ]] && return
1726

18-
# Prefer dash as /bin/sh if it is available.
19-
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
27+
inst /bin/dash
28+
29+
# Prefer dash as default shell if no other shell is preferred.
30+
[[ -L $initdir/bin/sh ]] || ln -sf dash "${initdir}/bin/sh"
31+
2032
}

0 commit comments

Comments
 (0)