#!/bin/bash
#script Júlio César Fais - 3.0 - 05 outubro 2010
#julio.tecnico@bol.com.br
#salve-o em um doc de texto e marque com executável
#########################################inicio da função deb (6)
function function_bkp () {
pasta=`zenity --directory --file-selection --title "Escolha a Pasta Para Salvar os Aquivos de Configuração"`
userr=$(zenity --entry --text="Digite Qual o Usuario Esta o Backup" --title="Ex.: kurumin, prefeitura" --width=300)
scp /etc/network/interfaces $pasta
scp /etc/cups/printers.conf $pasta
scp /home/$userr/.kde/share/config/kopeterc $pasta
scp -r /home/$userr/.mozilla $pasta
scp -r /home/$userr/.mozilla-thunderbird $pasta
scp -r /home/$userr/.thunderbird $pasta
scp -r /home/$userr/.firefox $pasta
scp -r /home/$userr/.mozilla-firefox $pasta
scp -r /home/$userr/.putty $pasta
scp -r /etc/rc.local $pasta
konqueror $pasta
clear
}
function function_deb () {
e=$(zenity --directory --file-selection --title "Escolha a pasta onde estao os arquivos .DEB")
cd $e/
dpkg -i *.deb
sleep 2
zenity --info --text="Os Arquivos Foram Extraidos."
exit 0
}
##################################inicio da função flash (5)
function function_flash () {
flash=`zenity --file-selection --title "Escolha o Flash Player (obs.: tem que estar Descompactado)"`
d=`zenity --directory --file-selection --title "Escolha a pasta plugins do navegador.Ex.: /usr/lib/firefox-3.6.7/plugins/"`
cp -i -r $flash $d
zenity --info --text="Reinicie o Navegador ...."
}
############################Inicio da função java (4)
function function_java () {
java=$(zenity --file-selection --title="Selecione o JAVA")
./$java
zenity --info --text "Vamos adicionar um link pro navegador."
c=`zenity --directory --file-selection --title "Escolha a pasta plugins do navegador.Ex.: /usr/lib/firefox-3.6.7/plugins/"`
d=`zenity --file-selection --title "Escolha o plugin do java (ja instalado)"`
cd $c/
ln -s $d
zenity --info --text="OK! Tudo Pronto! Vamos Testar ...."
firefox 'http://www.java.com/pt_BR/download/help/testvm.xml'
}
################################inicio da função rede (3)
function function_rede () {
#################
inicio (){
echo 1 - IP Fixo
echo 2 - DHCP
echo 3 - RESTAURAR BKP
echo 4 - IP TEMPORARIO
read var
case $var in
1) fixo;;
2) dhcp;;
3) bkp;;
4) temp;;
*) clear; echo 'saindo do programa'; exit;;
esac
}
##################
fixo (){
echo vc escolheu IP Fixo
`zenity --warning --text "ATENÇAO ESTA AÇAO IRA SOBRESCREVER O ARQUIVO ORIGINAL!!!" --title "AVISO DO JULIO!!!"`
sleep 1
clear
echo 'Adicione suas interfaces...
Ex.: eth0 eth0:0 eth0:1 eth0:2...
obs.: use a 1ª interface para internet...'
sleep 2
read int
echo "Qual Ip da 1ª interface?"
read ipa
echo "Qual a Mascara da 1ª inetrface?"
read masc
echo "Qual o Gateway da 1ª interface?"
read gw
sleep 1
echo "auto lo $int" > /etc/network/interfaces
echo "iface lo inet loopback" >> /etc/network/interfaces
echo "iface $int inet static" >> /etc/network/interfaces
echo "address $ipa" >> /etc/network/interfaces
echo "netmask $masc" >> /etc/network/interfaces
echo "gateway $gw" >> /etc/network/interfaces
echo "#configurado via script => JULIO 2.0<= julio.tecnico@bol.com.br" >> /etc/network/interfaces
clear
/etc/init.d/networking stop
/etc/init.d/networking start
echo "! Pronto. Sua Rede Foi Configurada com sucesso."
sleep 4
}
##################
dhcp (){
`zenity --warning --text "ATENÇAO ESTA AÇAO IRA SOBRESCREVER O ARQUIVO ORIGINAL!!!" --title "AVISO DO JULIO!!!"`
echo vc escolheu IP por DHCP
sleep 2
clear
echo 'Adicione sua interface...
Ex.: eth0, eth1, wlan0...'
sleep 1
read int
echo "auto lo $int" > /etc/network/interfaces
echo "iface lo inet loopback" >> /etc/network/interfaces
echo "iface $int inet dhcp" >> /etc/network/interfaces
echo "#configurado via script => JULIO <= julio.tecnico@bol.com.br" >> /etc/network/interfaces
echo "Configurando...Aguarde..."
sleep 2
clear
/etc/init.d/networking stop
/etc/init.d/networking start
echo "! Pronto. Sua Rede DHCP Foi Configurada com sucesso. Veja:"
sleep 4
cat /etc/network/interfaces
sleep 5
clear
}
###################
bkp (){
`zenity --warning --text "ATENÇAO ESTA AÇAO IRA SOBRESCREVER O ARQUIVO ORIGINAL!!!" --title "AVISO DO JULIO!!!"`
echo 'Qual o Arquivo?'
b=`zenity --file-selection --title "Escolha o arquivo(interfaces)"`
sleep 2
cp "$b" /etc/network/
clear
echo "Reiniciando a Rede..."
sleep 1
/etc/init.d/networking stop
/etc/init.d/networking start
clear
echo "OK!"
sleep 2
}
####################
temp (){
echo "Qual a interface?"
sleep 2
read dd
echo "Qual o ip?"
sleep 2
read aa
echo "Qual a Mascara?"
sleep 2
read bb
echo "Qual o Gateway?"
sleep 2
read cc
ifconfig $dd $aa netmask $bb up
route add default gw $cc
}
inicio
clear
}
###################################inicio da função permissão (2)
function function_permissao () {
sudo=$(zenity --entry --text="Digite Qual usuario voce quer Habilitar o sudo?" --title="Ex.: kurumin, prefeitura" --width=300)
echo "
$sudo ALL=(ALL) ALL
$sudo ALL=NOPASSWD: ALL
#configurado via script => JULIO 3.0<= julio.tecnico@bol.com.br
" >> /etc/sudoers
zenity --info --text "Concluido! O Usuario $sudo ja possui permissao de Administrador."
}
#####################################Início da função dns (1)
function function_dns () {
echo "
nameserver 208.67.222.222
nameserver 8.8.8.8
#configurado via script => JULIO 3.0<= julio.tecnico@bol.com.br
" > /etc/resolv.conf
clear
cat /etc/resolv.conf
sleep 3
zenity --info --text "DNS Configurado!."
clear
}
################################################## MENU ######################################################################
while true; do
acao="$(zenity --width=380 --height=400 --list --column " ATENÇÃO...EXECUTE-O COMO ROOT." --title=" SCRIPT JULIO 3.0" \
"=> Não esqueça a Permissão Gráfica (xhost +)" \
" " \
"1) ADICIONAR DNS PADRAO" \
"2) CONFIGURAR PERMISSÕES - /etc/sudoers" \
"3) CONFIGURAR REDE" \
"4) INSTALAR JAVA" \
"5) INSTALAR FLASH PLAYER" \
"6) EXTRAIR PACOTES" \
"7) BKP DE CONFIGURAÇÕES" \
"Sair")"
case $acao in
"1) ADICIONAR DNS PADRAO")
function_dns ;;
"2) CONFIGURAR PERMISSÕES - /etc/sudoers")
function_permissao ;;
"3) CONFIGURAR REDE")
function_rede ;;
"4) INSTALAR JAVA")
function_java ;;
"5) INSTALAR FLASH PLAYER")
function_flash ;;
"6) EXTRAIR PACOTES" )
function_deb ;;
"7) BKP DE CONFIGURAÇÕES" )
function_bkp ;;
*) exit ;;
esac
done
#fim do script Júlio 3.0 - julio.tecnico@bol.com.br
Nenhum comentário:
Postar um comentário