-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreate_instance.sh
More file actions
executable file
·35 lines (28 loc) · 1.02 KB
/
Copy pathcreate_instance.sh
File metadata and controls
executable file
·35 lines (28 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# =============================================================================
# create_instance.sh — Create a new Android emulator instance
#
# Usage:
# ./scripts/create_instance.sh <name> [profile] [ram_mb] [cpu_cores]
#
# Examples:
# ./scripts/create_instance.sh bot-01
# ./scripts/create_instance.sh bot-02 pixel_6
# ./scripts/create_instance.sh bot-03 samsung_s21 2048 2
# =============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
NAME="${1:-}"
PROFILE="${2:-samsung_s21}"
RAM="${3:-}"
CPUS="${4:-}"
[[ -n "$NAME" ]] || { echo "Usage: $0 <name> [profile] [ram_mb] [cpu_cores]"; exit 1; }
# Activate venv if present
[[ -d venv ]] && source venv/bin/activate
ARGS="--name $NAME --profile $PROFILE"
[[ -n "$RAM" ]] && ARGS="$ARGS --ram $RAM"
[[ -n "$CPUS" ]] && ARGS="$ARGS --cpus $CPUS"
# shellcheck disable=SC2086
python3 main.py create $ARGS