1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-12-24 02:46:48 +02:00

bin/fk: add option -u to force usbboot, even if SSH is/seems available

This commit is contained in:
Werner Almesberger 2013-04-27 20:00:56 -03:00
parent 8eee093a34
commit 040911f8b9

20
bin/fk
View File

@ -1,13 +1,17 @@
#!/bin/sh -e
if [ "${1#usb}" = "$1" ]; then
if ! ping -c 1 -w 1 "$1" >/dev/null; then
echo "no ping response from $1" 1>&2
exit 1
fi
NN=$1
if [ "$1" = -u ]; then
NN=
else
NN=`ifconfig ${1:-usb0} |
sed '/.*inet addr:\([^ ]*\).*/{s//\1/;s/100$/101/;s/200$/202/;p;};d'`
if [ "${1#usb}" = "$1" ]; then
if ! ping -c 1 -w 1 "$1" >/dev/null; then
echo "no ping response from $1" 1>&2
exit 1
fi
NN=$1
else
NN=`ifconfig ${1:-usb0} |
sed '/.*inet addr:\([^ ]*\).*/{s//\1/;s/100$/101/;s/200$/202/;p;};d'`
fi
fi
if [ "$NN" ]; then
echo "SCP to $NN" 1>&2