#!/bin/bash # bash <(curl -s https://raw.githubusercontent.com/KnoAll/cacti-template/dev/bootstrap.sh) green=$(tput setaf 2) red=$(tput setaf 1) tan=$(tput setaf 3) reset=$(tput sgr0) printinfo() { if [ -z "$1" ]; then printf "${tan}::: ${green}%s${reset}\n" "$@" else printf "${tan}::: ${green}%s${reset}\n" "$(date +%a_%R): $@" fi } printwarn() { printf "${tan}*** WARNING: %s${reset}\n" "$(date +%a_%R): $@" } printerror() { printf "${red}!!! ERROR: %s${reset}\n" "$(date +%a_%R): $@" } case $(whoami) in root) printerror "You ran me as root! Do not run me as root!" exit 1 ;; pi) printerror "You ran me as pi user! Do not run me as pi!" exit 1 ;; cacti) printinfo ;; *) printerror "Uh-oh. You are not logged in as the cacti user. Exiting..." exit 1 ;; esac if [ -f ~/cacti-upgrade.sh ] then printinfo "" else printinfo "Downloading cacti-upgrade.sh..." wget -q https://raw.githubusercontent.com/KnoAll/cacti-template/master/cacti-upgrade.sh chmod +x cacti-upgrade.sh fi ./cacti-upgrade.sh