2016-11-14 20:07:43 +03:00
#!/bin/bash
set -euo pipefail
# Execute this code path on the host
2016-11-22 06:22:51 +03:00
if test -z " ${ INSIDE_VM :- } " ; then
2016-11-14 20:07:43 +03:00
. ${ commondir } /libvm.sh
2016-11-22 06:22:51 +03:00
vm_setup
if ! vm_ssh_wait 30; then
echo "ERROR: A running VM is required for 'make vmcheck'."
exit 1
fi
2016-11-14 20:07:43 +03:00
set -x
2016-12-21 07:22:03 +03:00
cd ${ topsrcdir }
2016-11-14 20:07:43 +03:00
rm insttree -rf
2017-01-17 21:18:23 +03:00
DESTDIR = $( pwd ) /insttree
make install DESTDIR = ${ DESTDIR }
for san in a t ub; do
if eu-readelf -d ${ DESTDIR } /usr/libexec/rpm-ostreed | grep -q " NEEDED.*lib ${ san } san " ; then
echo " Installing extra sanitizier: lib ${ san } san "
cp /usr/lib64/lib${ san } san*.so.* ${ DESTDIR } /usr/lib64
fi
done
2016-11-14 20:07:43 +03:00
vm_rsync
2016-11-22 06:22:51 +03:00
$SSH "env INSIDE_VM=1 /var/roothome/sync/tests/vmcheck/overlay.sh"
vm_reboot
2016-11-14 20:07:43 +03:00
exit 0
fi
set -x
# And then this code path in the VM
commit = $( rpm-ostree status --json | \
python -c '
import sys, json;
deployments = json.load( sys.stdin) [ "deployments" ]
for deployment in deployments:
if deployment[ "booted" ] :
print deployment[ "checksum" ]
exit( ) ' )
if [ [ -z $commit ] ] || ! ostree rev-parse $commit ; then
echo "Error while determining current commit" >& 2
exit 1
fi
cd /ostree/repo/tmp
rm vmcheck -rf
ostree checkout $commit vmcheck --fsync= 0
2017-01-19 21:21:14 +03:00
rsync -rlv /var/roothome/sync/insttree/usr/ vmcheck/usr/
2016-11-14 20:07:43 +03:00
ostree refs --delete vmcheck || true
ostree commit -b vmcheck -s '' --tree= dir = vmcheck --link-checkout-speedup
ostree admin deploy vmcheck