echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- ssh'
#sudo nano /etc/ssh/sshd_config
sudo sed -i 's/PermitRootLogin yes/PermitRootLogin no/i' /etc/ssh/sshd_config
sudo sed -i 's/#LogLevel INFO/LogLevel VERBOSE/i' /etc/ssh/sshd_config
sudo sed -i '$a GatewayPorts yes' /etc/ssh/sshd_config
sudo sed -i '$a AllowTcpForwarding yes' /etc/ssh/sshd_config
sudo sed -i '$a ClientAliveInterval 600' /etc/ssh/sshd_config
sudo sed -i '$a ClientAliveCountMax 1000' /etc/ssh/sshd_config
sudo sed -i '$a ServerAliveInterval 100' /etc/ssh/ssh_config
sudo sed -i '$a ServerAliveCountMax 1000' /etc/ssh/ssh_config
sudo sed -i '$a MaxAuthTries 20' /etc/ssh/sshd_config

sudo service ssh restart

echo ''
echo ''
echo ''
echo ''
echo '#------------------------------------------------------- update'
sudo apt-get update -y
#sudo apt-get upgrade -y
#sudo apt autoremove -y
#sudo apt-get update -y
echo '#------------------------------------------------------- net-tools'
sudo apt install net-tools -y
echo '#------------------------------------------------------- unzip'
sudo apt install unzip -y




echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- VNC'
mkdir /home/ubuntu/.Xresources
mkdir /home/ubuntu/.vnc
echo '#!/bin/bash' > /home/ubuntu/.vnc/xstartup
echo 'xrdb $HOME/.Xresources' >> /home/ubuntu/.vnc/xstartup
echo 'startxfce4 &' >> /home/ubuntu/.vnc/xstartup
sudo chmod +x /home/ubuntu/.vnc/xstartup
#cp /home/ubuntu/o/Infra/passwd.vnc /home/ubuntu/.vnc/passwd
echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- xfce4'
sudo apt-get install xfce4 -y 
sudo apt-get install xfce4-terminal -y
#sudo apt-get install xdg-utils -y 
echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- tightvncserver'
sudo apt-get install tightvncserver -y
sudo chown -R ubuntu:ubuntu /home/ubuntu
echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- VNC Service'
#sudo cp /home/ubuntu/o/Infra/etc-systemd-system-vncserver@.service /etc/systemd/system/vncserver@.service
#wget contahub.com/downloads/extras/desktop-ubuntu/etc-systemd-system-vncserverAT.service
#sudo mv etc-systemd-system-vncserverAT.service /etc/systemd/system/vncserver@.service
#sudo systemctl daemon-reload
#sudo systemctl enable vncserver@1.service


echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- Firefox'
sudo apt-get install firefox -y
echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- Chrome'
sudo apt-get install chromium-browser -y
#sudo apt install google-chrome-stable -y

#sudo chown -R ubuntu:ubuntu /home/ubuntu

#
#tar -zcvf ponto-cache.gz .cache
#tar -zcvf ponto-config.gz .config
#tar -zcvf ponto-local.gz .local
echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- ponto-'
mkdir /home/ubuntu/x
cd x
wget contahub.com/downloads/extras/desktop-ubuntu/ponto-cache.gz
tar -xf ponto-cache.gz
wget contahub.com/downloads/extras/desktop-ubuntu/ponto-config.gz
tar -xf ponto-config.gz
#rm -R /home/ubuntu/.cache/chromium/
#rm -R /home/ubuntu/.config/chromium/
#mv /home/ubuntu/x/.cache/chromium /home/ubuntu/.cache/
#mv /home/ubuntu/x/.config/chromium /home/ubuntu/.config/
#wget contahub.com/downloads/extras/desktop-ubuntu/ponto-local.gz
#tar -xf ponto-local.gz





echo '#---------------------------------------------------- OPCIONAL'

echo ''
echo ''
echo ''
echo '#---------------------------------------------------- ChromeDriver'
wget https://chromedriver.storage.googleapis.com/81.0.4044.69/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
mkdir /home/ubuntu/lib
mv chromedriver /home/ubuntu/lib
rm chromedriver_linux64.zip
wget http://selenium-release.storage.googleapis.com/4.0-alpha5/selenium-server-4.0.0-alpha-5.jar
cp selenium-server-4.0.0-alpha-5.jar /home/ubuntu/lib


echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- Java, Maven'
sudo apt-get install openjdk-8-jdk -y
sudo apt install maven -y



echo ''
echo ''
echo ''
echo ''
echo '#----------------------------------------------------  Owncloud client'
sudo apt install owncloud-client-cmd -y
owncloudcmd --version
mkdir /home/ubuntu/o
mkdir /home/ubuntu/o/Infra
mkdir /home/ubuntu/o/sh
mkdir /home/ubuntu/o/Desenv2
mkdir /home/ubuntu/o/Desenv2/local
ln -s /home/ubuntu/o/Desenv2/local/ /home/ubuntu/local
mkdir /home/ubuntu/o/Desenv2/contahub
mkdir /home/ubuntu/o/Desenv2/softlenz
mkdir /home/ubuntu/o/Desenv2/nfe
mkdir /home/ubuntu/o/Desenv2/cfe
mkdir /home/ubuntu/o/log
mkdir /home/ubuntu/o/log/zapzap
mkdir /home/ubuntu/o/dump
mkdir /home/ubuntu/o/dump/zapzap
sudo chown -R ubuntu:ubuntu /home/ubuntu
export OWNCLOUD_CHUNKING_NG=0
sudo export OWNCLOUD_CHUNKING_NG=0
wget contahub.com/downloads/extras/desktop-ubuntu/owncloud-exclude-list.txt
sudo chown -R ubuntu:ubuntu /home/ubuntu

echo ''
echo ''
echo ''
echo ''
echo '#----------------------------------------------------  Owncloud sync sh'
owncloudcmd -u contahub -p xyz12345 --exclude /home/ubuntu/owncloud-exclude-list.txt /home/ubuntu/o/sh http://owncloud-sw.contahub.com/remote.php/webdav/sh
#owncloudcmd -u contahub -p xyz12345 --exclude /home/ubuntu/owncloud-exclude-list.txt /home/ubuntu/o/Infra http://owncloud-sw.contahub.com/remote.php/webdav/Infra

ln -s /home/ubuntu/o/sh/sync-zapzap.sh /home/ubuntu/sync.sh

echo ''
echo ''
echo ''
echo ''
echo '#----------------------------------------------------  UFW'
sudo ufw allow ssh
#sudo ufw deny 5901
sudo ufw deny all
sudo ufw enable
sudo ufw status


echo ''
echo ''
echo ''
echo ''
echo '#---------------------------------------------------- END'