Atualização do AVG
Publicado por Marcelo Donato de Lemos Rossato 01/08/2004
[ Hits: 8.246 ]
Script para baixar os updates do AVG
#!/bin/sh
###############################################################################
#
# Copyright (C) 2002,2003 Grando, Marcus
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
###############################################################################
#
# avg_update.sh - Script para baixar o Update do AVG
#
# Marcus Grando
# <marcus at sbh dot eng dot br>
#
# Versao 0.9.2 - 06/10/2003
#
# TODO: setar automaticamente as variaveis?
#
# CHANGELOG:
#
# 0.9.3: Erro ao fazer o download do arquivo que esta com o tamanho errado,
# estava baixando um arquivo *.1, foi alterada a opcao no wget para
# que funcione corretamente (-N).
# 0.9.2: Recriar o arquivo svg6info.ctl, pois o que ele baixa do servidor
# nao funciona, pois tem o "../xx/", ao final eh recriado o arquivo.
#
##
## sair()
##
erro_var=""
sair() {
echo "ERRO: Ocorreu algum erro na definicao da variavel '$erro_var'";
exit 1;
}
##
## Variaveis
##
home=/home/avgupdate; [ ! -d $home ]&& erro_var="home" sair
url=http://www.grisoft.com/softw/60/fe
arqinfo=avg6info.ctf
log=avg_update.log
email=marcus@sbh.eng.br
##
## Programas
##
rm=/bin/rm; [ ! -x $rm ]&& erro_var="rm" sair
touch=/bin/touch; [ ! -x $touch ]&& erro_var="touch" sair
wget=/usr/bin/wget; [ ! -x $wget ]&& erro_var="wget" sair
mail=/bin/mail; [ ! -x $mail ]&& erro_var="mail" sair
grep=/bin/grep; [ ! -x $grep ]&& erro_var="grep" sair
cut=/usr/bin/cut; [ ! -x $cut ]&& erro_var="cut" sair
echo=/bin/echo; [ ! -x $echo ]&& erro_var="echo" sair
find=/usr/bin/find; [ ! -x $find ]&& erro_var="find" sair
xargs=/usr/bin/xargs; [ ! -x $xargs ]&& erro_var="xargs" sair
cat=/bin/cat; [ ! -x $cat ]&& erro_var="cat" sair
ps=/bin/ps; [ ! -x $ps ]&& erro_var="ps" sair
awk=/usr/bin/awk; [ ! -x $awk ]&& erro_var="awk" sair
ls=/bin/ls; [ ! -x $ls ]&& erro_var="ls" sair
##
## Vai para o $home
##
cd $home
##
## Previne para que nao ocorra outro update
##
if [ -f "prevent_update" ]; then
psavg=`$ps -aux | $grep wget | $grep avg`
if [ "$psavg" != "" ]; then
$echo "Existe outro arquivo \"prevent_update\"" | $mail -s "[AVG-Update] Erro" $email
exit 3
fi
else
$touch prevent_update
fi
##
## Remove arquivos $arqinfo/$log
##
[ -f $arqinfo ] && $rm -rf $arqinfo
[ -f $log ] && $rm -rf $log
##
## Download do $arqinfo
##
$wget -o $log $url/$arqinfo
##
## Testa se existe o $arqinfo
##
if [ -f "$arqinfo" ]; then
bin_update=`$cat $arqinfo | $awk 'gsub(/("|.*\/.*\/)/,"") {print $1}'`
else
$cat $log | $mail -s AVG-Update $email
exit 3
fi
##
## Procura pelos .bin antigos e remove eles
##
old_bin=`$find . -name "*.bin" | $awk 'gsub(/.\//,"") {print}'`
if [ "$old_bin" != "" ]; then
for i in $old_bin; do
remove_old=true
for n in $bin_update; do
if [ "$i" = "$n" ]; then
remove_old=false
fi
done
if $remove_old; then
$rm -rf $i
fi
done
fi
##
## Download dos novos .bin
##
envia_email=false
for i in $bin_update; do
arq_down=`$cat $arqinfo | $grep $i | $awk 'gsub(/"/,"") {print $1}'`
if [ -f $i ]; then
size_arqinfo=`$cat $arqinfo | $grep $i | $awk '{print $2}' | $cut -d= -f2`
size_ls=`$ls -lk $i | $awk '{print $5}'`
if [ "$size_arqinfo" != "$size_ls" ]; then
$wget -N -a $log $url/$arq_down
envia_email=true
fi
else
$wget -N -a $log $url/$arq_down
envia_email=true
fi
done
##
## Gera arquivo avg6info.ctf
if [ -f $arqinfo ]; then
$cat $arqinfo | $awk '{gsub(/..\/.*\//,"")} {print}' > $arqinfo
fi
##
## Envia email
##
if $envia_email; then
$cat $log | $mail -s "[AVG-Update] Atualizado" $email
fi
##
## Remove arquivo $prevent_update
##
$rm -rf prevent_update
Script para atualizar o Debian 13
Script em bash para compilação do kernel 3.3.2 para Ubuntu 11.10 com patch 3.3.0-ck1
Pegando IP externo shell script
Instalação automática de programas
Nenhum comentário foi encontrado.
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Atualizar Linux Mint 22.2 para 22.3 beta
Jogar games da Battle.net no Linux com Faugus Launcher
Como fazer a Instalação de aplicativos para acesso remoto ao Linux
Conky, alerta de temperatura alta (10)
Assisti Avatar 3: Fogo e Cinzas (3)
Duas Pasta Pessoal Aparecendo no Ubuntu 24.04.3 LTS (42)









