]> git.ipfire.org Git - thirdparty/dracut.git/blobdiff - test/TEST-99-RPM/test.sh
TEST-99-RPM: ignore weak dependencies in dnf
[thirdparty/dracut.git] / test / TEST-99-RPM / test.sh
index 345d5240b2f4a9037d1c85140df39610d0e95353..af64c24a9b286e510736ef86d8fa9dc093a6dbd4 100755 (executable)
@@ -18,8 +18,8 @@ test_run() {
     mkdir -p "$rootdir/dev"
     mkdir -p "$rootdir/boot"
 
-trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit $ret;' EXIT
-trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit 1;' SIGINT
+    trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit $ret;' EXIT
+    trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit 1;' SIGINT
 
     mount --bind /proc "$rootdir/proc"
     mount --bind /sys "$rootdir/sys"
@@ -27,40 +27,47 @@ trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umou
 
     mkdir -p "$rootdir/$TESTDIR"
     cp --reflink=auto -a \
-       "$TESTDIR"/dracut-[0-9]*.$(arch).rpm \
-       "$TESTDIR"/dracut-network-[0-9]*.$(arch).rpm \
+       "$TESTDIR"/dracut-[0-9]*.$(uname -m).rpm \
+       "$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
        "$rootdir/$TESTDIR/"
-
+    . /etc/os-release
     dnf_or_yum=yum
     dnf_or_yum_cmd=yum
     command -v dnf >/dev/null && { dnf_or_yum="dnf"; dnf_or_yum_cmd="dnf --allowerasing"; }
-    $dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever 25 --disablerepo='*' \
-                --enablerepo=fedora --enablerepo=updates \
-                install -y \
-       $dnf_or_yum \
-       passwd \
-       rootfiles \
-       systemd \
-    systemd-udev \
-       kernel \
-       kernel-core \
-       redhat-release \
-       device-mapper-multipath \
-       lvm2 \
-       mdadm \
-    bash \
-    iscsi-initiator-utils \
-    "$TESTDIR"/dracut-[0-9]*.$(arch).rpm \
-    ${NULL}
-    #"$TESTDIR"/dracut-config-rescue-[0-9]*.$(arch).rpm \
-    #"$TESTDIR"/dracut-network-[0-9]*.$(arch).rpm \
-#    ${NULL}
+    for (( i=0; i < 5 ; i++)); do
+        $dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever "$VERSION_ID" --disablerepo='*' \
+                        --enablerepo=fedora --enablerepo=updates --setopt=install_weak_deps=False \
+                        install -y \
+                        $dnf_or_yum \
+                        passwd \
+                        rootfiles \
+                        systemd \
+                        systemd-udev \
+                        kernel \
+                        kernel-core \
+                        redhat-release \
+                        device-mapper-multipath \
+                        lvm2 \
+                        mdadm \
+                        bash \
+                        iscsi-initiator-utils \
+                        "$TESTDIR"/dracut-[0-9]*.$(uname -m).rpm \
+                        ${NULL} && break
+        #"$TESTDIR"/dracut-config-rescue-[0-9]*.$(uname -m).rpm \
+            #"$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
+            #    ${NULL}
+    done
+    (( i < 5 ))
 
     cat >"$rootdir"/test.sh <<EOF
 #!/bin/bash
 set -x
 export LC_MESSAGES=C
-rpm -Va |& grep -F -v '85-display-manager.preset' &> /test.output
+rpm -Va |& \
+    grep -F \
+       '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' \
+    &> /test.output
+
 find / -xdev -type f -not -path '/var/*' \
   -not -path '/usr/lib/modules/*/modules.*' \
   -not -path '/etc/*-' \
@@ -87,9 +94,9 @@ EOF
     chroot "$rootdir" /test.sh || :
 
     if [[ -s "$rootdir"/test.output ]]; then
-       failed=1
-       echo TEST Failed >&2
-       cat "$rootdir"/test.output >&2
+        failed=1
+        echo TEST Failed >&2
+        cat "$rootdir"/test.output >&2
     fi
 
     umount "$rootdir/proc"