From 0478c76ceb0deaf17bd6c18da62175b6f5cf7029 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 28 Sep 2021 22:41:04 +0200 Subject: Add the nxt-update-firmware helper script This allows easy flashing from a binary installed with a distribution package. --- contrib/README | 3 +++ contrib/nxt-update-firmware | 21 +++++++++++++++++++++ contrib/nxt-update-firmware.1 | 31 +++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 contrib/README create mode 100755 contrib/nxt-update-firmware create mode 100644 contrib/nxt-update-firmware.1 diff --git a/contrib/README b/contrib/README new file mode 100644 index 0000000..ed7b629 --- /dev/null +++ b/contrib/README @@ -0,0 +1,3 @@ +The nxt-update-firmware script can be used in distribution packages to ease +the flashing of a firmware binary installed on the system. You may have to +customize it to match the installation path and the fwflash package name. diff --git a/contrib/nxt-update-firmware b/contrib/nxt-update-firmware new file mode 100755 index 0000000..60f4340 --- /dev/null +++ b/contrib/nxt-update-firmware @@ -0,0 +1,21 @@ +#!/bin/sh + +pathfind() { + OLDIFS="$IFS" + IFS=: + for p in $PATH; do + if [ -x "$p/$*" ]; then + IFS="$OLDIFS" + return 0 + fi + done + IFS="$OLDIFS" + return 1 +} + +if ! pathfind fwflash; then + echo You need to install the libnxt package to flash firmware to NXT bricks. >&2 + exit 1 +fi + +fwflash /usr/share/nxt-firmware/nxt_firmware.bin diff --git a/contrib/nxt-update-firmware.1 b/contrib/nxt-update-firmware.1 new file mode 100644 index 0000000..3fd0fd3 --- /dev/null +++ b/contrib/nxt-update-firmware.1 @@ -0,0 +1,31 @@ +.Dd October 19, 2016 +.Dt NXT-UPDATE-FIRMWARE 1 +.Os Debian +.Sh NAME +.Nm nxt\-update\-firmware +.Nd wrapper script to flash NXT firmware +.Sh SYNOPSIS +.Nm +.Sh DESCRIPTION +.Nm +is a wrapper script that uses the +.Nm fwflash +utility from the libnxt package to flash the improved LEGO NXT firmware +to an NXT brick. +.Pp +The script calls +.Nm fwflash +with the default path to the firmware in Debian and returns its error +code. +.Sh FILES +.Bl -tag -width Ds -compact +.It Pa /usr/share/nxt\-firmware/nxt_firmware.bin +Path to the NXT firmware file. +.El +.Sh SEE ALSO +.Xr fwflash 1 +.Sh AUTHORS +Written for the Debian project by +.An Dominik George Aq Mt nik@naturalnet.de . +The code does not qualify for copyright protection; it is shipped with the nxt\-firmware package, see the copyright file under +.Pa /usr/share/doc/nxt\-firmware/copyright . -- cgit v1.2.3