cmdlib: factor out runnning supermin with cache
Prep for future patch.
@@ -520,6 +520,11 @@ impl_rpmostree_compose() {
# with a consistent value, regardless of the environment
(umask 0022 && sudo -E "$@")
else
+ runvm_with_cache "$@"
+ fi
+}
+
+runvm_with_cache() {
# "cache2" has an explicit label so we can find it in qemu easily
if [ ! -f "${workdir}"/cache/cache2.qcow2 ]; then
qemu-img create -f qcow2 cache2.qcow2.tmp 10G
@@ -535,10 +540,9 @@ impl_rpmostree_compose() {
if is_transient; then
cachedriveargs="cache=unsafe,discard=ignore"
fi
- compose_qemu_args+=("-drive" "if=none,id=cache,$cachedriveargs,file=${workdir}/cache/cache2.qcow2" \
+ cache_args+=("-drive" "if=none,id=cache,$cachedriveargs,file=${workdir}/cache/cache2.qcow2" \
"-device" "virtio-blk,drive=cache")
- runvm "${compose_qemu_args[@]}" -- "$@"
- fi
+ runvm "${cache_args[@]}" -- "$@"
}
# Strips out the digest field from lockfiles since they subtly conflict with
