Skip to content

Commit

Permalink
Auto-recreate cache.qcow2 if deleted
Browse files Browse the repository at this point in the history
Since it's a cache, let's support deleting it.  I killed a build
that was too slow and got a stale lock file in my cache and wanted
to be able to just `rm` it.
  • Loading branch information
cgwalters authored and jlebon committed Feb 6, 2019
1 parent cfc9e0c commit 3064a30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/cmd-init
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,3 @@ mkdir -p cache
mkdir -p builds
mkdir -p tmp
ostree --repo=repo init --mode=archive
if ! has_privileges && [ ! -f cache/cache.qcow2 ]; then
qemu-img create -f qcow2 cache/cache.qcow2 10G
LIBGUESTFS_BACKEND=direct virt-format --filesystem=xfs -a cache/cache.qcow2
fi
7 changes: 5 additions & 2 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ prepare_build() {
preflight
if ! [ -d repo ]; then
fatal "No $(pwd)/repo found; did you run coreos-assembler init?"
elif ! has_privileges && [ ! -f cache/cache.qcow2 ]; then
fatal "No cache.qcow2 found; did you run coreos-assembler init?"
elif ! has_privileges; then
if [ ! -f cache/cache.qcow2 ]; then
qemu-img create -f qcow2 cache/cache.qcow2 10G
LIBGUESTFS_BACKEND=direct virt-format --filesystem=xfs -a cache/cache.qcow2
fi
fi

workdir="$(pwd)"
Expand Down

0 comments on commit 3064a30

Please sign in to comment.