@@ -28,6 +28,7 @@ show_help() {
28
28
echo " --run-go-tests Run go tests"
29
29
echo " --run-go-tests-only Run go tests and exit"
30
30
echo " --skip-ui-build Skip frontend/UI build"
31
+ echo " -i, --install Build for release and install the app"
31
32
echo " --help Display this help message"
32
33
echo
33
34
echo " Example:"
@@ -43,6 +44,7 @@ RESET_USB_HID_DEVICE=false
43
44
LOG_TRACE_SCOPES=" ${LOG_TRACE_SCOPES:- jetkvm,cloud,websocket,native,jsonrpc} "
44
45
RUN_GO_TESTS=false
45
46
RUN_GO_TESTS_ONLY=false
47
+ INSTALL_APP=false
46
48
47
49
# Parse command line arguments
48
50
while [[ $# -gt 0 ]]; do
@@ -72,6 +74,10 @@ while [[ $# -gt 0 ]]; do
72
74
RUN_GO_TESTS=true
73
75
shift
74
76
;;
77
+ -i|--install)
78
+ INSTALL_APP=true
79
+ shift
80
+ ;;
75
81
--help)
76
82
show_help
77
83
exit 0
@@ -139,25 +145,36 @@ EOF
139
145
fi
140
146
fi
141
147
142
- msg_info " ▶ Building go binary"
143
- make build_dev
144
-
145
- # Kill any existing instances of the application
146
- ssh " ${REMOTE_USER} @${REMOTE_HOST} " " killall jetkvm_app_debug || true"
147
-
148
- # Copy the binary to the remote host
149
- ssh " ${REMOTE_USER} @${REMOTE_HOST} " " cat > ${REMOTE_PATH} /jetkvm_app_debug" < bin/jetkvm_app
150
-
151
- if [ " $RESET_USB_HID_DEVICE " = true ]; then
152
- msg_info " ▶ Resetting USB HID device"
153
- msg_warn " The option has been deprecated and will be removed in a future version, as JetKVM will now reset USB gadget configuration when needed"
154
- # Remove the old USB gadget configuration
155
- ssh " ${REMOTE_USER} @${REMOTE_HOST} " " rm -rf /sys/kernel/config/usb_gadget/jetkvm/configs/c.1/hid.usb*"
156
- ssh " ${REMOTE_USER} @${REMOTE_HOST} " " ls /sys/class/udc > /sys/kernel/config/usb_gadget/jetkvm/UDC"
157
- fi
158
-
159
- # Deploy and run the application on the remote host
160
- ssh " ${REMOTE_USER} @${REMOTE_HOST} " ash << EOF
148
+ if [ " $INSTALL_APP " = true ]
149
+ then
150
+ msg_info " ▶ Building release binary"
151
+ make build_release
152
+
153
+ # Copy the binary to the remote host as if we were the OTA updater.
154
+ ssh " ${REMOTE_USER} @${REMOTE_HOST} " " cat > /userdata/jetkvm/jetkvm_app.update" < bin/jetkvm_app
155
+
156
+ # Reboot the device, the new app will be deployed by the startup process.
157
+ ssh " ${REMOTE_USER} @${REMOTE_HOST} " " reboot"
158
+ else
159
+ msg_info " ▶ Building development binary"
160
+ make build_dev
161
+
162
+ # Kill any existing instances of the application
163
+ ssh " ${REMOTE_USER} @${REMOTE_HOST} " " killall jetkvm_app_debug || true"
164
+
165
+ # Copy the binary to the remote host
166
+ ssh " ${REMOTE_USER} @${REMOTE_HOST} " " cat > ${REMOTE_PATH} /jetkvm_app_debug" < bin/jetkvm_app
167
+
168
+ if [ " $RESET_USB_HID_DEVICE " = true ]; then
169
+ msg_info " ▶ Resetting USB HID device"
170
+ msg_warn " The option has been deprecated and will be removed in a future version, as JetKVM will now reset USB gadget configuration when needed"
171
+ # Remove the old USB gadget configuration
172
+ ssh " ${REMOTE_USER} @${REMOTE_HOST} " " rm -rf /sys/kernel/config/usb_gadget/jetkvm/configs/c.1/hid.usb*"
173
+ ssh " ${REMOTE_USER} @${REMOTE_HOST} " " ls /sys/class/udc > /sys/kernel/config/usb_gadget/jetkvm/UDC"
174
+ fi
175
+
176
+ # Deploy and run the application on the remote host
177
+ ssh " ${REMOTE_USER} @${REMOTE_HOST} " ash << EOF
161
178
set -e
162
179
163
180
# Set the library path to include the directory where librockit.so is located
@@ -176,5 +193,6 @@ chmod +x jetkvm_app_debug
176
193
# Run the application in the background
177
194
PION_LOG_TRACE=${LOG_TRACE_SCOPES} ./jetkvm_app_debug | tee -a /tmp/jetkvm_app_debug.log
178
195
EOF
196
+ fi
179
197
180
- echo " Deployment complete."
198
+ echo " Deployment complete."
0 commit comments