2022-02-18 19:01:49 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/node-red-dark.sh)"
|
|
|
|
set -o errexit
|
|
|
|
RD=`echo "\033[01;31m"`
|
|
|
|
BL=`echo "\033[36m"`
|
|
|
|
CM='\xE2\x9C\x94\033'
|
|
|
|
GN=`echo "\033[1;92m"`
|
|
|
|
CL=`echo "\033[m"`
|
2022-02-18 21:11:09 +00:00
|
|
|
clear
|
2022-02-18 20:40:36 +00:00
|
|
|
echo -e "${RD}Backup your Node-Red flows before running this script!!${CL} \n "
|
2022-02-18 19:59:12 +00:00
|
|
|
while true; do
|
2022-02-18 20:41:41 +00:00
|
|
|
read -p "This will Install midnight-red theme. Proceed(y/n)?" yn
|
2022-02-18 19:59:12 +00:00
|
|
|
case $yn in
|
|
|
|
[Yy]* ) break;;
|
|
|
|
[Nn]* ) exit;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
clear
|
2022-02-18 19:01:49 +00:00
|
|
|
echo -en "${GN} Updating Container OS... "
|
|
|
|
apt-get update &>/dev/null
|
|
|
|
apt-get -qqy upgrade &>/dev/null
|
|
|
|
echo -e "${CM}${CL} \r"
|
|
|
|
|
|
|
|
echo -en "${GN} Installing midnight-red Theme... "
|
|
|
|
cd /root/.node-red
|
|
|
|
npm install @node-red-contrib-themes/midnight-red &>/dev/null
|
|
|
|
echo -e "${CM}${CL} \r"
|
|
|
|
|
|
|
|
echo -en "${GN} Writing Settings... "
|
2022-02-18 21:11:09 +00:00
|
|
|
cat <<EOF > /root/.node-red/settings.js
|
|
|
|
module.exports = { uiPort: process.env.PORT || 1880,
|
|
|
|
|
|
|
|
mqttReconnectTime: 15000,
|
|
|
|
|
|
|
|
serialReconnectTime: 15000,
|
|
|
|
|
|
|
|
debugMaxLength: 1000,
|
|
|
|
|
|
|
|
functionGlobalContext: {
|
|
|
|
},
|
|
|
|
exportGlobalContextKeys: false,
|
|
|
|
|
|
|
|
|
|
|
|
// Configure the logging output
|
|
|
|
logging: {
|
|
|
|
console: {
|
|
|
|
level: "info",
|
|
|
|
metrics: false,
|
|
|
|
audit: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-18 20:16:40 +00:00
|
|
|
// Customising the editor
|
|
|
|
editorTheme: {
|
|
|
|
theme: "midnight-red"
|
2022-02-18 19:59:12 +00:00
|
|
|
},
|
2022-02-18 20:16:40 +00:00
|
|
|
projects: {
|
|
|
|
// To enable the Projects feature, set this value to true
|
|
|
|
enabled: true
|
|
|
|
}
|
2022-02-18 19:01:49 +00:00
|
|
|
}
|
|
|
|
EOF
|
|
|
|
echo -e "${CM}${CL} \r"
|
|
|
|
|
|
|
|
echo -en "${GN} Restarting Node-Red... "
|
|
|
|
echo -e "${CM}${CL} \r"
|
2022-02-18 19:06:34 +00:00
|
|
|
node-red-restart
|
2022-02-18 19:01:49 +00:00
|
|
|
echo -en "${GN} Finished... ${CL} \n"
|
|
|
|
exit
|
|
|
|
|
|
|
|
|