Skip to content

Instantly share code, notes, and snippets.

@samirfor
Last active May 7, 2018 21:14
Show Gist options
  • Save samirfor/04f45dfd1cb4b6994baa9bcffd474ad5 to your computer and use it in GitHub Desktop.
Save samirfor/04f45dfd1cb4b6994baa9bcffd474ad5 to your computer and use it in GitHub Desktop.
Instalação Java + Palemoon para acesso ao HOD do Serpro no xUbuntu 16.04
#!/bin/bash
###########################################################
# Instalação Java + Palemoon para acesso ao HOD do Serpro #
# no xUbuntu 16.04 #
###########################################################
set -e # para a execução caso haja erro
set -x # debug, mostra os comandos
# CONFIGs
USUARIO="ifce" # usuário do sistema para adicionar as URLs exceções do Java (mesmo do login do ubuntu)
JAVA_URL="" # preencha com a URL do jdk-8u121-linux-i586.tar.gz no seu servidor cloud ou NAS interno
# caso nao tenha este arquivo, baixar dos arquivos da Oracle:
# http://download.oracle.com/otn/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz
# Voce precisa se registrar, pois é uma versão antiga. Mas é gratuito.
cd /tmp
# remove java's traces
echo "Removendo outras versões do Java..."
sudo apt purge -y openjdk*
sudo apt purge -y oracle*
sudo mkdir -p /usr/lib/jvm
sudo rm -rf /usr/lib/jvm/*
#############
# JDK #
#############
wget -c --no-check-certificate -O jdk.tar.gz "${JAVA_URL}"
tar xzf "jdk.tar.gz"
sudo mv jdk* /usr/lib/jvm/
JDK_NAME_EXTRACTED="jdk1.8.0_121"
JDK_DIR="/usr/lib/jvm/jdk1.8.0_121"
sudo update-alternatives --install /usr/bin/java java $JDK_DIR/jre/bin/java 1
sudo ln -sf $JDK_DIR/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins/
## palemoon
wget -q http://download.opensuse.org/repositories/home:stevenpusser/xUbuntu_$(lsb_release -rs)/Release.key -O- | sudo apt-key add -
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/stevenpusser/xUbuntu_$(lsb_release -rs)/ /' > /etc/apt/sources.list.d/palemoon.list"
sudo apt update
sudo apt -f install
sudo apt install -y palemoon:i386 libxrender1:i386 libxtst6:i386 libxi6:i386
echo "add URLs como exceção do Java..."
mkdir -p /home/$USUARIO/.java/deployment/security/
echo "http://acesso.serpro.gov.br" >/home/$USUARIO/.java/deployment/security/exception.sites
echo "https://acesso.serpro.gov.br" >>/home/$USUARIO/.java/deployment/security/exception.sites
echo "https://javatester.org" >>/home/$USUARIO/.java/deployment/security/exception.sites
echo "Pronto! Se quiser, ja pode rodar: palemoon 'http://acesso.serpro.gov.br/HOD10'"
echo "Lembre-se de ativar os pop-ups e permitir que o palemoon execute plugins inseguros."
echo "Caso a versão seja diferente de 1.8.0_121, usar o comando abaixo para setar:"
echo "sudo update-alternatives --config java"
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment