* [sisyphus] Умно почистить кэш apt-a
@ 2004-05-07 8:41 Игорь
2004-05-07 9:34 ` Ildar Mulyukov
2004-05-07 10:38 ` Sergey Shilov
0 siblings, 2 replies; 3+ messages in thread
From: Игорь @ 2004-05-07 8:41 UTC (permalink / raw)
To: sisyphus
В апреле обсуждалась тема чистки
предлагаю скрипт, но извиняюсь за стиль - не спец
!!!! Файлы предварительно переименовываются к именам пакетов
(в обсуждении предлагался скрипт по переименованию)
Только после этого можно использовать этот, а то вычистит все что не
соответствует правилу формирования имени RPM файла.
Опробовано на Compact 2.3. + Sisyphus (на 20040505)
___________________________________________________
#!/bin/sh
apt-cache dumpavail > allpkgs.lst
for i in *.rpm
do
p="`grep "$i" allpkgs.lst`"
test -z "$p" && rm "$i"
done
___________________________________________________
Кому страшно - может предварительно отсадить куда нибудь пакеты
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [sisyphus] Умно почистить кэш apt-a
2004-05-07 8:41 [sisyphus] Умно почистить кэш apt-a Игорь
@ 2004-05-07 9:34 ` Ildar Mulyukov
2004-05-07 10:38 ` Sergey Shilov
1 sibling, 0 replies; 3+ messages in thread
From: Ildar Mulyukov @ 2004-05-07 9:34 UTC (permalink / raw)
To: sisyphus
IMHO apt-get autoclean значительно правильнее, т.к. учитывает пакеты, не
установленные из репозитария. Другое дело, что работает он пока не
стопроцентно и надо довести его до ума. Хотя не удаляет нужного, всё же
оставляет ненужные (например, напрочь отказывается удалять
altlinux-release-*.rpm). Повесить, что ли багу?
А за скрипт - спасибо. В мире Линуха приветствуется наличие
альтернативных подходов к решению задачи. Может, кому-нибудь будет по
душе этот.
С уважением, Ильдар.
Игорь wrote:
> В апреле обсуждалась тема чистки
> предлагаю скрипт, но извиняюсь за стиль - не спец
>
> !!!! Файлы предварительно переименовываются к именам пакетов
> (в обсуждении предлагался скрипт по переименованию)
>
> Только после этого можно использовать этот, а то вычистит все что не
> соответствует правилу формирования имени RPM файла.
>
> Опробовано на Compact 2.3. + Sisyphus (на 20040505)
--
Ildar Mulyukov,
free SW designer/programmer
================================================
email: ildar@users.sourceforge.net
projects: http://os-development.sourceforge.net/
home: http://tuganger.narod.ru/
ALT Linux Sisyphus (20030721)
================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [sisyphus] Умно почистить кэш apt-a
2004-05-07 8:41 [sisyphus] Умно почистить кэш apt-a Игорь
2004-05-07 9:34 ` Ildar Mulyukov
@ 2004-05-07 10:38 ` Sergey Shilov
1 sibling, 0 replies; 3+ messages in thread
From: Sergey Shilov @ 2004-05-07 10:38 UTC (permalink / raw)
To: sisyphus
В сообщении от 7 Май 2004 11:41 Игорь написал(a):
> В апреле обсуждалась тема чистки
Вопрос был мой.
> предлагаю скрипт, но извиняюсь за стиль - не спец
Аналогично.
>
> !!!! Файлы предварительно переименовываются к именам пакетов
> (в обсуждении предлагался скрипт по переименованию)
Предлагаемый скрипт делает это сам используя RPM
>
> Только после этого можно использовать этот, а то вычистит все
> что не соответствует правилу формирования имени RPM файла.
Этот просто ничего не сделает
>
> Опробовано на Compact 2.3. + Sisyphus (на 20040505)
Тоже опробовано
> ___________________________________________________
> Кому страшно - может предварительно отсадить куда нибудь
> пакеты _______________________________________________
Очень правильная мысль! Предлагаемый скрипт "натравливался"
именно на отсаженный контент.
#!/bin/bash
#
#
fformat="%{NAME}-%{VERSION}-%{RELEASE}.%{RHNPLATFORM}.rpm"
#
pkg_dir="MY cache dir"
#
pkg_installed=`rpm -qa --queryformat "%{NAME}\\n"`
cd $pkg_dir
for ipkg in $pkg_installed ; do
ipkgfullname=`rpm -q $ipkg`
pkg_cached=`find . -iname $ipkg\*`
if [ -z "$pkg_cached" ] ; then
echo "$ipkg"
continue
fi
echo ""
echo "$ipkg ( $ipkgfullname )"
echo "---------------------"
echo "$pkg_cached"
for cpkg in $pkg_cached ; do
cpkgex=`rpm -qp $cpkg --queryformat
"%{NAME}-%{VERSION}-%{RELEASE}"`
nfname=`rpm -qp $cpkg --queryformat $fformat`
echo "compare $cpkgex == $ipkgfullname"
if [ "$cpkgex" == "$ipkgfullname" ] ; then
echo "---> $cpkg aka $nfname "
# Чго собственно с пакетом делать
# cp $cpkg ./installed/$nfname
# mv $cpkg ./installed/$nfname
break
fi
done
echo ""
done
Для поиска пакетов скачаных но не установленных пакетов пользовал
другой скрипт
#!/bin/bash
#
#
fformat="%{NAME}-%{VERSION}-%{RELEASE}.%{RHNPLATFORM}.rpm"
#
pkg_dir="MY cache dir"
#
pkg_dir="/home/hsv/APT/archives"
cd $pkg_dir
pkg_cached=`ls *.rpm`
for pkgfile in $pkg_cached ; do
pkgname=`rpm -qp $pkgfile --queryformat "%{NAME}"`
nfname=`rpm -qp $pkgfile --queryformat $fformat`
if [ -n "`rpm -q $pkgname 2> /dev/null`" ] ; then
echo "skip $pkgfile"
else
mv $pkgfile ./downloaded/$nfname
echo "move $pkgfile to ./downloaded as $nfname"
fi
done
С уважением
Сергей Шилов
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-07 10:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-07 8:41 [sisyphus] Умно почистить кэш apt-a Игорь
2004-05-07 9:34 ` Ildar Mulyukov
2004-05-07 10:38 ` Sergey Shilov
ALT Linux Sisyphus discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/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 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
public-inbox-index sisyphus
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sisyphus
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git