-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·41 lines (34 loc) · 1.25 KB
/
deploy.sh
File metadata and controls
executable file
·41 lines (34 loc) · 1.25 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
#!/bin/bash
# BubuOS Deploy — push code changes to device and restart
# Usage: ./deploy.sh [restart]
# ./deploy.sh — sync files only
# ./deploy.sh restart — sync + restart BubuOS service
HOST="xgpicase2x@192.168.0.29"
PASS="pocket1"
SSH="sshpass -p $PASS ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -q"
SCP="sshpass -p $PASS scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -q"
RSYNC="sshpass -p $PASS rsync -avz --delete -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'"
LOCAL_DIR="$(cd "$(dirname "$0")" && pwd)"
REMOTE_DIR="/home/xgpicase2x/bubuos"
echo "==> Syncing $LOCAL_DIR → $HOST:$REMOTE_DIR"
eval $RSYNC \
--exclude '__pycache__' \
--exclude '.git' \
--exclude 'test_data' \
--exclude 'screenshots' \
--exclude '.DS_Store' \
--exclude '*.pyc' \
"$LOCAL_DIR/" "$HOST:$REMOTE_DIR/"
if [ $? -eq 0 ]; then
echo "==> Sync complete"
else
echo "==> Sync FAILED"
exit 1
fi
# Clear Python cache on device
$SSH $HOST 'find ~/bubuos -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null'
if [ "$1" = "restart" ]; then
echo "==> Rebooting device..."
$SSH $HOST 'sudo reboot' 2>/dev/null
echo "==> Reboot sent. Device will be back in ~30s."
fi