-
Notifications
You must be signed in to change notification settings - Fork 0
/
createWifiNodes
69 lines (62 loc) · 1.24 KB
/
createWifiNodes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# Name: createWifiNodes
#
# Version Date Comment
# ------- ---- -------
# 0.0.1 191030 Initial version fork from Intel cluploadEdison using sshfs
#
# Created on: 191030
# Author: Jacob
#
# Purpose:
# Create the /dev/cu.... nodes for the Intel Edison wifi nodes required by cluploadEdison.
#
# Usage:
# $ sudo createWifiNodes hostname1 hostname2 ... hostnameN
#
#
#
#
#========[ START SCRIPT ]========
#
# Set DEBUG to non zero for additional output
DEBUG=1
ME=`basename "$0"`
echo "$ME: starting script"
if [ $# -lt 1 ]
then
echo "$ME: no arguments!!"
echo "$ME: usage: $ME hostname [ hostname ] [ hostname ] "
exit 1
fi
#
# print parameters when in debug mode
if [ $DEBUG -ne 0 ] ; then echo "$ME: Args to shell: $*" ; fi
OS=`uname`
if [ $OS = "Darwin" ]
then
FILEPRE="/dev/cu"
else
FILEPRE="/dev/ttyACM0"
fi
for ARG in "$@"
do
FILE="$FILEPRE.wifi.$ARG"
if [ $DEBUG -ne 0 ] ; then echo "$ME: Special file name: $FILE" ; fi
if [ -e $FILE ]
then
echo "$ME: $FILE exists!!"
else
COMMAND="sudo mknod $FILE c 3 2"
if [ $DEBUG -ne 0 ] ; then echo "$ME: Command: $COMMAND" ; fi
if `$COMMAND`
then
echo "$ME: mknod /dev/cu.wifi.$ARG succeeded!"
else
echo "$ME: mknod /dev/cu.wifi.$ARG FAILED!!!"
exit 1
fi
fi
done
exit 0