#!/bin/sh #Очищаем кэш от устаревших файлов пакетов apt-get autoclean #обновляем БД по пакетам apt-get update && apt-get dist-upgrade -y #получаем список установленных в систему пакетов rm -f ~/tmp/installrpm rpm -qa --qf='%{NAME}\n' | sort > ~/tmp/installrpm #получаем список имеющих в кэше файлов пакетов в виде "только имена пакетов" rm -f ~/tmp/presentfiles cd /var/cache/apt/archives ls *rpm | sort > ~/tmp/presentfiles rm -f ~/tmp/presentrpm cat ~/tmp/presentfiles | while read FILEPKG; do rpm -qp $FILEPKG --queryformat "%{NAME}\n" >> ~/tmp/presentrpm done comm -23 ~/tmp/installrpm ~/tmp/presentrpm > ~/tmp/dwrpm #докачиваем отсутствующие в кэше файлы установленных пакетов cat ~/tmp/dwrpm | while read PKG; do apt-get reinstall -d -y $PKG done #EOF