-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
113 lines (99 loc) · 2.49 KB
/
Copy pathdeploy.sh
File metadata and controls
113 lines (99 loc) · 2.49 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) 2026 Philipp Geisseler / PitNode project
# https://github.com/pitnode/pitnode
# https://www.pitnode.de
set -e
PORT=${1:-auto}
MPREMOTE="mpremote connect $PORT"
echo "=== Deploy PitNode ==="
echo "Using port: $PORT"
echo
# ---------- helper ----------
mp_mkdir() {
$MPREMOTE exec "
import os
path='$1'
parts = path.split('/')
cur = ''
for p in parts:
if not p:
continue
cur = cur + '/' + p if cur else p
try:
os.mkdir(cur)
except OSError:
pass
"
}
# ---------- root files ----------
echo "--- Copy root files ---"
$MPREMOTE cp main.py :
$MPREMOTE cp touch_setup.py :
$MPREMOTE cp config.txt :
$MPREMOTE cp pitnode.bin :
# ---------- pitnode ----------
echo "--- Create pitnode directories ---"
find pitnode \
\( \
-name "__pycache__" -o \
-name "tests" -o \
-name "node_modules" -o \
-name "scss" \
\) -prune \
-o -type d -print | while read d; do
mp_mkdir "$d"
done
echo "--- Copy pitnode files (.py and .txt, excluding tests) ---"
find pitnode \
\( \
-name "__pycache__" -o \
-name "tests" -o \
-name "node_modules" -o \
-name "scss" \
\) -prune \
-o -type f \
\( -name "*.py" -o -name "*.txt" \) \
-print | while read f; do
$MPREMOTE cp "$f" ":$f"
done
# ---------- web assets ----------
find pitnode/web -type d | while read d; do
case "$d" in
*/node_modules/*|*/node_modules|\
*/scss/*|*/scss|\
*/__pycache__/*|*/__pycache__)
continue
;;
esac
echo "MKDIR: $d"
mp_mkdir "$d"
done
echo "--- Copy web assets ---"
find pitnode/web \
\( -name "__pycache__" -o -name "node_modules" -o -name "scss" \) -prune \
-o -type f \
! -name "package.json" \
! -name "package-lock.json" \
\( \
-name "*.html" -o \
-name "*.css" -o \
-name "*.js" -o \
-name "*.json" -o \
-name "*.png" -o \
-name "*.ttf" -o \
-name "*.ico" \
\) -print | while read f; do
$MPREMOTE cp "$f" ":$f"
done
# ---------- GUI / drivers ----------
echo "--- Create GUI directories ---"
find gui drivers -type d -name "__pycache__" -prune -o -type d -print | while read d; do
mp_mkdir "$d"
done
echo "--- Copy GUI files ---"
find gui drivers -type d -name "__pycache__" -prune -o -type f -name "*.py" -print | while read f; do
$MPREMOTE cp "$f" ":$f"
done
echo
echo "=== Deploy finished ==="