diff --git a/test/test-functions b/test/test-functions index abe421c505c..0dc8837e464 100644 --- a/test/test-functions +++ b/test/test-functions @@ -935,11 +935,52 @@ install_debian_systemd() { done < <(grep -E '^Package:' "${SOURCE_DIR}/debian/control" | cut -d ':' -f 2) } +install_suse_systemd() { + local testsdir=/usr/lib/systemd/tests + local pkgs + + dinfo "Install SUSE systemd" + + pkgs=( + systemd + systemd-container + systemd-coredump + systemd-experimental + systemd-journal-remote + systemd-portable + udev + ) + + for p in "${pkgs[@]}"; do + rpm -q "$p" &>/dev/null || continue + + ddebug "Install files from package $p" + while read -r f; do + [ -e "$f" ] || continue + [ -d "$f" ] && continue + inst "$f" + done < <(rpm -ql "$p") + done + + # we only need testsdata dir as well as the unit tests (for + # TEST-02-UNITTESTS) in the image. + dinfo "Install unit tests and testdata directory" + + mkdir -p "$initdir/$testsdir" + cp "$testsdir"/test-* "$initdir/$testsdir/" + cp -a "$testsdir/testdata" "$initdir/$testsdir/" + + # On openSUSE, these dirs are not created at package install for now on. + mkdir -p "$initdir/var/log/journal/remote" +} + install_distro_systemd() { dinfo "Install distro systemd" if get_bool "$LOOKS_LIKE_DEBIAN"; then install_debian_systemd + elif get_bool "$LOOKS_LIKE_SUSE"; then + install_suse_systemd else dfatal "NO_BUILD not supported for this distro" exit 1 @@ -957,8 +998,6 @@ install_systemd() { # remove unneeded documentation rm -fr "$initdir"/usr/share/{man,doc} - get_bool "$LOOKS_LIKE_SUSE" && setup_suse - # enable debug logging in PID1 echo LogLevel=debug >>"$initdir/etc/systemd/system.conf" # store coredumps in journal @@ -2405,12 +2444,6 @@ instmods() { return 0 } -setup_suse() { - ln -fs ../usr/bin/systemctl "${initdir:?}/bin/" - ln -fs ../usr/lib/systemd "$initdir/lib/" - inst_simple "/usr/lib/systemd/system/haveged.service" -} - _umount_dir() { local mountpoint="${1:?}" if mountpoint -q "$mountpoint"; then