Skip to content
Snippets Groups Projects
Commit 1944bcc2 authored by Laszlo Gombos's avatar Laszlo Gombos Committed by Kevin Daudt
Browse files

community/dracut: prefer busybox inside the generated initramfs

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
parent 7c47e009
No related branches found
No related tags found
1 merge request!55408community/dracut: prefer busybox inside the generated initramfs
Pipeline #197381 skipped
......@@ -2,7 +2,7 @@
# Maintainer: Conrad Hoffmann <ch@bitfehler.net>
pkgname=dracut
pkgver=060
pkgrel=0
pkgrel=1
_commit=856e7acdb1462803c2517c8d64afb2e34c73c735
pkgdesc="An event driven initramfs infrastructure"
url="https://github.com/dracutdevs/dracut/wiki"
......@@ -14,7 +14,9 @@ options="!check" # There is a test suite, but it requires root/sudo
triggers="$pkgname.trigger=/usr/share/kernel/*"
source="$pkgname-$pkgver.tar.gz::https://github.com/dracutdevs/dracut/archive/$_commit.tar.gz
README.alpine
10-alpine.conf"
10-alpine.conf
initramfs-shell.patch
"
provides="initramfs-generator"
provider_priority=100 # low, somewhat experimental
builddir="$srcdir"/$pkgname-$_commit
......@@ -92,4 +94,5 @@ sha512sums="
0cd2fefcd624758063c77836989260a3d5b0d533004c2395124c8200c31602f5d7d0b8c9491de37ce4afb2c5009b2cf944ddd3bb9e0e11120d84176cb1e7423c dracut-060.tar.gz
fa1d65d8987d9b5846f5cd7989bc373ca4f9d787a3025284ce55e2d5439dce29f70bd75ff5e07bfa783548e080859ec8972b6887ec58993bc54a8dcc849066d6 README.alpine
8688380dd77949d039a22a0dfb34c67cedd48b45a346a2e5f8b9ce9bd9872a8b1b9e06a51edf75d548b5072243afdb08d7ad25616a82cd030de432bb9e14da47 10-alpine.conf
54d6292a5360145c135f670a5f69cf317e2e03c34495efc7c134c0bf68e09ae27c8cf9fc7434b9742f6dc6e230b0161566c25796956a4fdf35700cd34d1626e8 initramfs-shell.patch
"
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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment