3 TEST_DESCRIPTION
="rpm integrity after dracut and kernel install"
6 command -v rpm
&>/dev
/null
&& ( command -v yum ||
command -v dnf
) &>/dev
/null
12 export rootdir
=$TESTDIR/root
16 mkdir
-p "$rootdir/proc"
17 mkdir
-p "$rootdir/sys"
18 mkdir
-p "$rootdir/dev"
19 mkdir
-p "$rootdir/boot"
21 trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit $ret;' EXIT
22 trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit 1;' SIGINT
24 mount
--bind /proc
"$rootdir/proc"
25 mount
--bind /sys
"$rootdir/sys"
26 mount
-t devtmpfs devtmpfs
"$rootdir/dev"
28 mkdir
-p "$rootdir/$TESTDIR"
29 cp --reflink=auto
-a \
30 "$TESTDIR"/dracut-
[0-9]*.$
(uname
-m).rpm \
31 "$TESTDIR"/dracut-network-
[0-9]*.$
(uname
-m).rpm \
36 command -v dnf
>/dev
/null
&& { dnf_or_yum
="dnf"; dnf_or_yum_cmd
="dnf --allowerasing"; }
37 for (( i
=0; i
< 5 ; i
++)); do
38 $dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever "$VERSION_ID" --disablerepo='*' \
39 --enablerepo=fedora
--enablerepo=updates
--setopt=install_weak_deps
=False \
49 device-mapper-multipath \
53 iscsi-initiator-utils \
54 "$TESTDIR"/dracut-
[0-9]*.$
(uname
-m).rpm \
56 #"$TESTDIR"/dracut-config-rescue-[0-9]*.$(uname -m).rpm \
57 #"$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
62 cat >"$rootdir"/test.sh
<<EOF
68 '85-display-manager.preset| /run| /var| /usr/lib/variant| /etc/machine-id| /etc/systemd/system/dbus-org.freedesktop.network1.service| /etc/systemd/system/dbus-org.freedesktop.resolve1.service| /etc/udev/hwdb.bin| /usr/share/info/dir.old' \
71 find / -xdev -type f -not -path '/var/*' \
72 -not -path '/usr/lib/modules/*/modules.*' \
73 -not -path '/etc/*-' \
74 -not -path '/etc/.pwd.lock' \
75 -not -path '/run/mount/utab' \
76 -not -path '/test.sh' \
77 -not -path '/test.output' \
78 -not -path '/etc/nsswitch.conf.bak' \
79 -not -path '/etc/iscsi/initiatorname.iscsi' \
80 -not -path '/boot/*0-rescue*' \
81 -not -path '/usr/share/mime/*' \
82 -not -path '/etc/crypto-policies/*' \
83 -not -path '/dev/null' \
84 -not -path "/boot/loader/entries/\$(cat /etc/machine-id)-*" \
85 -not -path "/boot/\$(cat /etc/machine-id)/*" \
86 -not -path '/etc/openldap/certs/*' \
87 -print0 | xargs -0 rpm -qf | \
88 grep -F 'not owned' &>> /test.output || :
92 chmod 0755 "$rootdir/test.sh"
94 chroot
"$rootdir" /test.sh ||
:
96 if [[ -s "$rootdir"/test.output
]]; then
99 cat "$rootdir"/test.output
>&2
102 umount
"$rootdir/proc"
103 umount
"$rootdir/sys"
104 umount
"$rootdir/dev"
106 [[ $failed ]] && return 1
112 make -C "$basedir" DESTDIR
="$TESTDIR/" rpm
117 rm -fr -- "$TESTDIR"/*.rpm
121 .
$testdir/test-functions