#!/bin/bash

if [[ -x /usr/bin/apt ]]; then

  curl https://ftp.muzlab.ru/init/bizon/bz_sensors_agent-v2.14.1-x64-bz_soc.deb -o /tmp/bz_sensors_agent-v2.14.1-x64-bz_soc.deb;
  export BZ_AUTHORITY_SERVICE="10.15.0.59:9992"
  export BZ_SENSORS_SERVICE="10.15.0.59:9991"
  export BZ_POLLING_PERIOD="10s"
  export BZ_DIAL_TIMEOUT="10s"
  export BZ_LOG_LEVEL="debug"
  dpkg -i /tmp/bz_sensors_agent-v2.14.1-x64-bz_soc.deb

else

  curl https://ftp.muzlab.ru/init/bizon/bz_sensors_agent-v2.14.1-x64-bz_soc.rpm -o /tmp/bz_sensors_agent-v2.14.1-x64-bz_soc.rpm;
  export BZ_AUTHORITY_SERVICE="10.15.0.59:9992"
  export BZ_SENSORS_SERVICE="10.15.0.59:9991"
  export BZ_POLLING_PERIOD="10s"
  export BZ_DIAL_TIMEOUT="10s" 
  export BZ_LOG_LEVEL="debug"
  rpm -i /tmp/bz_sensors_agent-v2.14.1-x64-bz_soc.rpm

  curl https://ftp.muzlab.ru/toa/toa.modules -o /etc/sysconfig/modules/toa.modules;
  chmod +x /etc/sysconfig/modules/toa.modules;
  curl https://ftp.muzlab.ru/toa/toa.ko -o /root/toa.ko;
  /sbin/insmod /root/toa.ko
fi
