@@ -28,6 +28,7 @@ show_help() {
2828 echo " --run-go-tests Run go tests"
2929 echo " --run-go-tests-only Run go tests and exit"
3030 echo " --skip-ui-build Skip frontend/UI build"
31+ echo " -i, --install Build for release and install the app"
3132 echo " --help Display this help message"
3233 echo
3334 echo " Example:"
@@ -43,6 +44,7 @@ RESET_USB_HID_DEVICE=false
4344LOG_TRACE_SCOPES=" ${LOG_TRACE_SCOPES:- jetkvm,cloud,websocket,native,jsonrpc} "
4445RUN_GO_TESTS=false
4546RUN_GO_TESTS_ONLY=false
47+ INSTALL_APP=false
4648
4749# Parse command line arguments
4850while [[ $# -gt 0 ]]; do
@@ -72,6 +74,10 @@ while [[ $# -gt 0 ]]; do
7274 RUN_GO_TESTS=true
7375 shift
7476 ;;
77+ -i|--install)
78+ INSTALL_APP=true
79+ shift
80+ ;;
7581 --help)
7682 show_help
7783 exit 0
@@ -139,25 +145,36 @@ EOF
139145 fi
140146fi
141147
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
161178set -e
162179
163180# Set the library path to include the directory where librockit.so is located
@@ -176,5 +193,6 @@ chmod +x jetkvm_app_debug
176193# Run the application in the background
177194PION_LOG_TRACE=${LOG_TRACE_SCOPES} ./jetkvm_app_debug | tee -a /tmp/jetkvm_app_debug.log
178195EOF
196+ fi
179197
180- echo " Deployment complete."
198+ echo " Deployment complete."
0 commit comments