Atualização do AVG
Publicado por Marcelo Donato de Lemos Rossato 01/08/2004
[ Hits: 8.330 ]
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
Instalando MPlayer no slackware
Script para executar o giFT daemon e uma interface de usuário
Nenhum comentário foi encontrado.
Fscrypt: protegendo arquivos do seu usuário sem a lentidão padrão de criptograr o disco
Faça suas próprias atualizações de pacotes/programas no Void Linux e torne-se um Contribuidor
Como rodar o Folding@home no Linux
Criando um painel de controle (Dashboard) para seu servidor com o Homepage
O Abismo entre o Código e o Chão: Saltos Tecnológicos e a Exclusão Estrutural no Brasil
Utilizando a Ferramenta xcheckrestart no Void Linux
Pisando no acelerador do Linux Mint: Kernel XanMod, zRAM e Ajustes de Swap
Como compilar kernel no Linux Mint
Abrir um arquivo URL pelo Clipper (9)
Seno, Coseno, Tangente em CLIPPER (1)
Inserir uma URL num arquvo pelo Ubuntu (CLIPPER) (0)
VMWare Player não conecta na rede nem consigo intercambiar arquivos (1)









