3
0
forked from pool/libselinux

Accepting request 247967 from home:jsegitz:branches:security:SELinux

- updated selinux-ready script to handle initrd files compressed with xz

OBS-URL: https://build.opensuse.org/request/show/247967
OBS-URL: https://build.opensuse.org/package/show/security:SELinux/libselinux?expand=0&rev=79
This commit is contained in:
Johannes Segitz 2014-09-08 09:42:21 +00:00 committed by Git OBS Bridge
parent e6aba78eb0
commit 0b8e4bc585
2 changed files with 31 additions and 7 deletions

View File

@ -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

View File

@ -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