aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2012-04-14 13:57:13 +0000
committerColin Guthrie <colin@mageia.org>2012-04-14 13:57:13 +0000
commitccc8760dbb7842fb789432d783e0d57c6c0e6cbd (patch)
tree48ce975dfa5fb405b551b4ff770998c82e49abb1
parent4b1d2e118920158d4352ec6329e18bc74c8dd1fd (diff)
Avoid using cpio-filter and cpio --append
We seem to go out of our way to avoid creating a 'new' cpio archive. This all seems rather unnecessary and error prone and cpio-filter will create a new archive anyway, so it's also rather redundant. Adopt a simpler process: extract the initrd fully, and run the plymouth population in-place, then just recompress the result. This also changes the archive creation stage to be the same commands used by dracut for clarity.
-rwxr-xr-xscripts/make-boot-splash-raw20
1 files changed, 8 insertions, 12 deletions
diff --git a/scripts/make-boot-splash-raw b/scripts/make-boot-splash-raw
index 1b1e393..327240d 100755
--- a/scripts/make-boot-splash-raw
+++ b/scripts/make-boot-splash-raw
@@ -32,24 +32,20 @@ initrd_file="$(readlink -f "$initrd_file")"
# warly: we cannot use file command which is in /usr/bin/
# initrd_type=`zcat /boot/initrd-2.6.14-2mdk.ramfs.img | file -`
-if `/bin/zcat $initrd_file 2> /dev/null | /bin/cpio -t &> /dev/null`; then
+if ( /bin/zcat $initrd_file 2> /dev/null | /bin/cpio -it &> /dev/null ); then
if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
tmp_dir=`mktemp -d`
[ -n "$tmp_dir" ] || clean_and_fail
+
mkdir $tmp_dir/plymouth
- /usr/libexec/plymouth/plymouth-populate-initrd -t $tmp_dir/plymouth || clean_and_fail
cd $tmp_dir/plymouth || clean_and_fail
+ /bin/zcat $initrd_file | /bin/cpio -id --quiet || clean_and_fail
+ /usr/libexec/plymouth/plymouth-populate-initrd -t . || clean_and_fail
- # Avoid duplicate files, adding another copy of glibc each time makes
- # initrd grow fast
- /bin/zcat $initrd_file 2> /dev/null | \
- cpio-filter --exclude `/bin/find . -type f -print | sed -e 's,\./,,g' | \
- sed -e 's,^\.$,,' | tr '\n' '|' | sed -e 's/|$//'` > $tmp_dir/initrd || clean_and_fail
-
- /bin/find . -print | sed -e 's,\./,,g' | sed -e 's,^\.$,,' | \
- sort -u | cpio -o -c --quiet -O $tmp_dir/initrd --append 2>/dev/null || clean_and_fail
- gzip -9 -c $tmp_dir/initrd > $initrd_file.tmp || clean_and_fail
- mv -f $initrd_file.tmp $initrd_file
+ /bin/find . | \
+ cpio -R 0:0 -H newc -o --quiet | \
+ gzip -9 > $tmp_dir/initrd || clean_and_fail
+ mv -f $tmp_dir/initrd $initrd_file
fi
else
$splash_dir/scripts/remove-boot-splash $initrd_file