#!/bin/bash # Run as root only. myWHOAMI=$(whoami) if [ "$myWHOAMI" != "root" ] then echo "Need to run as root ..." exit fi myTPOTYMLFILE="/opt/tpot/etc/tpot.yml" function fuGENERIC () { echo echo "You chose generic, please provide all the details of the broker" echo myENABLE="true" read -p "Host URL: " myHOST read -p "Port: " myPORT read -p "Channel: " myCHANNEL echo "For generic providers set this to 'false'" echo "If you received a CA certficate mount it into the ewsposter container by modifying $myTPOTYMLFILE" read -p "TLS - 'false' or path to CA in container: " myCERT read -p "Ident: " myIDENT read -p "Secret: " mySECRET read -p "Format ews (xml) or json: " myFORMAT } function fuOPTOUT () { echo while [ 1 != 2 ] do read -s -n 1 -p "You chose to opt out (y/n)? " mySELECT echo $mySELECT case "$mySELECT" in [y,Y]) echo "Opt out." break ;; [n,N]) echo "Aborted." exit ;; esac done myENABLE="false" myHOST="host" myPORT="port" myCHANNEL="channels" myCERT="false" myIDENT="user" mySECRET="secret" myFORMAT="json" } function fuWRITETOFILE () { if [ -f '/data/ews/conf/hpfeeds.cfg' ]; then echo "Creating backup of current config in /data/ews/conf/hpfeeds.cfg.old" mv /data/ews/conf/hpfeeds.cfg /data/ews/conf/hpfeeds.cfg.old fi echo "Storing new config in /data/ews/conf/hpfeeds.cfg" cat >> /data/ews/conf/hpfeeds.cfg <