rpm-ostree/vagrant/checkout.sh
Jonathan Lebon 0974a22834 vagrant: use new 'booted' key to get current csum
Closes: #360
Approved by: cgwalters
2016-06-29 19:17:38 +00:00

25 lines
591 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;
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
umount vmcheck.ro 2>/dev/null ||:
rm -rf vmcheck*
ostree checkout $commit vmcheck --fsync=0
mkdir vmcheck.ro
rofiles-fuse vmcheck{,.ro}