-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdev-push.sh
More file actions
executable file
·85 lines (77 loc) · 3.18 KB
/
dev-push.sh
File metadata and controls
executable file
·85 lines (77 loc) · 3.18 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
# ─────────────────────────────────────────────────────────────
# dev-push.sh — Fast QML hot-reload for WhaleOS development
# ─────────────────────────────────────────────────────────────
#
# Instead of rebuilding the ISO (~5 min), this script:
# 1. Copies changed QML files to the running VM via SSH
# 2. Restarts the WhaleOS compositor (takes ~2 seconds)
#
# Usage:
# ./scripts/dev-push.sh <VM_IP>
#
# First time setup:
# 1. Boot the ISO in UTM/VMware
# 2. Find VM's IP: run `ip addr` in the VM terminal
# 3. Run: ./scripts/dev-push.sh 192.168.x.x
#
# Credentials: ainux/ainux
# ─────────────────────────────────────────────────────────────
set -e
VM_IP="${1:-}"
VM_USER="ainux"
VM_PASS="ainux"
REMOTE_QML_DIR="/opt/ainux/whaleos"
LOCAL_QML_DIR="$(cd "$(dirname "$0")/.." && pwd)/packages/whaleos"
if [ -z "$VM_IP" ]; then
echo "Usage: $0 <VM_IP>"
echo ""
echo "Find the VM IP by running 'ip addr' in the VM terminal,"
echo "or check UTM's network settings."
echo ""
echo "Example: $0 192.168.64.3"
exit 1
fi
echo "🚀 Dev Push — Fast QML hot-reload"
echo " VM: ${VM_USER}@${VM_IP}"
echo " Local: ${LOCAL_QML_DIR}"
echo " Remote: ${REMOTE_QML_DIR}"
echo ""
# Check SSH connectivity
echo "1️⃣ Testing SSH connection..."
if ! sshpass -p "$VM_PASS" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 \
"${VM_USER}@${VM_IP}" "echo ok" 2>/dev/null; then
echo "❌ Cannot connect to ${VM_USER}@${VM_IP}"
echo ""
echo "Make sure:"
echo " • The VM is running"
echo " • SSH is accessible (port 22)"
echo " • If using UTM, enable port forwarding or bridged networking"
echo ""
echo "Tip: If sshpass is not installed, run: brew install hudochenkov/sshpass/sshpass"
exit 1
fi
echo " ✓ Connected"
# Copy QML files
echo "2️⃣ Pushing QML files..."
sshpass -p "$VM_PASS" scp -o StrictHostKeyChecking=no -r \
"${LOCAL_QML_DIR}/"*.qml "${LOCAL_QML_DIR}/"*.js \
"${VM_USER}@${VM_IP}:/tmp/whaleos-qml/" 2>/dev/null || {
# Create remote temp dir first
sshpass -p "$VM_PASS" ssh -o StrictHostKeyChecking=no \
"${VM_USER}@${VM_IP}" "mkdir -p /tmp/whaleos-qml"
sshpass -p "$VM_PASS" scp -o StrictHostKeyChecking=no \
"${LOCAL_QML_DIR}/"*.qml "${LOCAL_QML_DIR}/"*.js \
"${VM_USER}@${VM_IP}:/tmp/whaleos-qml/"
}
# Move files into place (needs sudo) and restart compositor
echo "3️⃣ Installing & restarting compositor..."
sshpass -p "$VM_PASS" ssh -o StrictHostKeyChecking=no \
"${VM_USER}@${VM_IP}" "
echo '$VM_PASS' | sudo -S cp /tmp/whaleos-qml/* ${REMOTE_QML_DIR}/ 2>/dev/null
echo '$VM_PASS' | sudo -S pkill -f 'openwhale.*whaleos' 2>/dev/null || true
echo ' ✓ Compositor restarted'
"
echo ""
echo "✅ Done! Changes are live — check the VM screen."
echo " (The compositor restarts automatically on tty1)"