Skip to content

Instantly share code, notes, and snippets.

@richardsonlima
Last active March 31, 2016 18:11
Show Gist options
  • Save richardsonlima/e023980f6daf4adff190 to your computer and use it in GitHub Desktop.
Save richardsonlima/e023980f6daf4adff190 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Program information
name="Ocs_Agent_Install_Debian_Ubuntu.sh"
version="1.0.1"
releasedate="02 March 2015"
author="Richardson Lima, "
author_contact="[email protected]"
website="http://www.richardsonlima.com.br"
copyright="Copyright 2016 - ${author}, ${website}"
# Clone over GIT: git clone https://gist.github.com/e023980f6daf4adff190.git
#
#set -x
TIMESTAMP=$(date +"%m-%d-%Y-%T")
#OCSSERVER="10.0.0.2"
echo -e "\033[33;1;34m [*] \033[0m \033[33;1;32m Enter OCS Server Ip Address: \033[0m";
read OCSSERVER
echo
echo -e "\033[33;1;34m [*] \033[0m \033[33;1;32m Atualizando a lista de pacotes disponíveis ... \033[0m"; sleep 2;
echo
sudo apt-get update
echo
echo -e "\033[33;1;34m [*] \033[0m \033[33;1;32m Instalando o Ocs Agent \033[0m"; sleep 2;
echo
#sudo apt-get install ocsinventory-agent -y --force-yes
sudo apt-get install debconf-utils -y --force-yes
echo "ocsinventory-agent ocsinventory-agent/method select local" | sudo debconf-set-selections
sudo apt-get install -y --force-yes ocsinventory-agent
echo
echo -e "\033[33;1;34m [*] \033[0m \033[33;1;32m Efetuando backup dos arquivos de configuracao \033[0m"; sleep 2;
echo
sudo cp -Rfa /etc/ocsinventory/ocsinventory-agent.cfg{,.bkp-REL-$TIMESTAMP.$RANDOM}
echo
echo -e "\033[33;1;34m [*] \033[0m \033[33;1;32m Criando novo arquivo de configuracao \033[0m"; sleep 2;
echo
cat << EOF > ~/ocsinventory-agent.cfg
server=$OCSSERVER
EOF
echo
echo -e "\033[33;1;34m [*] \033[0m \033[33;1;32m Ativando novo arquivo de configuracao \033[0m"; sleep 2;
echo
sudo cp ~/ocsinventory-agent.cfg /etc/ocsinventory/
echo
echo -e "\033[33;1;34m [*] \033[0m \033[33;1;32m Ativando o Ocs Agent \033[0m"; sleep 2;
echo
sudo ocsinventory-agent -i --debug -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment