mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-26 12:45:20 +03:00
Only include bash into the generated initramfs if a dracut module explicitly depends on it. Implemented as a new dracut module that picks busybox shell on alpine. Based on the idea discussed upstream: https://github.com/dracutdevs/dracut/pull/2368#issuecomment-1588285469
47 lines
1.2 KiB
Diff
47 lines
1.2 KiB
Diff
From adf7af3bebc1ccd24c16668ba161c30447db2df7 Mon Sep 17 00:00:00 2001
|
|
From: Laszlo Gombos <laszlo.gombos@gmail.com>
|
|
Date: Tue, 13 Jun 2023 13:16:12 +0000
|
|
Subject: [PATCH] improve shell selection
|
|
|
|
---
|
|
modules.d/00sh/module-setup.sh | 17 +++++++++++++++++
|
|
modules.d/99base/module-setup.sh | 2 +-
|
|
2 files changed, 18 insertions(+), 1 deletion(-)
|
|
create mode 100755 modules.d/00sh/module-setup.sh
|
|
|
|
diff --git a/modules.d/00sh/module-setup.sh b/modules.d/00sh/module-setup.sh
|
|
new file mode 100755
|
|
index 0000000000..2495553e28
|
|
--- /dev/null
|
|
+++ b/modules.d/00sh/module-setup.sh
|
|
@@ -0,0 +1,17 @@
|
|
+#!/bin/sh
|
|
+
|
|
+depends() {
|
|
+ shells='dash bash mksh busybox'
|
|
+ for shell in $shells; do
|
|
+ if dracut_module_included "$shell"; then
|
|
+ echo "$shell"
|
|
+ return 0
|
|
+ fi
|
|
+ done
|
|
+
|
|
+ shell=$(realpath -e /bin/sh)
|
|
+ shell=${shell##*/}
|
|
+
|
|
+ echo "$shell"
|
|
+ return 0
|
|
+}
|
|
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
|
|
index 54b0deb914..8798cb5aa4 100755
|
|
--- a/modules.d/99base/module-setup.sh
|
|
+++ b/modules.d/99base/module-setup.sh
|
|
@@ -7,7 +7,7 @@ check() {
|
|
|
|
# called by dracut
|
|
depends() {
|
|
- echo udev-rules
|
|
+ echo udev-rules sh
|
|
return 0
|
|
}
|
|
|