-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·66 lines (54 loc) · 2.04 KB
/
start.sh
File metadata and controls
executable file
·66 lines (54 loc) · 2.04 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
set -e
# ============================================
# OpenGUI Client — build and install script
# ============================================
cd "$(dirname "$0")"
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
info() { echo -e "${GREEN}[✓]${NC} $1"; }
warn() { echo -e "${YELLOW}[!]${NC} $1"; }
error() { echo -e "${RED}[✗]${NC} $1"; exit 1; }
# --------------------------------------------------
# 1. Check prerequisites
# --------------------------------------------------
command -v adb >/dev/null 2>&1 || error "adb is required. Please install Android SDK Platform Tools."
command -v java >/dev/null 2>&1 || error "Java 17+ is required. Please install it first."
# Check device connection
DEVICE_COUNT=$(adb devices | grep -c "device$" || true)
if [ "$DEVICE_COUNT" -eq 0 ]; then
error "No Android device detected. Connect a phone over USB and enable USB debugging."
fi
info "Detected ${DEVICE_COUNT} device(s)"
# --------------------------------------------------
# 2. adb port forwarding
# --------------------------------------------------
adb reverse tcp:7777 tcp:7777 >/dev/null 2>&1
info "Port forwarding configured (tcp:7777)"
# --------------------------------------------------
# 3. Build APK
# --------------------------------------------------
warn "Building APK ..."
./gradlew assembleDebug -q
APK_PATH="app/build/outputs/apk/debug/app-debug.apk"
if [ ! -f "$APK_PATH" ]; then
error "APK build failed. $APK_PATH was not found."
fi
info "APK build completed"
# --------------------------------------------------
# 4. Install on device
# --------------------------------------------------
warn "Installing on device ..."
adb install -r "$APK_PATH"
info "Install completed"
# --------------------------------------------------
# 5. Launch app
# --------------------------------------------------
PACKAGE="com.coremate.opengui"
adb shell am start -n "$PACKAGE/.login.SplashActivity" >/dev/null 2>&1
info "App launched"
echo ""
echo " Make sure the server is running: cd ../server && ./start.sh"
echo ""