aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/scripts/azure-pipelines/osx/start-parallels-vm.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/scripts/azure-pipelines/osx/start-parallels-vm.zsh')
-rw-r--r--vcpkg/scripts/azure-pipelines/osx/start-parallels-vm.zsh47
1 files changed, 47 insertions, 0 deletions
diff --git a/vcpkg/scripts/azure-pipelines/osx/start-parallels-vm.zsh b/vcpkg/scripts/azure-pipelines/osx/start-parallels-vm.zsh
new file mode 100644
index 0000000..5e60b2a
--- /dev/null
+++ b/vcpkg/scripts/azure-pipelines/osx/start-parallels-vm.zsh
@@ -0,0 +1,47 @@
+#!/usr/bin/env zsh
+
+set -e # Exit on any error
+
+# Find the .pvmp file
+PVMP_FILE=$(find ~/Parallels -name "*.pvmp" -type f | head -1)
+if [[ -z "$PVMP_FILE" ]]; then
+ echo "Error: No .pvmp file found in ~/Parallels"
+ exit 1
+fi
+
+echo "Found PVMP file: $PVMP_FILE"
+
+# Attach the PVMP file
+echo "Registering PVMP file..."
+/usr/local/bin/prlctl register "$PVMP_FILE"
+
+VM_NAME=$(/usr/local/bin/prlctl list --all --output name --no-header | head -1)
+
+if [[ -z "$VM_NAME" ]]; then
+ echo "Error: Failed to register PVMP file or extract VM ID"
+ exit 1
+fi
+
+echo "VM registered with ID: $VM_NAME"
+
+# Unpack the VM
+echo "Unpacking VM..."
+/usr/local/bin/prlctl unpack "$VM_NAME"
+
+# Configure startup and shutdown settings
+echo "Configuring VM startup and shutdown settings..."
+/usr/local/bin/prlctl set "$VM_NAME" --startup-view headless
+/usr/local/bin/prlctl set "$VM_NAME" --autostart start-host
+/usr/local/bin/prlctl set "$VM_NAME" --autostop shutdown
+/usr/local/bin/prlctl set "$VM_NAME" --on-shutdown close
+/usr/local/bin/prlctl set "$VM_NAME" --on-window-close keep-running
+
+echo "VM startup and shutdown settings configured successfully"
+
+# Display current VM configuration for verification
+echo "Current VM configuration:"
+/usr/local/bin/prlctl list "$VM_NAME" --info | grep -E "(Autostart|Autostop|Startup view|On shutdown|On window close)"
+
+echo "Parallels VM setup completed successfully!"
+echo "VM ID: $VM_NAME"
+