Atualização do AVG
Publicado por Marcelo Donato de Lemos Rossato 01/08/2004
[ Hits: 8.267 ]
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
Cadastrando usuários no Squid através de Shell Script
Zclamav - script para substituir o Clamtk
Visualizar os processos que mais consomem memória
zwtsc - cliente gráfico para Terminal Service
Nenhum comentário foi encontrado.
Gentoo: detectando impressoras de rede e como fixar uma impressora por IP
Como o GNOME conseguiu o feito de ser preterido por outras interfaces gráficas
Gentoo binário em 2026: UEFI, LUKS, Btrfs e Systemd
Trabalhando Nativamente com Logs no Linux
Jogando Daikatana (Steam) com Patch 1.3 via Luxtorpeda no Linux
Por que sua empresa precisa de uma PKI (e como automatizar EMISSÕES de certificados via Web API)
Instalando NoMachine no Gentoo com Systemd (acesso Remoto em LAN)
Gentoo: Trocando wpa_supplicant pelo iwd no NetworkManager (Systemd)
Necessário autenticar ao imprimir - Ubuntu X Windowns (1)
O que houve com slackware ??? (11)
O Free Download Manager não abre no Fedora 43 KDE Plasma (2)









