2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4 TEST_DESCRIPTION="rpm integrity after dracut and kernel install"
9 export rootdir=$TESTDIR/root
13 mkdir -p "$rootdir/proc"
14 mkdir -p "$rootdir/sys"
15 mkdir -p "$rootdir/dev"
17 trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit $ret;' EXIT
18 trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit 1;' SIGINT
20 mount --bind /proc "$rootdir/proc"
21 mount --bind /sys "$rootdir/sys"
22 mount -t devtmpfs devtmpfs "$rootdir/dev"
24 yum --nogpgcheck --releasever=/ --installroot "$rootdir"/ install -y \
31 device-mapper-multipath \
35 iscsi-initiator-utils \
36 $basedir/dracut-[0-9]*.$(arch).rpm \
37 $basedir/dracut-network-[0-9]*.$(arch).rpm
39 cat >"$rootdir"/test.sh <<EOF
43 rpm -Va &> /test.output
44 find / -xdev -type f -not -path '/var/*' \
45 -not -path '/usr/lib/modules/*/modules.*' \
46 -not -path '/etc/*-' \
47 -not -path '/etc/.pwd.lock' \
48 -not -path '/run/mount/utab' \
49 -not -path '/test.sh' \
50 -not -path '/test.output' \
51 -not -path '/etc/nsswitch.conf.bak' \
52 -not -path '/etc/iscsi/initiatorname.iscsi' \
53 -not -path '/dev/null' \
54 -exec rpm -qf '{}' ';' | \
55 fgrep 'not owned' &> /test.output
59 chmod 0755 "$rootdir/test.sh"
61 chroot "$rootdir" /test.sh
63 if [[ -s "$rootdir"/test.output ]]; then
66 cat "$rootdir"/test.output >&2
69 umount "$rootdir/proc"
73 [[ $failed ]] && return 1
86 . $testdir/test-functions