be3a677125
In order for vmcheck to be useful for testing, we need the machine to be in a "clean" state. That is, sitting on a commit, ready for being manipulated. This is a small step towards this goal. Instead of overwriting the files, we use rofiles-fuse to safely install and create a new deployment. Closes: #321 Approved by: cgwalters
19 lines
480 B
Bash
19 lines
480 B
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# ugly but simple way of fetching commit we're sitting on
|
|
commit=$(rpm-ostree status --json | \
|
|
python -c 'import sys, json; print json.load(sys.stdin)[0]["checksum"]')
|
|
|
|
if [[ -z $commit ]] || ! ostree rev-parse $commit; then
|
|
echo "Error while determining current commit" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cd /ostree/repo/tmp
|
|
umount vmcheck.ro 2>/dev/null ||:
|
|
rm -rf vmcheck*
|
|
ostree checkout $commit vmcheck --fsync=0
|
|
mkdir vmcheck.ro
|
|
rofiles-fuse vmcheck{,.ro}
|