summaryrefslogtreecommitdiff
path: root/contrib/nxt-update-firmware
blob: fd15313f5bec1b3ca85f53e1d59ba69d31713287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# Written by Dominik George <nik@naturalnet.de>, who stated the code does not
# qualify for copyright protection.

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