From bd573d616a2a858468cf23c7dc8da36aded407ab Mon Sep 17 00:00:00 2001 From: milisbir Date: Thu, 18 Oct 2018 15:26:14 +0300 Subject: [PATCH] mps-tespit --- bin/mps | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/bin/mps b/bin/mps index 13fb31b44..5508ed651 100755 --- a/bin/mps +++ b/bin/mps @@ -1217,21 +1217,22 @@ dongu_gosterge(){ } t_indeks(){ - + # karşılaştırma dosyası -talimatname indeks dönüşü verecek [ -z $1 ] && exit 1 local dosya_t="$1" + # talimat listesi local dosya=`mktemp` local dosya_sirasiz=`mktemp` - - [ -f $dosya ] && rm -rf $dosya - find /root/talimatname/temel/* -type d > $dosya - find /root/talimatname/genel/*/* -type d >> $dosya + + find ${talimatname}/temel/* -type d > $dosya + find ${talimatname}/genel/*/* -type d >> $dosya while IFS='' read -r konum || [[ -n "$konum" ]]; do # Surum-Devir isim=$(basename $konum) #surum=$(grep -ri ^"surum=" $konum/talimat | cut -d '=' -f2 | awk '{ sub(/[ \t]+$/, ""); print }') + # sürüm ve devir değişkenlerinin olası boşluklarının kırpılması surum=$(grep -ri ^"surum=" $konum/talimat | cut -d '=' -f2 | tr -d [:space:]) devir=$(grep -ri ^"devir=" $konum/talimat | cut -d '=' -f2 | tr -d [:space:]) echo "$isim@$surum-$devir" >> $dosya_sirasiz @@ -1270,28 +1271,37 @@ k_indeks(){ echo "$isim@$surum-$devir" >> $dosya_sirasiz done < "$dosya" + # alfabetik sıralama sort $dosya_sirasiz > $dosya_k - echo "kurulu_sira: $dosya" rm -f $dosya_sirasiz } guncelleme_tespit(){ + # talimatname indeks dosyası local dosya_t=`mktemp` + # kurulum indeks dosyası local dosya_k=`mktemp` - local dosya_kurs=`mktemp` + # kuruluma göre sıralı paket listesi + local dosya_ks=`mktemp` + # güncellenecek paket listesi sırasız local dosya_g=`mktemp` local dosya_son=`mktemp` + local dosya_sonuc=`mktemp` t_indeks $dosya_t & - k_indeks $dosya_k $dosya_kurs & + k_indeks $dosya_k $dosya_ks & wait $(jobs -p) #set -x + # talimatname ve kurulu sürüm-devir indeks dosya karşılaştırılması grep -vxFf $dosya_t $dosya_k > $dosya_g - sed -i 's/$/@/' $dosya_kurs + # paketleri çekmek için satır sonu @ ekleme + sed -i 's/$/@/' $dosya_ks for _gunc in $(cat $dosya_g);do _gunc2=$(echo ${_gunc} | cut -d'@' -f1) - grep -nr "${_gunc2}@" $dosya_kurs > $dosya_son + grep -nr "^${_gunc2}@" $dosya_ks >> $dosya_son done - cat $dosya_son | cut -d':' -f2 + # güncellenecek paketlerin-kurulum sırasına göre sıralanıp, sadeleştirilmesi + sort $dosya_son | cut -d':' -f2 | cut -d'@' -f1 > $dosya_sonuc + rm @dosya_t @dosya_k @dosya_ks @dosya_g @dosya_son } sistem_guncelle_uygula(){