Skip to content

Commit 76de08a

Browse files
committed
wip: need to test for lockfiles that can be removed during archival
1 parent 85dfb6a commit 76de08a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

archive_fusionvm

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ echo "SRCPATH is $SRCPATH"
1919

2020
i=0
2121

22-
while true; do
23-
# Test whether running .vmx files are inside our path.
24-
running=(${(@f)"$(vmrun list | grep "$SRCPATH")"})
22+
# Test whether running .vmx files are inside our path.
23+
running=(${(@f)"$(vmrun list | grep "$SRCPATH")"})
2524

25+
# Save this initial list of .vmx files
26+
vmxlist=$running
27+
28+
while true; do
2629
echo "Current running VM list is $running"
2730

2831
# If no VMs are running, we can continue.
@@ -40,8 +43,16 @@ while true; do
4043
echo "Suspending $vmx"
4144
vmrun suspend "$vmx"
4245
done
46+
47+
# Refresh running VM list
48+
running=(${(@f)"$(vmrun list | grep "$SRCPATH")"})
4349
done
4450

51+
# Test that every VMX in the list has no lockfile; otherwise quit Fusion
52+
if [false]; then
53+
osascript -e 'tell application "VMware Fusion to quit'
54+
fi
55+
4556
# Create a compressed read-only .dmg. HFS+ seems to be smaller than APFS.
4657
echo "Creating disk image"
4758
hdiutil create -srcfolder "$1" "$2" -fs HFS+

0 commit comments

Comments
 (0)