From 1ceb20ffa67266674c226dd1e5eee3eba4b77a69 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sat, 14 Apr 2012 14:25:54 +0000 Subject: Add support for xz compressed initrds. Default options for xz compression taken from dracut. This change also removes various /bin/ path prefixes as there was previously a mix. xz* tools are technically in /usr so thus support may not be 100% complete until we have finished the /usr merge in mga3 and as such gzip compressed initrds should likely remain the default for mga2. No support for xz compressed initrds has yet been added to the remove-boot-splash script which is inexplicably implemented in perl rather than in bash like the rest of the scripts. --- scripts/make-boot-splash-raw | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/make-boot-splash-raw b/scripts/make-boot-splash-raw index 996be5a..4eca50f 100755 --- a/scripts/make-boot-splash-raw +++ b/scripts/make-boot-splash-raw @@ -32,22 +32,33 @@ 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 -it &> /dev/null ); then +CPIO= +[ -z "$CPIO" ] && zcat $initrd_file 2>/dev/null | cpio -it --quiet &>/dev/null && CPIO=gz +[ -z "$CPIO" ] && xzcat $initrd_file 2>/dev/null | cpio -it --quiet &>/dev/null && CPIO=xz + +if [ -n "$CPIO" ]; then if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then tmp_dir=`mktemp -d` [ -n "$tmp_dir" ] || clean_and_fail + EXTRACT=zcat + COMPRESS="gzip -9" + if [ "xz" = "$CPIO" ]; then + EXTRACT=xzcat + COMPRESS="xz --check=crc32 --lzma2=dict=1MiB" + fi + mkdir $tmp_dir/plymouth cd $tmp_dir/plymouth || clean_and_fail - /bin/zcat $initrd_file | /bin/cpio -id --quiet || clean_and_fail + $EXTRACT $initrd_file | cpio -id --quiet || clean_and_fail # If the theme has changed, we should remove the old one first to save space rm -rf $tmp_dir/plymouth/usr/share/plymouth/themes PLYMOUTH_THEME_NAME=$THEME /usr/libexec/plymouth/plymouth-populate-initrd -t . || clean_and_fail - /bin/find . | \ + find . | \ cpio -R 0:0 -H newc -o --quiet | \ - gzip -9 > $tmp_dir/initrd || clean_and_fail + $COMPRESS > $tmp_dir/initrd || clean_and_fail mv -f $tmp_dir/initrd $initrd_file fi else -- cgit v1.2.1