2016-11-14 20:07:43 +03:00
#!/bin/bash
set -euo pipefail
2016-11-22 06:22:51 +03:00
if test -z " ${ INSIDE_VM :- } " ; then
2016-11-14 20:07:43 +03:00
2016-11-22 06:22:51 +03:00
# do this in the host
. ${ commondir } /libvm.sh
vm_setup
if ! vm_ssh_wait 30; then
echo "ERROR: A running VM is required for 'make vmcheck'."
exit 1
fi
set -x
2016-12-21 07:22:03 +03:00
cd ${ topsrcdir }
2017-03-23 20:57:56 +03:00
export VMCHECK_INSTTREE = ${ VMCHECK_INSTTREE :- $( pwd ) /insttree }
2017-05-29 17:46:47 +03:00
# Always pull ostree from the build container; we assume development and
# testing is against git master. See also overlay.sh and build.sh.
ostree --version
for pkg in ostree{ ,-libs,-grub2} ; do
rpm -q $pkg
# We do not have perms to read /etc/grub2 as non-root
2017-07-11 02:18:47 +03:00
rpm -ql $pkg | grep -v '^/etc/' | sed "s/^/+ /" > list.txt
echo "- *" >> list.txt
2017-05-29 17:46:47 +03:00
# In the prebuilt container case, manpages are missing. Ignore that.
# Also chown everything to writable, due to https://bugzilla.redhat.com/show_bug.cgi?id=517575
chmod -R u+w ${ VMCHECK_INSTTREE } /
2017-07-11 02:18:47 +03:00
# The --ignore-missing-args option was added in rsync 3.1.0,
# but CentOS7 only has rsync 3.0.9. Can simulate the behavior
# with --include-from and the way we constructed list.txt.
rsync -l --include-from= list.txt / ${ VMCHECK_INSTTREE } /
2017-05-29 17:46:47 +03:00
rm -f list.txt
done
2017-03-23 20:57:56 +03:00
make install DESTDIR = ${ VMCHECK_INSTTREE }
2016-11-22 06:22:51 +03:00
vm_rsync
2017-07-27 17:16:23 +03:00
vm_cmd env INSIDE_VM = 1 /var/roothome/sync/tests/vmcheck/sync.sh
2016-11-22 06:22:51 +03:00
exit 0
else
# then do this in the VM
set -x
ostree admin unlock || :
2017-07-25 19:48:36 +03:00
# only copy /usr and /etc
2017-01-19 21:21:14 +03:00
rsync -rlv /var/roothome/sync/insttree/usr/ /usr/
2017-07-25 19:48:36 +03:00
rsync -rlv /var/roothome/sync/insttree/etc/ /etc/
2016-05-27 21:46:46 +03:00
restorecon -v /usr/bin/rpm-ostree
restorecon -v /usr/libexec/rpm-ostreed
2017-06-09 23:16:51 +03:00
mkdir -p /etc/systemd/system/rpm-ostreed.service.d
# For our test suite at least, to catch things like https://github.com/projectatomic/rpm-ostree/issues/826
cat > /etc/systemd/system/rpm-ostreed.service.d/fatal-warnings.conf << EOF
[ Service]
Environment = G_DEBUG = fatal-warnings
EOF
2017-05-29 17:46:47 +03:00
systemctl daemon-reload
2016-11-22 06:22:51 +03:00
systemctl restart rpm-ostreed
fi