From: Benjamin Drung Date: Thu, 25 Sep 2025 10:35:00 +0000 (+0200) Subject: test(SKIPCPIO): support 3cpio X-Git-Tag: 109~81 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a15ecbd7a0f817d3af004538a99c511e4231d812;p=thirdparty%2Fdracut-ng.git test(SKIPCPIO): support 3cpio Support using 3cpio in the skipcpio test to allow not having `cpio` installed. --- diff --git a/test/TEST-81-SKIPCPIO/test.sh b/test/TEST-81-SKIPCPIO/test.sh index 877317f00..1bdeb1c8e 100755 --- a/test/TEST-81-SKIPCPIO/test.sh +++ b/test/TEST-81-SKIPCPIO/test.sh @@ -7,16 +7,29 @@ set -eu TEST_DESCRIPTION="test skipcpio" test_check() { - (command -v cpio && command -v find && command -v diff) &> /dev/null + if ! command -v 3cpio &> /dev/null && ! command -v cpio &> /dev/null; then + echo "Neither 3cpio nor cpio are available." + return 1 + fi + + (command -v find && command -v diff) &> /dev/null } cpio_create() { - find . -print0 | sort -z | cpio -o --null -H newc + if command -v 3cpio &> /dev/null; then + find . | sort | 3cpio --create + else + find . -print0 | sort -z | cpio -o --null -H newc + fi } cpio_list_first() { local file="$1" - cpio --extract --quiet --list < "$file" + if command -v 3cpio &> /dev/null; then + 3cpio --list --parts 1 "$file" + else + cpio --extract --quiet --list < "$file" + fi } skipcpio_simple() {