milis/bin/mps

762 lines
16 KiB
Plaintext
Raw Normal View History

2016-02-24 01:27:23 +01:00
#!/bin/bash
2016-03-06 19:36:07 +01:00
. /etc/mpsd.conf
2016-03-07 00:39:49 +01:00
. /root/bin/fonks.sh
2016-04-06 00:35:09 +02:00
versiyon="0.3"
2016-03-11 17:42:21 +01:00
iletisim="milisarge@gmail.com"
2016-02-24 01:27:23 +01:00
paketdepo="/depo/paketler/"
2016-04-06 02:09:43 +02:00
sunucu="192.168.1.66:8000/"
2016-04-14 02:16:51 +02:00
#sunucu="http://gungre.ch/milis/packages/"
2016-03-07 00:39:49 +01:00
git_sunucu="https://github.com/milisarge/malfs-milis"
2016-02-24 01:27:23 +01:00
ikaynak=""
betikad=${0##*/}
kurulum_onay="evet"
talimatname_dizin="/root/talimatname"
2016-02-25 01:08:35 +01:00
kokdizin="/"
2016-03-07 23:04:43 +01:00
VT="/var/lib/pkg/DB"
2016-03-09 01:57:13 +01:00
TARIHCE_DIZIN="/var/lib/pkg/tarihce"
2016-03-29 02:16:52 +02:00
LOGDIZIN="/var/log/mps"
2016-03-25 22:19:01 +01:00
tekrarkur="hayir"
lokal="tr"
2016-03-26 02:00:34 +01:00
docsil="evet"
yerelsil="evet"
2016-03-07 23:04:43 +01:00
2016-02-24 01:27:23 +01:00
icerik_ekle(){
paketad=`echo "$1" | cut -d'#' -f1`
paketad=`basename $paketad`
2016-03-31 02:28:09 +02:00
ryaz 34 $paketad" paketi kuruluyor-> $kokdizin"
2016-02-28 00:55:08 +01:00
tar -C /tmp --extract --file=$1 .PRE 1 2> /tmp/$paketad_pre.log
2016-02-26 02:41:51 +01:00
#kos-kur kontrolu
if [ -f /tmp/.PRE ];then
2016-03-31 03:23:45 +02:00
if [ "$kokdizin" == "/" ];then
bash /tmp/.PRE
else
cp /tmp/.PRE $kokdizin/tmp/$paketad.PRE
fi
2016-02-26 02:41:51 +01:00
rm /tmp/.PRE
fi
2016-03-25 22:19:01 +01:00
mkdir -p kur.$paketad &&
tar xf $1 -C kur.$paketad &&
#istenmeyen yerellerin silinmesi
2016-03-26 02:00:34 +01:00
if [ -d kur.$paketad/usr/share/locale ] && [ "$yerelsil" == "evet" ];then
2016-03-25 22:19:01 +01:00
for lkl in `ls kur.$paketad/usr/share/locale/`;do
if [ "$lkl" != "$lokal" ];then rm -r kur.$paketad/usr/share/locale/$lkl; fi
done
fi
2016-03-26 02:00:34 +01:00
#doc dizini silinmesi
if [ -d kur.$paketad/usr/share/doc ] && [ "$docsil" == "evet" ];then
rm -r kur.$paketad/usr/share/doc
fi
2016-03-31 02:28:09 +02:00
mkdir -p $kokdizin/var/lib/pkg/DB/"$paketad" &&
2016-03-25 22:19:01 +01:00
cp -v -afr kur.$paketad/* $kokdizin > kur.$paketad/kurulan &&
2016-03-31 02:28:09 +02:00
cp kur.$paketad/kurulan /tmp/ &&cat kur.$paketad/kurulan | cut -d '>' -f2 > $kokdizin/var/lib/pkg/DB/"$paketad"/kurulan &&
2016-03-25 22:19:01 +01:00
#mv kur.$paketad/.MTREE /var/lib/pkg/DB/"$paketad"/files &&
2016-03-31 02:28:09 +02:00
mv kur.$paketad/.META $kokdizin/var/lib/pkg/DB/"$paketad"/META &&
2016-03-07 01:43:25 +01:00
2016-02-26 02:41:51 +01:00
#kur-kos calistirilmasi
2016-03-25 22:19:01 +01:00
if [ -f kur.$paketad/.POST ];then
2016-03-31 03:23:45 +02:00
if [ "$kokdizin" == "/" ];then
bash kur.$paketad/.POST
else
cp kur.$paketad/.POST $kokdizin/tmp/$paketad.POST
fi
2016-03-25 22:19:01 +01:00
rm kur.$paketad/.POST
2016-02-26 02:41:51 +01:00
fi
2016-03-25 22:19:01 +01:00
rm -r kur.$paketad
2016-03-31 02:28:09 +02:00
if [ -f $kokdizin/etc/ld.so.conf ];then
ldconfig -r $kokdizin
2016-02-24 01:27:23 +01:00
fi
2016-03-07 00:39:49 +01:00
ryaz 34 $paketad" paketi kuruldu."
2016-03-29 02:16:52 +02:00
loglama "$paketad paketi kuruldu."
2016-02-24 01:27:23 +01:00
}
2016-03-07 22:12:18 +01:00
paket_sil(){
2016-03-10 01:28:42 +01:00
local paket kkont sil_onay oto_silme
2016-03-07 01:43:25 +01:00
paket="$1"
2016-03-10 01:28:42 +01:00
if [ "$2" ]; then
oto_silme="$2"
fi
2016-03-10 14:12:52 +01:00
kkont=`kurulu_kontrol "$1"`
if [ "$kkont" = "kurulu" ];then
if [ -f "/var/lib/pkg/DB/$paket/kurulan" ];then
2016-03-07 08:30:10 +01:00
cat /var/lib/pkg/DB/$paket/kurulan | cut -d '>' -f2 > /tmp/$paket.sil
2016-03-12 01:44:27 +01:00
ryaz 31 "ters bagimliliklar"
ryaz 31 "------------------"
ters_bagimli_kontrol "$paket"
ryaz 31 "------------------"
2016-03-10 01:28:42 +01:00
if [ "$oto_silme" = "evet" ];then
sil_onay="e"
else
while true; do
ryaz 34 $paket" paketi kaldırılsın mı?";read -p "e veya h-> " eh
case $eh in
[Ee]* ) sil_onay="e"; break;;
[Hh]* ) break;;
* ) echo "e veya h";;
esac
done
fi
2016-03-07 01:43:25 +01:00
if [ "$sil_onay" = "e" ];then
xargs rm -r -f < /tmp/$paket.sil &&
rm -r -f /var/lib/pkg/DB/"$paket" &&
ryaz 34 $paket" paketi silindi."
2016-03-29 02:16:52 +02:00
loglama "$paket paketi silindi."
2016-03-07 01:43:25 +01:00
fi
rm -f /tmp/$paket.sil
else
2016-03-10 14:12:52 +01:00
ryaz 31 "kritik mesaj:kurulanlar dosyası yok."
2016-03-07 01:43:25 +01:00
fi
else
2016-03-10 14:12:52 +01:00
ryaz 32 "paket zaten kurulu değil!"
2016-03-07 01:43:25 +01:00
fi
}
2016-02-24 01:27:23 +01:00
paket_bilgi(){
local paket kkont
kkont=`kurulu_kontrol "$1"`
if [ "$kkont" = "kurulu" ];then
paket="$1"
cat /var/lib/pkg/DB/"$paket"/META
else
echo "paket kurulu değil!"
fi
}
2016-03-19 00:16:01 +01:00
yeniden_paketle(){
2016-03-19 02:20:46 +01:00
cd $1
bsdtar -r -f ../"$1".mps .META
bsdtar -r -f ../"$1".mps *
cd ..
lzip -9 "$1".mps
2016-03-19 00:16:01 +01:00
}
2016-02-24 01:27:23 +01:00
derleme_listyap(){
2016-03-02 01:26:35 +01:00
bagimlist=`bagimlilar "$1"`
2016-02-24 01:27:23 +01:00
for bagim in $bagimlist;do
2016-04-05 02:02:34 +02:00
if [ "`cat tumbag.liste | grep $bagim`" != "$bagim" ];then
2016-02-24 01:27:23 +01:00
derleme_listyap "$bagim"
fi
done
2016-04-05 02:02:34 +02:00
#if [ "`cat tumbag.liste | grep $1`" != "$1" ];then
# echo "tumbag.liste yazılıyor:" "$1"
# echo "$1" >> tumbag.liste
2016-02-24 01:27:23 +01:00
#fi
2016-04-05 02:02:34 +02:00
if ! grep -Fxq "$1" tumbag.liste
2016-02-24 01:27:23 +01:00
then
# echo "pas"
#else
2016-02-28 00:55:08 +01:00
ana="`find $talimatname_dizin -name $1`"
echo ${ana#"$talimatname_dizin"}
#sadece genel bagimliliklar derlenecek
2016-04-05 02:02:34 +02:00
echo "$1" >> tumbag.liste
2016-02-28 00:55:08 +01:00
if [ -d "$talimatname_dizin/genel/$1" ];then
2016-04-05 02:02:34 +02:00
echo "$1" >> bag.liste
2016-02-28 00:55:08 +01:00
fi
2016-02-24 01:27:23 +01:00
fi
}
2016-03-02 01:26:35 +01:00
derleme_listbilgi(){
2016-03-07 00:39:49 +01:00
ryaz 34 "yapim asamasında"
2016-03-02 01:26:35 +01:00
}
2016-02-24 01:27:23 +01:00
paket_derle_oto(){
2016-02-28 00:55:08 +01:00
for dpkt in `cat $1`;do
2016-02-24 01:27:23 +01:00
echo $dpkt "derleniyor...."
2016-03-10 12:42:16 +01:00
zorla_derle="yok"
2016-02-24 01:27:23 +01:00
paket_derle $dpkt
done
}
2016-03-03 15:10:44 +01:00
#otomatik derle kontrollu kur
paket_derle_oto2(){
2016-03-23 06:53:40 +01:00
tekrarkur="hayir"
2016-04-05 02:02:34 +02:00
mps -dly "$1" > /dev/null && mps -odk bag.liste
2016-03-03 15:10:44 +01:00
}
2016-03-02 01:26:35 +01:00
paket_kur_oto(){
2016-03-12 00:09:47 +01:00
local kpkt pkt pak
2016-03-02 01:26:35 +01:00
for kpkt in `cat $1`;do
for pkt in `ls $kpkt* | cut -d'#' -f1`;do
2016-03-12 00:09:47 +01:00
pak=`ls "$pkt#"*`
mps -k "$pak"
2016-03-02 01:26:35 +01:00
done
done
}
2016-03-10 01:28:42 +01:00
2016-03-17 03:08:24 +01:00
paket_kur_liste(){
local kpkt pkt pak
for kpkt in `cat $1`;do
for pkt in `ls $kpkt* | cut -d'#' -f1`;do
pak=`ls "$pkt#"*`
mps -k2 "$pak"
done
done
}
2016-03-17 04:08:47 +01:00
#otomatik kontrollu kur
2016-03-12 00:09:47 +01:00
paket_kur_oto2(){
2016-04-05 02:02:34 +02:00
mps -dly "$1" > /dev/null && mps -ok bag.liste
2016-03-12 00:09:47 +01:00
}
2016-04-05 02:02:34 +02:00
paket_inkur_liste(){
2016-03-17 04:08:47 +01:00
local kpkt pkt pak
for kpkt in `cat $1`;do
mps -ik "$kpkt"
done
}
#otomatik kontrollu kur
2016-04-05 02:02:34 +02:00
paket_inkur_oto(){
mps -dly "$1" > /dev/null && paket_inkur_liste bag.liste
rm bag.liste tumbag.liste
2016-03-17 04:08:47 +01:00
}
2016-03-10 01:28:42 +01:00
paket_sil_oto(){
local spkt
for spkt in `cat $1`;do
oto_silme="evet"
paket_sil "$spkt" "$oto_silme"
done
}
2016-02-24 01:27:23 +01:00
paket_derle(){
2016-03-07 23:04:43 +01:00
#eski derleme kalıntılarını temizle
2016-03-12 14:27:37 +01:00
if [ -d tmp.* ];then
rm -r tmp.*
fi
2016-03-07 00:39:49 +01:00
kaynakdizin_kontrol
2016-02-24 01:27:23 +01:00
local konum derleme_onay eh bagimd
derleme_onay="h"
konum="`find "$talimatname_dizin" -name $1`"
if [ -d "$konum" ];then
mkdir -p tmp."$1"
cp -a $konum/* tmp."$1"/
cd tmp."$1"
2016-03-07 23:04:43 +01:00
if [ "`kurulu_kontrol "$1"`" = "kurulu" ] && [ "$zorla_derle" = "yok" ];then
2016-03-02 16:48:57 +01:00
derleme_onay="h"
2016-02-24 01:27:23 +01:00
else
2016-03-07 23:04:43 +01:00
echo "-----"
2016-02-24 01:27:23 +01:00
derleme_onay="e"
fi
if [ "$derleme_onay" = "e" ];then
2016-03-07 23:04:43 +01:00
ryaz 33 "$1" "derleniyor...."
2016-02-24 01:27:23 +01:00
#mpsd -d > /dev/null
2016-02-28 00:55:08 +01:00
#mpsd -d
echo "------------------------"
mpsd -d 2>&1|tee /tmp/"$1".log
if ( grep "^=======>" /tmp/"$1".log| tail -1 |grep "ERROR" > /dev/null);then
echo "derleme sisteminde hata oluştu -----> " /tmp/"$1".log
exit 1
fi
2016-02-24 01:27:23 +01:00
if [ "$kurulum_onay" = "evet" ];then
for kpkt in `ls $1* | cut -d'#' -f1`;do
mps -k "$kpkt#"*
done
fi
mv *.mps.lz ../
2016-03-07 23:04:43 +01:00
else
ryaz 32 "paket zaten kurulu,yine de derlemek için:
mps -zd $1"
2016-02-24 01:27:23 +01:00
fi
cd ..
rm -r tmp."$1"
else
2016-03-07 23:04:43 +01:00
ryaz 31 "talimat dosyası bulunamadı."
2016-02-24 01:27:23 +01:00
fi
}
2016-03-03 15:10:44 +01:00
2016-03-02 01:26:35 +01:00
bagimlilar(){
2016-02-24 01:27:23 +01:00
local bagimd konum
konum="`find "$talimatname_dizin" -name $1`"
2016-03-02 16:12:51 +01:00
bagimd=`cat $konum/talimat | grep "Depends on" | cut -d':' -f2`
2016-03-02 01:26:35 +01:00
if [ -n "$bagimd" ]; then
bagimd=`echo "$bagimd" | sed 's/,/ /g'`
#sıralı gösterme
echo `echo "$bagimd" | sed 's/,/ /g'`
fi
}
bagimli_bilgi(){
local bagimd konum bag
konum="`find "$talimatname_dizin" -name $1`"
bagimd=`cat $konum/talimat | grep "Depends" | cut -d':' -f2`
if [ -n "$bagimd" ]; then
bagimd=`echo "$bagimd" | sed 's/,/ /g'`
#sıralı gösterme
#echo `echo "$bagimd" | sed 's/,/ /g'`
#kurulu kontrollu gosterim
for bag in $bagimd;do
echo $bag "`kurulu_kontrol $bag`"
done
fi
echo "$1" "`kurulu_kontrol $1`"
2016-03-07 23:48:25 +01:00
2016-02-24 01:27:23 +01:00
}
2016-03-12 00:09:47 +01:00
ters_bagimli(){
local ara
ara=" $1 "
sy=`grep -o "/" <<<"$talimatname_dizin" | wc -l`
2016-03-12 01:44:27 +01:00
grep -rli "$ara" "$talimatname_dizin" | cut -d'/' -f`expr $sy + 3`
2016-03-12 01:06:20 +01:00
}
ters_bagimli_kontrol(){
2016-03-12 01:44:27 +01:00
ters_bagimli "$1" | sort > tersb.liste
ls /var/lib/pkg/DB/ | sed "/$1/d" | sort > simdiki.liste
2016-03-12 01:06:20 +01:00
comm -12 tersb.liste simdiki.liste
rm tersb.liste simdiki.liste
2016-03-12 00:09:47 +01:00
}
2016-02-24 01:27:23 +01:00
kurulu_kontrol(){
2016-03-31 02:28:09 +02:00
if [ -d "$kokdizin/var/lib/pkg/DB/$1" ];then
2016-02-24 01:27:23 +01:00
echo "kurulu"
exit 1
fi
echo "degil"
}
2016-04-12 00:14:39 +02:00
sistem_kur(){
local spaket
for spaket in `cat $1`;do
./$betikad -ik "$spaket" -kok $2;
done
}
2016-03-07 00:39:49 +01:00
kaynakdizin_kontrol(){
if [ ! -d $DERLEME_KAYNAKDIZIN ];then
mkdir $DERLEME_KAYNAKDIZIN
fi
}
2016-03-29 02:16:52 +02:00
logdizin_kontrol(){
2016-03-31 03:23:45 +02:00
if [ ! -d $kokdizin$LOGDIZIN ];then
mkdir $kokdizin$LOGDIZIN
2016-03-29 02:16:52 +02:00
fi
2016-03-31 03:23:45 +02:00
if [ ! -d $kokdizin$LOGDIZIN/derleme ];then
mkdir $kokdizin$LOGDIZIN/derleme
2016-03-29 02:16:52 +02:00
fi
2016-03-31 03:23:45 +02:00
if [ ! -f $kokdizin$LOGDIZIN/mps.log ];then
touch $kokdizin$LOGDIZIN/mps.log
2016-03-29 02:16:52 +02:00
fi
}
2016-03-09 01:57:13 +01:00
tarihce_dkontrol(){
if [ ! -d $TARIHCE_DIZIN ];then
mkdir $TARIHCE_DIZIN
fi
}
tarihce_liste(){
tarihce_dkontrol
ls $TARIHCE_DIZIN/
}
tarihce_yap(){
tarihce_dkontrol
2016-03-10 01:28:42 +01:00
local t_isim
if [ "$temel_tarihce" = "evet" ];then
t_isim="temel"
else
t_isim=`date +%m-%d-%y.%H%M%S`
fi
bsdtar -P -r -f $TARIHCE_DIZIN/"$t_isim"-pkvt.tar $VT
lzip -9 $TARIHCE_DIZIN/"$t_isim"-pkvt.tar
2016-03-09 01:57:13 +01:00
}
tarihce_yukle(){
tarihce_dkontrol
2016-03-12 00:09:47 +01:00
local islem_onay cikis
2016-03-10 01:28:42 +01:00
sil_onay="h"
if [ -f $TARIHCE_DIZIN/"$1-pkvt.tar.lz" ];then
bsdtar -p -o -C /tmp -xf $TARIHCE_DIZIN/"$1-pkvt.tar.lz" 2>/dev/null
2016-03-12 00:09:47 +01:00
ls /tmp/var/lib/pkg/DB/ > hedef.pkvt
2016-03-10 01:28:42 +01:00
ls /var/lib/pkg/DB/ > simdiki.pkvt
2016-03-12 00:09:47 +01:00
grep -vf hedef.pkvt simdiki.pkvt > sil.liste
grep -vf simdiki.pkvt hedef.pkvt > kur.liste
rm hedef.pkvt simdiki.pkvt
2016-03-10 01:28:42 +01:00
rm -r /tmp/var
2016-03-12 00:09:47 +01:00
cikis=""
2016-03-10 01:28:42 +01:00
if [ -s sil.liste ];then
ryaz 32 "silinecekler"
ryaz 32 "------------"
cat sil.liste
2016-03-12 00:09:47 +01:00
fi
if [ -s kur.liste ];then
ryaz 32 "kurulacaklar"
ryaz 32 "------------"
cat kur.liste
fi
if [ ! -s sil.liste ] && [ ! -s kur.liste ];then
ryaz 32 "sistem zaten hedef durumda!"
2016-03-10 01:28:42 +01:00
exit 1
fi
while true; do
ryaz 34 "otomatik geri dönüşüm başlasın mı?";read -p "e veya h-> " eh
case $eh in
2016-03-12 00:09:47 +01:00
[Ee]* ) islem_onay="e"; break;;
2016-03-10 01:28:42 +01:00
[Hh]* ) break;;
* ) echo "e veya h";;
esac
done
2016-03-12 00:09:47 +01:00
if [ "$islem_onay" = "e" ];then
2016-03-10 01:28:42 +01:00
mps -os sil.liste
2016-03-12 00:09:47 +01:00
mps -ok kur.liste
2016-03-10 01:28:42 +01:00
mv sil.liste silinenler.liste
2016-03-12 00:09:47 +01:00
mv kur.liste kurulanlar.liste
2016-03-10 01:28:42 +01:00
exit 1
fi
mv sil.liste sil_iptal.liste
2016-03-12 00:09:47 +01:00
mv kur.liste kur_iptal.liste
2016-03-09 01:57:13 +01:00
else
ryaz 31 "ilgili tarihce dosyası bulunamadı!"
fi
}
tarihce_sil(){
tarihce_dkontrol
2016-03-10 01:28:42 +01:00
if [ -f $TARIHCE_DIZIN/"$1-pkvt.tar.lz" ];then
rm -f $TARIHCE_DIZIN/"$1-pkvt.tar.lz"
2016-03-09 01:57:13 +01:00
else
ryaz 31 "ilgili tarihce dosyası bulunamadı!"
fi
}
2016-03-29 02:16:52 +02:00
loglama(){
logdizin_kontrol
2016-03-31 03:23:45 +02:00
echo "$(date +'%F %T') $1" >> "$kokdizin/$LOGDIZIN/mps.log"
2016-03-09 01:57:13 +01:00
}
2016-03-07 00:39:49 +01:00
git_guncelle() {
kaynakdizin_kontrol
2016-03-31 03:23:45 +02:00
gitayar_kontrol
2016-03-07 00:39:49 +01:00
cd $DERLEME_KAYNAKDIZIN
#git sunucudan guncelleme
ryaz 33 "git sunucudan güncelleme çekiliyor."
if [ ! -d milis.git ];then
git clone $git_sunucu milis.git
else
cd milis.git
git pull
fi
ryaz 33 "yerele eşitleniyor."
2016-03-11 17:42:21 +01:00
rm -r $talimatname_dizin/*
2016-03-07 00:39:49 +01:00
rsync -a $DERLEME_KAYNAKDIZIN/milis.git/talimatname/ $talimatname_dizin
2016-03-11 17:48:24 +01:00
rm -r `dirname $talimatname_dizin`/bin/*
2016-03-07 22:12:18 +01:00
rsync -a $DERLEME_KAYNAKDIZIN/milis.git/bin/ `dirname $talimatname_dizin`/bin
2016-03-07 00:39:49 +01:00
}
2016-02-24 01:27:23 +01:00
paketvt_guncelle(){
wget -q --spider "$sunucu""paket.vt"
#if wget -P /tmp -q "$sunucu""paket.vt" > /dev/null; then
if [ $? -eq 0 ]; then
2016-03-07 23:04:43 +01:00
ryaz 32 "paket veritabanı guncellenıyor." "$paketdepo""paket.vt"
2016-02-24 01:27:23 +01:00
if [ -f "$paketdepo""paket.vt" ];then
mv "$paketdepo""paket.vt" "$paketdepo""paket.vt.eski"
fi
wget -P "$paketdepo" "$sunucu""paket.vt"
#rm /tmp/paket.vt*
exit 1
fi
2016-03-07 23:04:43 +01:00
ryaz 31 "paket veritabanı guncelleme olumsuz."
2016-02-24 01:27:23 +01:00
}
2016-03-07 00:39:49 +01:00
talimat_bilgi(){
local konum HEAD
konum="`find "$talimatname_dizin" -name $1`"
HEAD=`grep -B 12 "build()" $konum/talimat`
echo $HEAD
}
2016-02-24 01:27:23 +01:00
sistem_kontrol(){
paketvt_kontrol
sunucu_kontrol
}
sunucu_kontrol(){
wget -q --spider $sunucu
if [ $? -eq 0 ]; then
2016-03-07 23:04:43 +01:00
ryaz 32 "paket sunucu aktif"
2016-02-24 01:27:23 +01:00
else
2016-03-07 23:04:43 +01:00
ryaz 31 "sunucu erişim dışı"
2016-02-24 01:27:23 +01:00
exit 1
fi
}
2016-03-31 03:23:45 +02:00
gitayar_kontrol(){
if [ ! -f /root/.gitconfig ];then
git_ssl_iptal
git_otokimlik
fi
}
2016-02-24 01:27:23 +01:00
paketvt_kontrol(){
mkdir -p /depo/paketler
if [ ! -f /depo/paketler/paket.vt ];then
touch /depo/paketler/paket.vt
fi
}
2016-03-29 02:39:30 +02:00
pvt_olustur(){
if [ ! -f paket.vt ];then
touch paket.vt
fi
if [ -f "paket.vt" ];then
mv "paket.vt" "paket.vt.eski"
fi
ryaz 32 "paket.vt oluşturuluyor...."
2016-03-30 14:28:57 +02:00
for paket in `ls *.mps.lz`
2016-03-29 02:39:30 +02:00
do
paketad="`echo $paket|cut -d "#" -f1`"
shaek=`sha1sum $paket`
echo $paketad $shaek >> paket.vt
done
ryaz 32 "paket.vt oluşturuldu."
}
2016-02-24 01:27:23 +01:00
yardim(){
echo "yardim"
}
ayarlar() {
while [ "$1" ]; do
case $1 in
-i|--indir)
ikaynak="ag"
kurulum_onay="olumsuz";;
-ik|--inku)
2016-04-03 02:08:03 +02:00
if [ "$3" == "-kok" ] && [ -d "$4" ]; then
kokdizin="$4"
fi
2016-02-24 01:27:23 +01:00
ikaynak="ag" ;;
2016-04-03 02:08:03 +02:00
-ikz|--inkuzo)
ikaynak="ag"
tekrarkur="evet" ;;
2016-02-24 01:27:23 +01:00
-k|--yrku)
2016-03-31 02:28:09 +02:00
if [ "$3" == "-kok" ] && [ -d "$4" ]; then
kokdizin="$4"
tekrarkur="evet"
fi
2016-02-24 01:27:23 +01:00
ikaynak="yerel" ;;
2016-03-07 22:12:18 +01:00
-s|--pksil)
2016-02-24 01:27:23 +01:00
paket_sil "$2" ;;
-d|--pkde)
2016-03-07 23:04:43 +01:00
zorla_derle="yok"
2016-02-24 01:27:23 +01:00
kurulum_onay="olumsuz"
paket_derle "$2" ;;
2016-03-07 18:52:54 +01:00
-zd|--pkzde)
zorla_derle="evet"
kurulum_onay="olumsuz"
paket_derle "$2" ;;
2016-02-24 01:27:23 +01:00
-dk|--pkdk)
paket_derle "$2" ;;
-odk|--pkodk)
paket_derle_oto "$2" ;;
2016-03-03 15:10:44 +01:00
-odkk|--pkodk2)
paket_derle_oto2 "$2" ;;
2016-03-02 01:26:35 +01:00
-ok|--pkok)
2016-03-12 00:09:47 +01:00
paket_kur_oto "$2" ;;
2016-03-17 03:08:24 +01:00
-okl|--pkokl)
paket_kur_liste "$2" ;;
2016-03-12 00:09:47 +01:00
-ko|--pkko)
2016-03-17 04:08:47 +01:00
paket_kur_oto2 "$2" ;;
2016-04-05 02:02:34 +02:00
-kurul)
paket_inkur_liste "$2" ;;
-kur)
paket_inkur_oto "$2" ;;
2016-03-19 00:16:01 +01:00
-pak|--paketle)
2016-03-19 02:20:46 +01:00
if [ ! "$2" ]; then
ryaz 31 "paketlenecek dizin ismi eksik"
exit 1
fi
2016-03-19 00:16:01 +01:00
yeniden_paketle "$2" ;;
2016-04-12 00:14:39 +02:00
-psk|--paksiskur)
if [ ! "$2" ]; then
ryaz 31 "paket liste yok"
exit 1
fi
if [ ! "$3" ]; then
ryaz 31 "hedef dizin yok"
exit 1
fi
sistem_kur "$2" "$3" ;;
2016-03-29 02:39:30 +02:00
-po)
pvt_olustur ;;
2016-03-10 01:28:42 +01:00
-os|--pkos)
if [ ! "$2" ]; then
ryaz 31 "silme listesi yok"
exit 1
fi
paket_sil_oto "$2" ;;
2016-03-07 23:04:43 +01:00
-kl|--kurulu-liste)
ls $VT ;;
2016-02-24 01:27:23 +01:00
-dly|--drly)
2016-04-05 02:02:34 +02:00
if [ -f tumbag.liste ];then
mv tumbag.liste tumbag.liste.eski
2016-02-28 00:55:08 +01:00
fi
2016-04-05 02:02:34 +02:00
if [ -f bag.liste ];then
mv bag.liste bag.liste.eski
2016-02-28 00:55:08 +01:00
fi
2016-04-05 02:02:34 +02:00
touch tumbag.liste
touch bag.liste
2016-02-24 01:27:23 +01:00
derleme_listyap "$2" ;;
2016-03-02 01:26:35 +01:00
-dlb|--drlb)
2016-03-07 00:39:49 +01:00
derleme_listbilgi "$2";;
2016-02-24 01:27:23 +01:00
-b|--pkbl)
paket_bilgi "$2" ;;
-bb|--pkbb)
2016-03-02 01:26:35 +01:00
bagimli_bilgi "$2" | column -t;;
2016-03-12 00:09:47 +01:00
-tb|--pktb)
ters_bagimli "$2" ;;
2016-03-12 01:06:20 +01:00
-tbk|--pktbk)
ters_bagimli_kontrol "$2" ;;
2016-03-12 00:09:47 +01:00
-talb|--talb)
2016-03-07 00:39:49 +01:00
talimat_bilgi "$2" | column -t;;
-Ggit|--gitgun)
git_guncelle ;;
2016-02-24 01:27:23 +01:00
-G|--pvtg)
paketvt_guncelle ;;
-g|--pkgu)
if [ ! "$2" ]; then
2016-03-07 23:04:43 +01:00
ryaz 31 "paket ismi eksik"
2016-02-24 01:27:23 +01:00
exit 1
fi
paket_guncelle "$2";;
2016-03-07 23:04:43 +01:00
-kk|--kurulu-kontrol)
2016-02-24 01:27:23 +01:00
if [ ! "$2" ]; then
2016-03-07 23:04:43 +01:00
ryaz 31 "paket ismi eksik"
2016-02-24 01:27:23 +01:00
exit 1
fi
2016-03-07 23:04:43 +01:00
ryaz 31 `kurulu_kontrol "$2"`;;
2016-02-24 01:27:23 +01:00
-suko)
sunucu_kontrol ;;
-cf|--config-file)
if [ ! "$2" ]; then
echo "ayardosyası gerek $1"
exit 1
fi
ayar_dosyasi="$2"
shift ;;
2016-03-09 01:57:13 +01:00
-tro)
tarihce_yap ;;
2016-03-10 01:28:42 +01:00
-trot)
temel_tarihce="evet"
tarihce_yap ;;
2016-03-09 01:57:13 +01:00
-try)
if [ ! "$2" ]; then
ryaz 31 "tarihce dosyasi eksik $1"
exit 1
fi
tarihce_yukle "$2"
shift ;;
-trl)
tarihce_liste ;;
-trs)
if [ ! "$2" ]; then
ryaz 31 "parametre eksik $1"
exit 1
fi
tarihce_sil "$2"
shift ;;
2016-02-24 01:27:23 +01:00
-v)
2016-03-11 17:42:21 +01:00
ryaz 33 "$betikad $versiyon $iletisim"
2016-02-24 01:27:23 +01:00
exit 0 ;;
-h|--help)
yardim
exit 0 ;;
esac
shift
done
}
ana(){
ayarlar "$@"
if [ "$ikaynak" = "ag" ]; then
2016-04-14 22:27:59 +02:00
local kontroldeg
2016-04-03 02:08:03 +02:00
kkont=`kurulu_kontrol "$2"`
if [ "$kkont" = "degil" ] || [ "$tekrarkur" = "evet" ];then
echo "agdan cekiliyor:" "$2"
pkt=`cat "$paketdepo""paket.vt" | grep "^$2 " | cut -d' ' -f3`
2016-04-14 22:27:59 +02:00
echo $pkt
2016-04-03 02:08:03 +02:00
if [ ! -z "$pkt" -a "$pkt" != "" ]; then
cpaket="${pkt/'#'/'%23'}"
#paket sunucuda varsa
wget -q --spider "$sunucu$cpaket"
#if wget -P /tmp -q "$sunucu$cpaket" > /dev/null; then
if [ $? -eq 0 ]; then
wget -nc -P "$paketdepo" "$sunucu$cpaket"
2016-04-14 22:27:59 +02:00
ekontdeg=`cat "$paketdepo""paket.vt" | grep "^$2 " | cut -d' ' -f2`
mkontdeg=`md5sum $pkt | cut -d' ' -f1`
if [ "$ekontdeg" != "$mkontdeg" ];then
rm -f $pkt
wget -nc -P "$paketdepo" "$sunucu$cpaket"
fi
2016-04-03 02:08:03 +02:00
if [ "$kurulum_onay" = "evet" ];then
if [ "$tekrarkur" = "evet" ];then
paket_sil "$2" "evet"
fi
2016-02-24 01:27:23 +01:00
icerik_ekle "$paketdepo$pkt"
exit 1
fi
2016-04-14 22:27:59 +02:00
2016-02-24 01:27:23 +01:00
fi
2016-04-03 02:08:03 +02:00
else
ryaz 31 "paket sunucuda yok!( mps -G komutuyla güncelleme yapınız. )"
2016-02-24 01:27:23 +01:00
fi
2016-04-03 02:08:03 +02:00
else
2016-04-05 02:02:34 +02:00
ryaz 31 "$2 paketi zaten kurulu!"
2016-02-24 01:27:23 +01:00
fi
exit 1
fi
if [ "$ikaynak" = "yerel" ]; then
2016-02-28 00:55:08 +01:00
local silme
2016-02-24 01:27:23 +01:00
pkontrol=`basename $2 | grep -w "mps.lz"`
if [ ! -z "$pkontrol" -a "$pkontrol" != "" ]; then
paketad=`echo "$2" | cut -d'#' -f1`
kkont=`kurulu_kontrol "$paketad"`
if [ "$kkont" = "degil" ];then
icerik_ekle "$2"
else
2016-03-23 06:53:40 +01:00
if [ "$tekrarkur" = "hayir" ];then
while true; do
ryaz 31 "$2 paketi zaten kurulu silinip kurulsun mu?"
read -p "e veya h -> " eh
case $eh in
[Ee]* ) silme="e"; break;;
[Hh]* ) break;;
* ) echo "e veya h";;
esac
done
fi
2016-02-28 00:55:08 +01:00
if [ "$silme" = "e" ];then
2016-03-07 23:04:43 +01:00
ryaz 33 "silinecekelerin kontrolu için"
paket_sil "$paketad"
2016-02-28 00:55:08 +01:00
icerik_ekle "$2"
fi
2016-02-24 01:27:23 +01:00
fi
else
2016-03-07 23:04:43 +01:00
ryaz 31 "yerelde mps paketi bulunamadı."
2016-02-24 01:27:23 +01:00
fi
fi
}
ana "$@"
2016-03-07 23:04:43 +01:00
#31 kirmizi
#32 yesil
#33 sari
#34 mavi
#34 mor