main/postmarketos-mkinitfs: fix incorrect cpio usage (MR 1619)

cpio expects a newline-separated list of files from stdin by default,
and you can change that to a NULL-terminated list of files by using the
'-0' switch.

Previously we were passing a NULL-terminated list ('-print0') and using
cpio with the default setting. For some reason busybox cpio works with
that but GNU cpio doesn't like that and generates an initramfs without
any files (as it only gets "a single file").

With this change the initramfs generation works fine with both busybox
cpio and gnu cpio.

Fixes #815
This commit is contained in:
Luca Weiss 2020-10-06 14:18:13 +02:00 committed by Bart Ribbers
parent 5ae1207392
commit 0fac39abe1
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
pkgname=postmarketos-mkinitfs
pkgver=0.14.1
pkgrel=1
pkgver=0.14.2
pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
depends="
@ -57,5 +57,5 @@ sha512sums="5037cb7285bb7c0c40ca9e6df332d882ef9a8b379756c785f921e062dab1b7e7f313
7fc6ba96419628850984df3322b73bcf655cba03fe3e97ec7425e66e90f4b2a4de106b5cb2e3d46785a92557334288011334104285e2050c7a8e823b8fa5668c init.sh.in
e9bbf6850c0c44f10c8fe66ceb05ed454844646dd937b5fe614810a0cce7c7383febe5ee1b0830217bff71a29621d82aa57adbcd59cb24a72701504887513ff1 init_functions.sh
dfc01ee0547ea88b7aa45a005e842b636e9e19bbf1705f3dad53a66d57af7c5c513c092b5469a06d9b00322e56a4d25f1b47e4c5324aafa99f5291679968d1f1 mkinitfs.sh
6f2948e5653076cc5e987a0438b62c0492fbbda911dce8153628bd749987ecbce3bf2f95594a49beda1b9ff851aa368c550f4ea7830cbf6e97784b4289183493 mkinitfs_functions.sh
f82f301f11cbe797210c878762fd0f531af17706496c7721d6ef5b210221d46444886ceb07cd18a10f7d4742aa6a61c3486f49e02c149750158dc92838a24f9e mkinitfs_functions.sh
c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh"

View file

@ -270,7 +270,7 @@ create_cpio_image()
fi
[ -z "$deviceinfo_initfs_compression" ] && deviceinfo_initfs_compression='gzip -1'
find . -print0 \
| cpio --quiet -o -H newc \
| cpio --quiet -o -0 -H newc \
| $deviceinfo_initfs_compression > "$2"
}