From: Dmitry Rusetsky <dimania@mail.ru>
To: community@altlinux.ru
Subject: Re: [Comm] Как сравнить версии?
Date: Fri, 19 Mar 2004 15:33:51 +0300
Message-ID: <405AE8AF.5060100@mail.ru> (raw)
In-Reply-To: <20040318141511.GE19921@inferno.immo>
[-- Attachment #1: Type: text/plain, Size: 929 bytes --]
Alexey I. Froloff пишет:
> * Nick S. Grechukh <ngrechukh@ua.fm> [040318 17:11]:
>
>>>>>Пишу скриптик по очистке /var/cache/apt/archives от старых
>>>>>версий одинаковых пакетов.
>>>>
>>>>А поделитесь, плиз, когда напишите. :)
>>>
>>>apt-get autoclean не подходит из религиозных соображений?
>>
>>он точно чистит только устаревшие, а не весь кэш?
>
> В man apt-get всё написано ;-)
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Community mailing list
> Community@altlinux.ru
> http://www.altlinux.ru/mailman/listinfo/community
насколько я понял apt-get autoclean чистит весь кэш
а требуется почистить только старые версии пакетов.
потом оттуда весь кэш перебрасывается в лан путем переписывания if
different size и обновляються машины в лане.
а скрипт в первом приближении вот:
только не ругайте.
[-- Attachment #2: 1_old_filter.sh --]
[-- Type: text/plain, Size: 2096 bytes --]
#!/bin/sh
#
# For move old packages to old dir
# copy it to /var/cache/apt/arcvives
# and if need run it :-)
LOG=0rmlist.log
ERR=0rmerror.log
OLD=old
RPMERR=0rpmerr.log
mkdir -p old
genlist()
{
#rm_list=""
Ver_old="0"
Rel_old="0"
pack_old=""
Name0=$1
ver_res=0
rel_res=0
for j in ${Name0}_*.rpm
do
#echo $j
if [ ! -f $j ] ; then
return
fi
Name=`rpm -qp $j --queryformat %{NAME} 2>>$RPMERR`
Ver_current=`rpm -qp $j --queryformat %{VERSION} 2>>$RPMERR`
Rel_current=`rpm -qp $j --queryformat %{RELEASE} 2>>$RPMERR`
ver_res=`rpmvercmp $Ver_current $Ver_old`
rel_res=`rpmvercmp $Rel_current $Rel_old`
#echo "rpmvercmp $Ver_current $Ver_old"
if [ "$ver_res" -gt 0 ] ; then
Ver_old=$Ver_current
rmlist="$rmlist $pack_old"
#echo 1 - $rmlist
elif [ "$ver_res" -lt 0 ] ; then
rmlist="$rmlist $j"
elif [ "$ver_res" -eq 0 ] ; then
if [ "$rel_res" -gt 0 ] ; then
Rel_old=$Rel_current
rmlist="$rmlist $pack_old"
elif [ "$rel_res" -lt 0 ] ; then
rmlist="$rmlist $j"
elif [ "$rel_res" -eq 0 ] ; then
echo ERROR!!!!!!!!
exit
fi
fi
pack_old=$j
#echo $Name
#echo $Ver_current
#echo $Rel_current
done
#echo $rmlist
}
dublicate()
{
Name=""
rmlist=""
flag=0
for i in *.rpm
do
if [ ! -f $i ] ; then
continue
fi
Name0=`rpm -qp $i --queryformat %{NAME} | sed -e s/_/%5f/g 2>>$ERR`
#echo --------Name0=$Name0 -- Name=$Name-------------------
echo $i
if [ "$Name0" = "$Name" ]; then
if [ "$flag" = "1" ] ; then
continue
fi
echo ------------$Name0---------------- >>$LOG
genlist $Name0
echo RMLIST IS: $rmlist >>$LOG
mv $rmlist $OLD 2>>$ERR
rmlist=""
echo ----------------------------------------- >>$LOG
flag=1
else
flag=0
fi
Name=$Name0
done
#exit
}
#-------------------------------------------------------------
# main()
date >>$LOG
dublicate
#exit
next prev parent reply other threads:[~2004-03-19 12:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-18 9:40 Dmitry Rusetsky
2004-03-18 9:56 ` Sergey Vlasov
2004-03-18 10:19 ` Dmitry Rusetsky
2004-03-18 10:25 ` Низамов Шавкат
2004-03-18 12:12 ` Alex
2004-03-18 13:01 ` Alexey I. Froloff
2004-03-18 14:11 ` Nick S. Grechukh
2004-03-18 14:15 ` Alexey I. Froloff
2004-03-19 12:33 ` Dmitry Rusetsky [this message]
2004-03-19 20:03 ` Sergey Kuznetsov
2004-03-22 5:03 ` Dmitry Rusetsky
2004-03-22 18:10 ` Sergey Kuznetsov
2004-03-30 14:53 ` Alexey Morozov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=405AE8AF.5060100@mail.ru \
--to=dimania@mail.ru \
--cc=community@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git