34 lines
696 B
Bash
34 lines
696 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Stop the Sunbeam Lima VM (preserves disk by default).
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
DELETE=false
|
||
|
|
HARD=false
|
||
|
|
|
||
|
|
for arg in "$@"; do
|
||
|
|
case $arg in
|
||
|
|
--delete) DELETE=true ;;
|
||
|
|
--hard) HARD=true ;;
|
||
|
|
*)
|
||
|
|
echo "Usage: $0 [--hard] [--delete]" >&2
|
||
|
|
exit 1
|
||
|
|
;;
|
||
|
|
esac
|
||
|
|
done
|
||
|
|
|
||
|
|
if $HARD; then
|
||
|
|
echo "==> Force-stopping Lima VM 'sunbeam'..."
|
||
|
|
limactl stop --force sunbeam
|
||
|
|
else
|
||
|
|
echo "==> Stopping Lima VM 'sunbeam' (graceful)..."
|
||
|
|
limactl stop sunbeam
|
||
|
|
fi
|
||
|
|
|
||
|
|
if $DELETE; then
|
||
|
|
echo "==> Deleting Lima VM 'sunbeam' (disk will be lost)..."
|
||
|
|
limactl delete sunbeam
|
||
|
|
echo "==> VM deleted."
|
||
|
|
else
|
||
|
|
echo "==> VM stopped. Disk preserved. Run scripts/local-up.sh to restart."
|
||
|
|
fi
|