milis/bin/pkvt_olustur

62 lines
1.8 KiB
Plaintext
Raw Normal View History

2016-03-16 23:16:23 +01:00
#!/bin/bash
2018-01-10 22:25:08 +01:00
tekrarlar(){
#ls *.mps.lz | cut -d'#' -f1 | sort | uniq -c | grep -v "1 " | sed -e 's/^[ \t]*//' | cut -d' ' -f2 | xargs -I {} find . -name {}* -printf "%T+\t%p\n" | sort | awk '{print $2}'
#ls *.mps.lz | awk -F# '{ if (c[$1]) print $1 ; c[$1]=$0}' | cut -d' ' -f2 | xargs -I {} find . -name {}* -printf '%T+\t%p\n' | sort | awk '{print $2}'
#ls *.mps.lz | awk -F# '{ if (c[$1]) print $1 ; c[$1]=$0}' | xargs -I {} find . -name {}* | sort
ls *.mps.lz | awk -F# '{ if (c[$1]) print $1 ; c[$1]=$0}'
#surum=$(mps -b $paket --normal | sed -n '6p' | cut -d':' -f2 | sed -e 's/^[ \t]*//')
}
eski_paket_tespit(){
[ -f /tmp/paketdepo_silinecekler ] && rm -rf /tmp/paketdepo_silinecekler
for paket in $(tekrarlar);do
paket1=`ls $paket* | sed -n 1p`
paket2=`ls $paket* | sed -n 2p`
#echo "$paket1 : $paket2"
if [ $paket1 -nt $paket2 ];then
echo "$paket2" >> /tmp/paketdepo_silinecekler
else
echo "$paket1" >> /tmp/paketdepo_silinecekler
fi
done
if [ -f /tmp/paketdepo_silinecekler ];then
cat /tmp/paketdepo_silinecekler
mkdir -p /tmp/eskipaketler
while true; do
printf "\n"
echo "eski paketler listesi./tmp/eskipaketler altına taşınacak?";read -p "e veya h-> " eh
case $eh in
[Ee]* ) cat /tmp/paketdepo_silinecekler | xargs -I {} mv {} /tmp/eskipaketler/ ; break;;
[Hh]* ) break;;
* ) echo "e veya h";;
esac
done
else
echo "tekrarlayan paket yok."
fi
}
2016-03-16 23:16:23 +01:00
pvt_olustur(){
2018-01-10 22:25:08 +01:00
echo "paket.vt oluşturuluyor."
2016-03-16 23:16:23 +01:00
if [ ! -f paket.vt ];then
touch paket.vt
fi
2016-03-29 02:39:30 +02:00
for paket in `ls *.mps.lz`
2016-03-16 23:16:23 +01:00
do
paketad="`echo $paket|cut -d "#" -f1`"
shaek=`sha1sum $paket`
2016-03-18 03:14:06 +01:00
2018-01-24 07:53:03 +01:00
echo $paketad $shaek >> paket.vt.yeni
2016-03-16 23:16:23 +01:00
done
2018-01-24 07:53:03 +01:00
if [ -f "paket.vt.yeni" ];then
mv paket.vt paket.vt.eski
mv paket.vt.yeni paket.vt
fi
2018-01-10 22:25:08 +01:00
echo "paket.vt oluşturuldu."
2016-03-16 23:16:23 +01:00
}
2018-01-10 22:25:08 +01:00
eski_paket_tespit
2016-03-16 23:16:23 +01:00
pvt_olustur