#!/bin/bash

source /opt/scripts_local/shared_functions.sh

if ! _isInstalled glances
then
  shopt -s nocasematch
  set -eo pipefail
  export DEBIAN_FRONTEND=noninteractive
  sudo apt-get install -y python3-pip python3-docker gcc lm-sensors wireless-tools
  shopt -u nocasematch
  sudo pip install --break-system-packages setuptools glances[action,batinfo,browser,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]
  sudo pip install --break-system-packages glances
  APP_SERVICE=/etc/systemd/system/glances.service
  download_template "/mnt/unionfs/shared$APP_SERVICE" "$APP_SERVICE"
  search_and_replace "MY_HOSTNAME" "$HOSTNAME" "$APP_SERVICE"
  sudo systemctl daemon-reload
  sudo systemctl enable glances
  sudo systemctl start glances
fi