|
Harald Hoyer |
9f8738 |
From 9355cb8ea5024533210067373657dc337d63ecb9 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
9f8738 |
From: =?UTF-8?q?J=C3=B3hann=20B=2E=20Gu=C3=B0mundsson?= <johannbg@gmail.com>
|
|
Harald Hoyer |
9f8738 |
Date: Tue, 18 May 2021 12:39:34 +0000
|
|
Harald Hoyer |
9f8738 |
Subject: [PATCH] fix(bash): minor cleanups
|
|
Harald Hoyer |
9f8738 |
|
|
Harald Hoyer |
9f8738 |
- Remove hard coded path to binary
|
|
Harald Hoyer |
9f8738 |
- Add missing license header
|
|
Harald Hoyer |
9f8738 |
- Document sections
|
|
Harald Hoyer |
9f8738 |
- refactor install section
|
|
Harald Hoyer |
9f8738 |
---
|
|
Harald Hoyer |
9f8738 |
modules.d/00bash/module-setup.sh | 28 ++++++++++++++++++++--------
|
|
Harald Hoyer |
9f8738 |
1 file changed, 20 insertions(+), 8 deletions(-)
|
|
Harald Hoyer |
9f8738 |
|
|
Harald Hoyer |
9f8738 |
diff --git a/modules.d/00bash/module-setup.sh b/modules.d/00bash/module-setup.sh
|
|
Harald Hoyer |
9f8738 |
index f72c297b..89ef6541 100755
|
|
Harald Hoyer |
9f8738 |
--- a/modules.d/00bash/module-setup.sh
|
|
Harald Hoyer |
9f8738 |
+++ b/modules.d/00bash/module-setup.sh
|
|
Harald Hoyer |
9f8738 |
@@ -1,20 +1,32 @@
|
|
Harald Hoyer |
9f8738 |
#!/bin/bash
|
|
Harald Hoyer |
9f8738 |
+# This file is part of dracut.
|
|
Harald Hoyer |
9f8738 |
+# SPDX-License-Identifier: GPL-2.0-or-later
|
|
Harald Hoyer |
9f8738 |
|
|
Harald Hoyer |
9f8738 |
-# called by dracut
|
|
Harald Hoyer |
9f8738 |
+# Prerequisite check(s) for module.
|
|
Harald Hoyer |
9f8738 |
check() {
|
|
Harald Hoyer |
9f8738 |
- require_binaries /bin/bash
|
|
Harald Hoyer |
9f8738 |
+
|
|
Harald Hoyer |
9f8738 |
+ # If the binary(s) requirements are not fulfilled the module can't be installed.
|
|
Harald Hoyer |
9f8738 |
+ require_binaries bash || return 1
|
|
Harald Hoyer |
9f8738 |
+
|
|
Harald Hoyer |
9f8738 |
+ # Return 255 to only include the module, if another module requires it.
|
|
Harald Hoyer |
9f8738 |
+ return 255
|
|
Harald Hoyer |
9f8738 |
+
|
|
Harald Hoyer |
9f8738 |
}
|
|
Harald Hoyer |
9f8738 |
|
|
Harald Hoyer |
9f8738 |
-# called by dracut
|
|
Harald Hoyer |
9f8738 |
+# Module dependency requirements.
|
|
Harald Hoyer |
9f8738 |
depends() {
|
|
Harald Hoyer |
9f8738 |
+
|
|
Harald Hoyer |
9f8738 |
+ # Return 0 to include the dependent module(s) in the initramfs.
|
|
Harald Hoyer |
9f8738 |
return 0
|
|
Harald Hoyer |
9f8738 |
+
|
|
Harald Hoyer |
9f8738 |
}
|
|
Harald Hoyer |
9f8738 |
|
|
Harald Hoyer |
9f8738 |
-# called by dracut
|
|
Harald Hoyer |
9f8738 |
+# Install the required file(s) and directories for the module in the initramfs.
|
|
Harald Hoyer |
9f8738 |
install() {
|
|
Harald Hoyer |
9f8738 |
- # If another shell is already installed, do not use bash
|
|
Harald Hoyer |
9f8738 |
- [[ -x $initdir/bin/sh ]] && return
|
|
Harald Hoyer |
9f8738 |
|
|
Harald Hoyer |
9f8738 |
- # Prefer bash as /bin/sh if it is available.
|
|
Harald Hoyer |
9f8738 |
- inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
|
Harald Hoyer |
9f8738 |
+ inst /bin/bash
|
|
Harald Hoyer |
9f8738 |
+
|
|
Harald Hoyer |
9f8738 |
+ # Prefer bash as default shell if no other shell is preferred.
|
|
Harald Hoyer |
9f8738 |
+ [[ -L $initdir/bin/sh ]] || ln -sf bash "${initdir}/bin/sh"
|
|
Harald Hoyer |
9f8738 |
+
|
|
Harald Hoyer |
9f8738 |
}
|
|
Harald Hoyer |
9f8738 |
|