forked from honeynet/droidbot
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_sample.sh
More file actions
34 lines (27 loc) · 967 Bytes
/
run_sample.sh
File metadata and controls
34 lines (27 loc) · 967 Bytes
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
#!/bin/bash
HAP_FILE="orangeMall.hap"
URL="https://raw.githubusercontent.com/XixianLiang/HarmonyOS_NEXT_apps/master/orangeMall.hap" # 使用原始链接
# 检查文件是否存在
if [ ! -f "$HAP_FILE" ]; then # 注意这里的空格
echo "$HAP_FILE does not exist. Downloading from $URL..."
# 下载文件
curl -L "$URL" --output "$HAP_FILE"
# 检查下载是否成功
if [ $? -eq 0 ]; then
echo "$HAP_FILE downloaded successfully."
else
echo "Failed to download $HAP_FILE."
fi
else
echo "$HAP_FILE already exists."
fi
# 获取目标设备的序列号(假定只连接 1 个设备)
OUTPUT=$(hdc.exe list targets)
TARGET=$(echo "$OUTPUT" | grep -oP '\b[0-9A-F]{16}\b')
echo "$TARGET"
if [ -z "$TARGET" ]; then
echo "Device not found. Exiting."
exit 1
fi
echo "Starting droidbot with device $TARGET"
python3 -m droidbot.start -a `pwd`/$HAP_FILE -t $TARGET -o output -count 1000 -is_harmonyos