File: start.sh

package info (click to toggle)
open-plc-utils 0.0.6%2Bgit20250712.46c3506-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,208 kB
  • sloc: ansic: 60,860; xml: 16,179; sh: 1,216; makefile: 698
file content (62 lines) | stat: -rwxr-xr-x 1,815 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# file: scripts/start.sh

# use int6kf to start firmware on a device having a blank or corrupted
# NVRAM; this is a standard Intellon script that has proven useful but
# feel free to make changes;

# ====================================================================
# host symbols;
# --------------------------------------------------------------------

. /etc/environment
. ${SCRIPTS}/hardware.sh
. ${SCRIPTS}/firmware.sh

# ====================================================================
# query connection;
# --------------------------------------------------------------------

echo -n "Interface [${ETH}]: "; read  
if [ ! -z ${REPLY} ]; then
	ETH=${REPLY}
fi

# ====================================================================
# define random DAK and NMK;
# --------------------------------------------------------------------

MAC=auto
DAK=$(rkey secret.key -D)
NMK=$(rkey secret.key -M)

# ====================================================================
# update PIB file with MAC, DAK and NMK;
# --------------------------------------------------------------------

modpib -M ${MAC} -D ${DAK} -N ${NMK} ${PIB} -v
if [ ${?} != 0 ]; then
	exit 1
fi

# ====================================================================
# write CFG, FW and PIB to device and start FW execution;
# --------------------------------------------------------------------

int6kf -i ${ETH} -C ${CFG} -P ${PIB} -N ${NVM} 
if [ ${?} != 0 ]; then
	exit 1
fi

# ====================================================================
# confirm device identity;
# --------------------------------------------------------------------

int6k -i ${ETH} -I

# ====================================================================
# 
# --------------------------------------------------------------------

exit 0