diff --git a/libselinux.changes b/libselinux.changes index 96bae57..496afd0 100644 --- a/libselinux.changes +++ b/libselinux.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Sep 8 08:25:11 UTC 2014 - jsegitz@suse.com + +- updated selinux-ready script to handle initrd files compressed with xz + ------------------------------------------------------------------- Sun May 18 00:15:17 UTC 2014 - crrodriguez@opensuse.org diff --git a/selinux-ready b/selinux-ready index 278276d..667c95e 100644 --- a/selinux-ready +++ b/selinux-ready @@ -97,9 +97,9 @@ check_mkinitrd() return 2 fi - cp /boot/$INITRD $TD/i.cpio.gz 2>/dev/null + cp /boot/$INITRD $TD/ 2>/dev/null - if ! [ -f "$TD/i.cpio.gz" ];then + if ! [ -f "$TD/$INITRD" ];then printf "\tcheck_mkinitrd: ERR. Error while copying initrd file.'\n" return 2 fi @@ -109,11 +109,30 @@ check_mkinitrd() cd $TD mkdir initrd-extracted cd initrd-extracted - gunzip -c $TD/i.cpio.gz | cpio -i --force-local --no-absolute-filenames 2>/dev/null - grep -E -- $MCMD boot/* 2>&1 >/dev/null - FLG1=$? - grep -E -- load_policy boot/* 2>&1 >/dev/null - FLG2=$? + INITRD_FORMAT=$(file $TD/$INITRD | awk -F' ' '{print $2}') + case $INITRD_FORMAT in + 'XZ' ) + xz -d -c $TD/$INITRD | cpio -i --force-local --no-absolute-filenames 2>/dev/null ;; + 'gzip' ) + gzip -d -c $TD/$INITRD | cpio -i --force-local --no-absolute-filenames 2>/dev/null ;; + * ) + printf "\tcheck_mkinitrd: ERR. Error while extracting initrd file.'\n" + return 2 + esac + if [ -d boot ]; then + grep -E -- $MCMD boot/* 2>&1 >/dev/null + FLG1=$? + grep -E -- load_policy boot/* 2>&1 >/dev/null + FLG2=$? + else + # looks like we're using dracut/systemd. We can only check if libselinux1 + # exists + if [ -f lib64/libselinux.so.1 ]; then + # if this exists + FLG1=0 + FLG2=0 + fi + fi popd 2>&1>/dev/null if [ $FLG1 == 0 -a $FLG2 == 0 ];then