#!/bin/bash set -ex # HACK - virt-resize might not be able to resize our xfs rootfs, # depending on how it was compiled and which plugins are installed, # and will just silently not do it. So we do it here. # xfs_growfs / df -h / echo foobar | passwd --stdin root HAVE_KUBERNETES= if [ $(uname -m) = x86_64 ]; then HAVE_KUBERNETES=1 fi # We install all dependencies of the cockpit packages since we want # them to not spontaneously change from one test run to the next when # the distribution repository is updated. # COCKPIT_DEPS="\ atomic \ device-mapper-multipath \ etcd \ glib-networking \ json-glib \ kexec-tools \ libssh \ libvirt \ libvirt-client \ NetworkManager-team \ PackageKit \ pcp \ pcp-libs \ qemu \ realmd \ selinux-policy-targeted \ setroubleshoot-server \ sos \ storaged \ storaged-lvm2 \ storaged-iscsi \ subscription-manager \ tuned \ virt-install \ " [ -z "$HAVE_KUBERNETES" ] || COCKPIT_DEPS="$COCKPIT_DEPS kubernetes" # On the latest Fedora we mix things up a bit and install docker-latest # which Fedora and RHEL package as a more up to date version of docker COCKPIT_DEPS="$COCKPIT_DEPS docker-latest" # We also install the packages necessary to join a FreeIPA domain so # that we don't have to go to the network during a test run. # IPA_CLIENT_PACKAGES="\ freeipa-client \ oddjob \ oddjob-mkhomedir \ sssd \ " TEST_PACKAGES="\ systemtap-runtime-virtguest \ valgrind \ gdb \ targetcli \ " rm -rf /etc/sysconfig/iptables maybe() { if type "$1" >/dev/null 2>&1; then "$@"; fi; } # For the D-Bus test server maybe firewall-cmd --permanent --add-port 8765/tcp echo 'NETWORKING=yes' > /etc/sysconfig/network useradd -c Administrator -G wheel admin echo foobar | passwd --stdin admin dnf $DNF_OPTS -y upgrade dnf $DNF_OPTS -y install $TEST_PACKAGES $COCKPIT_DEPS $IPA_CLIENT_PACKAGES # Prepare for building dnf $DNF_OPTS -y install mock dnf-plugins-core rpm-build useradd -c Builder -G mock builder # HACK - mock --installdeps with yum is broken, it seems that it can't # run any package scriptlets. Yum is deprecated anyway so we just use # dnf. I wonder why dnf isn't the default anyway... # echo "config_opts['package_manager'] = 'dnf'" >>/etc/mock/site-defaults.cfg # HACK - Switch off gpgcheck while the repos and mirrors settle down sed -i -e 's/gpgcheck=1/gpgcheck=0/' /etc/mock/default.cfg srpm=$(/var/lib/testvm/make-srpm $TEST_SOURCE) su builder -c "/usr/bin/mock --verbose --installdeps $srpm" # HACK: docker fails without /etc/resolv.conf # https://bugzilla.redhat.com/show_bug.cgi?id=1448331 mkdir -p /etc/systemd/system/docker.service.d printf "[Service]\nExecStartPre=/bin/sh -c 'echo -n >> /etc/resolv.conf'\n" > /etc/systemd/system/docker.service.d/resolv.conf systemctl daemon-reload systemctl start docker || systemctl start docker-latest # our cockpit/base container are only really a thing on x86_64, just skip it on other arches if [ $(uname -m) = x86_64 ]; then docker build -t cockpit/base /var/tmp/cockpit-base fi # docker images that we need for integration testing /var/lib/testvm/docker-images.setup # Configure kubernetes [ -z "$HAVE_KUBERNETES" ] || /var/lib/testvm/kubernetes.setup # HACK: https://bugzilla.redhat.com/show_bug.cgi?id=1341829 # SELinux breaks coredumping on fedora-25 printf '(allow init_t domain (process (rlimitinh)))\n' > domain.cil semodule -i domain.cil # reduce image size dnf clean all /var/lib/testvm/zero-disk.setup ln -sf ../selinux/config /etc/sysconfig/selinux printf "SELINUX=enforcing\nSELINUXTYPE=targeted\n" > /etc/selinux/config # Prevent SSH from hanging for a long time when no external network access echo 'UseDNS no' >> /etc/ssh/sshd_config touch /.autorelabel # Audit events to the journal rm -f '/etc/systemd/system/multi-user.target.wants/auditd.service' rm -rf /var/log/audit/