]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
feat(shell-interpreter): meta package for improved shell selection
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Sat, 20 Jul 2024 22:40:43 +0000 (18:40 -0400)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 21 Jul 2024 15:38:47 +0000 (11:38 -0400)
.github/labeler.yml
modules.d/00shell-interpreter/module-setup.sh [new file with mode: 0755]
modules.d/99base/module-setup.sh

index 0cea58c290882c5275f2e5c91fb2f5d1fbd3a1e6..f06853e0e1950c68468e4b19e91232f2c61bc063 100644 (file)
@@ -554,6 +554,10 @@ pcmcia:
   - changed-files:
     - any-glob-to-any-file: 'modules.d/90pcmcia/*'
 
+shell-interpreter:
+  - changed-files:
+    - any-glob-to-any-file: 'modules.d/00shell-interpreter/*'
+
 test:
   - changed-files:
     - any-glob-to-any-file: ['test/*', 'test/**/*', 'modules.d/80test*', 'modules.d/80test*/*']
diff --git a/modules.d/00shell-interpreter/module-setup.sh b/modules.d/00shell-interpreter/module-setup.sh
new file mode 100755 (executable)
index 0000000..64098a3
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+# This file is part of dracut.
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# Module dependency requirements.
+depends() {
+    # priority order
+    shells='bash dash busybox'
+
+    for shell in $shells; do
+        if dracut_module_included "$shell"; then
+            echo "$shell"
+            return 0
+        fi
+    done
+
+    shell=$(realpath /bin/sh)
+    shell=${shell##*/}
+
+    echo "$shell"
+    return 0
+}
index bfdc51d49efecaddcd3cc877ba559302b991ad00..51fc32e4f40f44fe564fa37fc719fce25cb1b568 100755 (executable)
@@ -7,7 +7,7 @@ check() {
 
 # called by dracut
 depends() {
-    echo udev-rules
+    echo udev-rules shell-interpreter
     return 0
 }