-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHMIBSC_UPDATE_ENTWARE.sh
134 lines (117 loc) · 5.42 KB
/
HMIBSC_UPDATE_ENTWARE.sh
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#! /bin/bash
### This script updates HMIBSC NodeJs/NodeRed using ENTWARE packages.
### It uninstalls the old NodeJS/NodeRed from the orginal image.
### Then it installs from ENTWARE update versions of the following:
### Nodejs, NodeRed, Pyton3, Tar
###
### Entware is a software repository for embedded devices
### which use the Linux kernel, primarily routers and network
### attached storages. It has long been the practice of
### manufacturers for these devices to "overpower" them relative
### to the functions they are designed to perform. (It's generally
### more profitable to provide the extra computational margin
### than bear the cost of increased support for those who more
### heavily tax them.) Installing Entware can allow users to
### take advantage of this extra computing power by adding
### software to the device which permits it to perform new tasks
### or provide other features besides those they were marketed
### for, or simply to perform those functions better.
###
### https://github.com/Entware/Entware/wiki
###
### Browse Entware repository of 2500+ packages
###
### https://bin.entware.net/armv7sf-k3.2/Packages.html
####Fisrt Login####
####login: root password:IIoTB#r8
####NodeRed Password:NodeRed#0123
###NodeRed URL:https://IP:1880/
###Nodered username:NR_account
####How To Enable root login over SSH
########1. vi /etc/ssh/sshd_config
########2. press insert key
########3. change PermitRootLogin no -> PermitRootLogin yes
########4. ESC ESC :wq
####GET IP ADDRESS
########5. ifconfig
########6. reboot
########Download a SSH Client use IP from step 5.####################
########https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
########https://mobaxterm.mobatek.net/
####################################################################
##### Everything Past this point can be copied and pasted to SSH#####
##### OR ######
##### Execute Use this script run the following ######
# curl -L https://raw.githubusercontent.com/jzhvymetal/HMIBSC_UPDATE/main/HMIBSC_UPDATE_ENTWARE.sh | sh -x
### Also possible to pass parameters to install nodes and opkg packages
### For NodeJS node use -n
### For SE Node use -s
### For opkg packages use -o
# curl -L https://raw.githubusercontent.com/jzhvymetal/HMIBSC_UPDATE/main/HMIBSC_UPDATE_ENTWARE.sh | sh -s -- -o nano -n node-red-contrib-modbus -s se-node-red-palette_manager -s se-node-red-modbus -s se-node-red-machine_advisor -s se-node-red-harmony_hub -s se-node-red-aveva_insight
####################################################################
###Install Entware Package Addon
wget http://bin.entware.net/aarch64-k3.10/installer/generic.sh
chmod +x generic.sh
./generic.sh
rm generic.sh
###Set /opt/sbin Path in current sh shell
[[ "$PATH" == */opt/sbin* ]] || export PATH=/opt/sbin:$PATH
##Add path to sh PATH
grep -qxF 'PATH=/opt/sbin:$PATH' /etc/profile || echo 'PATH=/opt/sbin:$PATH' >> /etc/profile
###Set /opt/bin Path in current sh shell
[[ "$PATH" == */opt/bin* ]] || export PATH=/opt/bin:$PATH
##Add path to sh PATH
grep -qxF 'PATH=/opt/bin:$PATH' /etc/profile || echo 'PATH=/opt/bin:$PATH' >> /etc/profile
###Backup old opkg so new entware opkg is used. Do only once if script is run again
test ! -f /usr/bin/opkg-old && mv /usr/bin/opkg /usr/bin/opkg-old
###Remove All Old NodeJs/NPM/NodeRed Installs
test ! -f /bin/tar.orginal && mv /bin/tar /bin/tar.orginal
opkg-old remove nodejs --force-removal-of-dependent-packages
opkg-old remove nodejs-dev --force-removal-of-dependent-packages
opkg-old remove nodejs-npm --force-removal-of-dependent-packages
opkg-old remove node-red --force-removal-of-dependent-packages
rm /usr/bin/node
rm /usr/bin/npm
rm /usr/bin/npx
rm /usr/bin/node-red
rm /usr/bin/node-red-pi
###Install Entware updated NodeJs/NPM/Python/Tar
###Add any additional 2500+ packages which can be found https://bin.entware.net/armv7sf-k3.2/Packages.html
opkg install node
opkg install node-npm
opkg install python3
opkg install tar
##stop nodered service
systemctl stop nodered
##install latest node-red
npm install --g --unsafe-perm -f --no-package-lock node-red
###install symbolic links so service does not need modification also fixes node-red palette as it has to see NPM as usr bin
###Service File /lib/systemd/system/nodered.service it can also be modified
ln -s /opt/bin/node /usr/bin/node
ln -s /opt/bin/npm /usr/bin/npm
ln -s /opt/bin/npx /usr/bin/npx
ln -s /opt/bin/node-red-pi /usr/bin/node-red-pi
ln -s /opt/bin/node-red /usr/bin/node-red
ln -s /opt/bin/tar /bin/tar
####Install additional Nodes....Uncomment any below or add some
#npm install -g --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-modbus
####Install additional CLI passed nodes and opkg packages
### For NodeJS node use -n
### For SE Node use -s
### For opkg packages use -o
while getopts "s:n:o:" opt
do
case "$opt" in
n ) echo "Installing NodeJS Node:" "$OPTARG"
npm install -g --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict "$OPTARG"
;;
s ) echo "Installing SE Node:" "$OPTARG"
npm install -g --strict-ssl false --registry https://ecostruxure-data-expert-essential.se.app:4873/ "$OPTARG"
;;
o ) echo "Installing OPKG package:" "$OPTARG"
opkg install "$OPTARG"
;;
esac
done
##start nodered service
systemctl start nodered