]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test: replace rev command by sed
authorBenjamin Drung <benjamin.drung@canonical.com>
Tue, 18 Nov 2025 18:34:52 +0000 (19:34 +0100)
committerLaszlo <laszlo.gombos@gmail.com>
Sun, 23 Nov 2025 13:58:36 +0000 (08:58 -0500)
On Debian-based systems, the `rev` command is shipped by the
bsdextrautils package. Replace the `rev` command by `sed` which is an
essential command and does not need additional packages.

test/container/Dockerfile-debian
test/run-qemu
test/test-functions

index a30d57cc1a5ba69a93c199bdecaf99d290faf8be..e8586cf5a741e053333614d2d836245f87b171ea 100644 (file)
@@ -34,7 +34,6 @@ RUN \
     DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends -o Dpkg::Use-Pty=0 \
     asciidoctor \
     bluez \
-    bsdextrautils \
     btrfs-progs \
     ca-certificates \
     cargo \
index 3105390a893f694894f064b17d3751053650a0b9..aca4b1f54e67ce087e9a7a83cfafd208a85cce09 100755 (executable)
@@ -138,7 +138,7 @@ ARGS+=("$@")
 # only set -kernel if -initrd is specified
 initrd=$(get_initrd "${ARGS[@]}")
 if [[ -n $initrd ]]; then
-    KVERSION=$(lsinitrd "$initrd" | grep modules.dep | head -1 | rev | cut -d'/' -f2 | rev)
+    KVERSION=$(lsinitrd "$initrd" | grep modules.dep | head -1 | sed 's;.*/\([^/]\+\)/modules.dep;\1;')
     set_vmlinux_env
     ARGS+=(-kernel "$VMLINUZ")
     add_to_append "console=${console:-ttyS0},115200"
index 26fd85a3f7e50ab35efee69a6ab0f24a15de943c..dc93361e40f20e6707540cf5367cda169922087a 100644 (file)
@@ -133,7 +133,7 @@ command -v test_cleanup &> /dev/null || test_cleanup() {
 }
 
 determine_kernel_version() {
-    lsinitrd "$1" | grep modules.dep | head -1 | rev | cut -d'/' -f2 | rev
+    lsinitrd "$1" | grep modules.dep | head -1 | sed 's;.*/\([^/]\+\)/modules.dep;\1;'
 }
 
 determine_kernel_image() {