2016-02-24 01:27:23 +01:00
|
|
|
|
#!/bin/bash
|
2016-03-06 19:36:07 +01:00
|
|
|
|
. /etc/mpsd.conf
|
2016-05-01 04:07:04 +02:00
|
|
|
|
if [ -f /etc/mps.conf ];then
|
2016-05-01 03:26:55 +02:00
|
|
|
|
. /etc/mps.conf
|
2016-05-01 04:07:04 +02:00
|
|
|
|
fi
|
2016-03-07 00:39:49 +01:00
|
|
|
|
. /root/bin/fonks.sh
|
2016-05-27 01:30:25 +02:00
|
|
|
|
versiyon="0.6"
|
2016-03-11 17:42:21 +01:00
|
|
|
|
iletisim="milisarge@gmail.com"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
paketdepo="/depo/paketler/"
|
2016-05-01 03:26:55 +02:00
|
|
|
|
if [ -z ${sunucu+:} ]; then
|
2016-05-01 04:40:58 +02:00
|
|
|
|
sunucu="127.0.0.1:8000/"
|
2016-05-01 03:26:55 +02:00
|
|
|
|
fi
|
2016-04-17 15:06:55 +02:00
|
|
|
|
#sunucu="http://milis.gungre.ch/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"
|
2016-05-01 03:26:55 +02:00
|
|
|
|
if [ -z ${lokal+:} ]; then
|
|
|
|
|
lokal="tr"
|
|
|
|
|
fi
|
|
|
|
|
if [ -z ${docsil+:} ]; then
|
|
|
|
|
docsil="evet"
|
|
|
|
|
fi
|
|
|
|
|
if [ -z ${yerelsil+:} ]; then
|
|
|
|
|
yerelsil="evet"
|
|
|
|
|
fi
|
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-05-01 04:07:04 +02: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-04-16 23:32:13 +02:00
|
|
|
|
ryaz 31 "kurban dosyalar"
|
|
|
|
|
ryaz 31 "------------------"
|
|
|
|
|
silme_kurban_kontrol /tmp/$paket.sil
|
|
|
|
|
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-05-03 01:31:38 +02:00
|
|
|
|
rm -f /tmp/$paket.sil
|
|
|
|
|
else
|
|
|
|
|
rm -f /tmp/$paket.sil
|
|
|
|
|
exit 1
|
2016-03-07 01:43:25 +01:00
|
|
|
|
fi
|
2016-05-03 01:31:38 +02:00
|
|
|
|
|
2016-03-07 01:43:25 +01:00
|
|
|
|
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-05-03 01:31:38 +02:00
|
|
|
|
paket_bilgi2(){
|
2016-02-24 01:27:23 +01:00
|
|
|
|
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-05-03 01:31:38 +02:00
|
|
|
|
paket_bilgi(){
|
|
|
|
|
local paket kkont
|
|
|
|
|
kkont=`kurulu_kontrol "$1"`
|
|
|
|
|
if [ "$kkont" = "kurulu" ];then
|
|
|
|
|
paket="$1"
|
|
|
|
|
satir=`sed -n '1p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "AD:" ${satir:1:${#satir}-1}
|
|
|
|
|
satir=`sed -n '2p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "TN:" ${satir:1:${#satir}-1}
|
|
|
|
|
satir=`sed -n '3p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "UR:" ${satir:1:${#satir}-1}
|
|
|
|
|
satir=`sed -n '4p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "YP:" ${satir:1:${#satir}-1}
|
|
|
|
|
satir=`sed -n '5p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "PK:" ${satir:1:${#satir}-1}
|
|
|
|
|
satir=`sed -n '6p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "--:" ${satir:1:${#satir}-1}
|
|
|
|
|
satir=`sed -n '7p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "VS:" ${satir:1:${#satir}-1}
|
|
|
|
|
satir=`sed -n '8p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "RL:" ${satir:1:${#satir}-1}
|
2016-05-07 17:53:00 +02:00
|
|
|
|
satir=`sed -n '9p' < /var/lib/pkg/DB/"$paket"/META`
|
|
|
|
|
ryaz 32 "DZ:" `date -d @${satir:1:${#satir}-1}`
|
2016-05-03 01:31:38 +02:00
|
|
|
|
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-06-02 01:55:44 +02:00
|
|
|
|
|
|
|
|
|
if [ "$bagimlist" != "talimatyok" ];then
|
|
|
|
|
for bagim in $bagimlist;do
|
|
|
|
|
|
|
|
|
|
if [ "`cat tumbag.liste | grep $bagim`" != "$bagim" ];then
|
|
|
|
|
derleme_listyap "$bagim"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if ! grep -Fxq "$1" tumbag.liste
|
|
|
|
|
then
|
|
|
|
|
ana="`find $talimatname_dizin -name $1`"
|
|
|
|
|
echo ${ana#"$talimatname_dizin"}
|
|
|
|
|
#sadece genel bagimliliklar derlenecek
|
|
|
|
|
echo "$1" >> tumbag.liste
|
|
|
|
|
if [ -d "$talimatname_dizin/genel/$1" ];then
|
|
|
|
|
echo "$1" >> bag.liste
|
|
|
|
|
fi
|
2016-02-28 00:55:08 +01:00
|
|
|
|
fi
|
2016-06-02 01:55:44 +02:00
|
|
|
|
else
|
|
|
|
|
ryaz 31 "$1 talimatı bulunamadı."
|
|
|
|
|
exit 1
|
2016-02-24 01:27:23 +01:00
|
|
|
|
fi
|
2016-06-02 01:55:44 +02:00
|
|
|
|
}
|
2016-02-24 01:27:23 +01:00
|
|
|
|
|
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-04-17 01:08:11 +02:00
|
|
|
|
paket_derle_liste(){
|
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
|
2016-04-17 01:08:11 +02:00
|
|
|
|
paket_derle_kur(){
|
2016-03-23 06:53:40 +01:00
|
|
|
|
tekrarkur="hayir"
|
2016-04-17 01:08:11 +02:00
|
|
|
|
mps -dly "$1" > /dev/null && mps -derlist 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-21 15:37:37 +02:00
|
|
|
|
paket_inkur_liste_direk(){
|
|
|
|
|
local kpkt
|
|
|
|
|
for kpkt in `cat $1`;do
|
|
|
|
|
mps -ik "$kpkt"
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-05 02:02:34 +02:00
|
|
|
|
paket_inkur_liste(){
|
2016-04-21 15:25:08 +02:00
|
|
|
|
local kpkt
|
2016-03-17 04:08:47 +01:00
|
|
|
|
for kpkt in `cat $1`;do
|
2016-04-21 15:25:08 +02:00
|
|
|
|
mps -kur "$kpkt"
|
2016-03-17 04:08:47 +01:00
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#otomatik kontrollu kur
|
2016-04-05 02:02:34 +02:00
|
|
|
|
paket_inkur_oto(){
|
2016-04-21 15:25:08 +02:00
|
|
|
|
mps -dly "$1" > /dev/null &&
|
|
|
|
|
local kpkt
|
|
|
|
|
for kpkt in `cat bag.liste`;do
|
|
|
|
|
mps -ik "$kpkt"
|
|
|
|
|
done
|
2016-04-05 02:02:34 +02:00
|
|
|
|
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-05-03 01:31:38 +02:00
|
|
|
|
|
|
|
|
|
paket_guncelle(){
|
|
|
|
|
surum_kontrol $1
|
|
|
|
|
devir_kontrol $1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
paket_guncelle_oto(){
|
|
|
|
|
mps -dly "$1" > /dev/null &&
|
|
|
|
|
local kpkt
|
|
|
|
|
for kpkt in `cat bag.liste`;do
|
|
|
|
|
mps -g "$kpkt"
|
|
|
|
|
done
|
|
|
|
|
rm bag.liste tumbag.liste
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-03 01:42:27 +02:00
|
|
|
|
sistem_guncelle(){
|
|
|
|
|
local kpkt
|
|
|
|
|
for kpkt in `mps -kl`;do
|
|
|
|
|
mps -g "$kpkt"
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-03 01:31:38 +02:00
|
|
|
|
surum_kontrol(){
|
|
|
|
|
local ksurum version pkt dusuk yuksek durum
|
|
|
|
|
durum="belirsiz"
|
|
|
|
|
satir=`sed -n '7p' < /var/lib/pkg/DB/"$1"/META`
|
|
|
|
|
ksurum=${satir:1:${#satir}-1}
|
|
|
|
|
pkt="`find $talimatname_dizin -name $1`"
|
|
|
|
|
source $pkt/talimat
|
|
|
|
|
dusuk=`echo -e "$ksurum\n$version" | sort -V | head -n1`
|
|
|
|
|
|
|
|
|
|
if [ "$ksurum" = "$version" ];then
|
|
|
|
|
durum="guncel"
|
|
|
|
|
else
|
|
|
|
|
if [ "$ksurum" = "$dusuk" ];then
|
|
|
|
|
durum="yukselt"
|
|
|
|
|
else
|
|
|
|
|
durum="dusur"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$durum" <> "guncel" ];then
|
|
|
|
|
mps -s $1
|
|
|
|
|
mps -ik $1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
ryaz 33 "$1 surum kontrolu $ksurum & $version $durum"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
devir_kontrol(){
|
|
|
|
|
local kdevir release pkt dusuk yuksek durum
|
|
|
|
|
durum="belirsiz"
|
|
|
|
|
satir=`sed -n '8p' < /var/lib/pkg/DB/"$1"/META`
|
|
|
|
|
kdevir=${satir:1:${#satir}-1}
|
|
|
|
|
pkt="`find $talimatname_dizin -name $1`"
|
|
|
|
|
source $pkt/talimat
|
|
|
|
|
dusuk=`echo -e "$kdevir\n$release" | sort -V | head -n1`
|
|
|
|
|
|
|
|
|
|
if [ "$kdevir" = "$release" ];then
|
|
|
|
|
durum="guncel"
|
|
|
|
|
else
|
|
|
|
|
if [ "$kdevir" = "$dusuk" ];then
|
|
|
|
|
durum="yukselt"
|
|
|
|
|
else
|
|
|
|
|
durum="dusur"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$durum" <> "guncel" ];then
|
|
|
|
|
mps -s $1
|
|
|
|
|
mps -ik $1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
ryaz 33 "$1 devir kontrolu $kdevir & $release $durum"
|
|
|
|
|
}
|
|
|
|
|
|
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-06-02 01:55:44 +02:00
|
|
|
|
if [ -f "$konum/talimat" ];then
|
|
|
|
|
bagimd=`cat $konum/talimat | grep "Depends on" | cut -d':' -f2`
|
|
|
|
|
|
|
|
|
|
if [ -n "$bagimd" ]; then
|
|
|
|
|
bagimd=`echo "$bagimd" | sed 's/,/ /g'`
|
|
|
|
|
#sıralı gösterme
|
|
|
|
|
echo `echo "$bagimd" | sed 's/,/ /g'`
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "talimatyok"
|
|
|
|
|
exit 1
|
2016-03-02 01:26:35 +01:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2016-04-16 23:32:13 +02:00
|
|
|
|
silme_kurban_kontrol(){
|
|
|
|
|
local dizin
|
|
|
|
|
for f in $(cat $1) ; do
|
|
|
|
|
dizin="${f%\'}"
|
|
|
|
|
dizin="${dizin#\'}"
|
|
|
|
|
if [ -d "$dizin" ];then
|
|
|
|
|
for g in `ls "$dizin"` ; do
|
|
|
|
|
if ! grep -Fxq " '$dizin/$g'" "$1"
|
|
|
|
|
then
|
|
|
|
|
echo "$dizin/$g"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-01 04:40:58 +02:00
|
|
|
|
temel_tarihce_kontrol(){
|
|
|
|
|
if [ ! -f $TARIHCE_DIZIN/temel-pkvt.tar.lz ];then
|
|
|
|
|
tarihce_olustur "temel"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-09 01:57:13 +01:00
|
|
|
|
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
|
2016-05-01 04:40:58 +02:00
|
|
|
|
tarihce_olustur "$t_isim"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tarihce_olustur(){
|
|
|
|
|
bsdtar -P -r -f $TARIHCE_DIZIN/"$1"-pkvt.tar $VT
|
|
|
|
|
lzip -9 $TARIHCE_DIZIN/"$1"-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-06-02 03:56:21 +02:00
|
|
|
|
grep -v -F -x -f hedef.pkvt simdiki.pkvt > sil.liste
|
|
|
|
|
grep -v -F -x -f 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-06-01 00:40:26 +02:00
|
|
|
|
mps -kurul 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
|
2016-05-01 05:09:29 +02:00
|
|
|
|
rsync -av /sources/milis.git/rootfs/* /
|
2016-03-07 00:39:49 +01:00
|
|
|
|
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-04-21 02:17:18 +02:00
|
|
|
|
rm -r `dirname $talimatname_dizin`/ayarlar/*
|
|
|
|
|
rsync -a $DERLEME_KAYNAKDIZIN/milis.git/ayarlar/ `dirname $talimatname_dizin`/ayarlar
|
2016-03-07 00:39:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
paketvt_guncelle(){
|
2016-05-01 04:40:58 +02:00
|
|
|
|
temel_tarihce_kontrol
|
2016-02-24 01:27:23 +01:00
|
|
|
|
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-05-27 01:30:25 +02:00
|
|
|
|
paket_indir(){
|
|
|
|
|
local pkt
|
|
|
|
|
if [ -f "$paketdepo""paket.vt" ];then
|
|
|
|
|
pkt=`cat "$paketdepo""paket.vt" | grep "^$1 " | cut -d' ' -f3`
|
|
|
|
|
ekontdeg=`cat "$paketdepo""paket.vt" | grep "^$1 " | cut -d' ' -f2`
|
|
|
|
|
cpaket="${pkt/'#'/'%23'}"
|
|
|
|
|
wget -nc -P "$paketdepo" "$sunucu$cpaket" &> /dev/null
|
|
|
|
|
if [[ "$?" != 0 ]]; then
|
|
|
|
|
ryaz 31 "indirme hatalı"
|
|
|
|
|
else
|
|
|
|
|
ryaz 34 "$1 indirildi"
|
|
|
|
|
fi
|
|
|
|
|
mkontdeg=`sha1sum "$paketdepo$pkt" | cut -d' ' -f1`
|
|
|
|
|
if [ "$ekontdeg" != "$mkontdeg" ];then
|
|
|
|
|
ryaz 31 "sha1sum uyusmaslik tesbit edildi,paket tekrar indiriliyor."
|
|
|
|
|
rm -f "$paketdepo$pkt"
|
|
|
|
|
paket_indir "$1"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
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" ;;
|
2016-04-17 01:08:11 +02:00
|
|
|
|
-derlist)
|
|
|
|
|
paket_derle_liste "$2" ;;
|
|
|
|
|
-derle)
|
|
|
|
|
paket_derle_kur "$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-21 15:37:37 +02:00
|
|
|
|
-kuruld)
|
|
|
|
|
paket_inkur_liste_direk "$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" ;;
|
2016-05-01 03:26:55 +02:00
|
|
|
|
#sunucu bilgisi alma
|
|
|
|
|
-sun|--sunucu)
|
|
|
|
|
ryaz 32 $sunucu ;;
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-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;;
|
2016-05-09 10:36:02 +02:00
|
|
|
|
-Ggit|-GG)
|
2016-03-07 00:39:49 +01:00
|
|
|
|
git_guncelle ;;
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-G|--pvtg)
|
|
|
|
|
paketvt_guncelle ;;
|
2016-05-03 01:42:27 +02:00
|
|
|
|
#komple kurulu sistemin guncellenmesi
|
|
|
|
|
-GS)
|
|
|
|
|
sistem_guncelle ;;
|
2016-05-03 01:31:38 +02:00
|
|
|
|
#tekil paket guncelleme-single package updating
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-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-05-03 01:31:38 +02:00
|
|
|
|
#bagimliliklariyla beraber paket guncelleme-package updating with depencies
|
|
|
|
|
-go|--pkgo)
|
|
|
|
|
if [ ! "$2" ]; then
|
|
|
|
|
ryaz 31 "paket ismi eksik"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
paket_guncelle_oto "$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
|
|
|
|
|
}
|
2016-04-17 01:08:11 +02:00
|
|
|
|
|
|
|
|
|
yardim() {
|
|
|
|
|
cat <<_EOF
|
|
|
|
|
|
|
|
|
|
$betikad $versiyon Milis Paket Sistemi
|
|
|
|
|
|
|
|
|
|
Secenekler:
|
2016-04-17 01:59:15 +02:00
|
|
|
|
-G ikili paket veritabanini gunceller
|
|
|
|
|
-Ggit git sunucusundan talimatname ve sistem gunceller
|
|
|
|
|
-kur paket_ismi ilgili paketi bagimliliklariyla agdan cekip kurar
|
|
|
|
|
-s paket_ismi ilgili paketi kaldirir
|
|
|
|
|
-k paket_ismi yereldeki paketi bagimliliksiz kurar
|
|
|
|
|
-kl kurulu paket listesini verir
|
|
|
|
|
-kk paket_ismi ilgili paketin kurulu olma durumunu verir
|
|
|
|
|
-d paket_ismi ilgili paketin talimat dosyasına göre
|
|
|
|
|
sadece derler,paketler
|
|
|
|
|
-derle paket_ismi ilgili paketin talimat dosyasına göre bagimliliklariyla
|
|
|
|
|
beraber derler,paketler ve kurar.
|
2016-04-17 01:08:11 +02:00
|
|
|
|
|
|
|
|
|
_EOF
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
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
|
2016-05-27 01:30:25 +02:00
|
|
|
|
pkt=`cat "$paketdepo""paket.vt" | grep "^$2 " | cut -d' ' -f3`
|
2016-04-03 02:08:03 +02:00
|
|
|
|
if [ ! -z "$pkt" -a "$pkt" != "" ]; then
|
|
|
|
|
cpaket="${pkt/'#'/'%23'}"
|
2016-05-27 01:30:25 +02:00
|
|
|
|
ryaz 33 "agdan cekiliyor:" "$cpaket"
|
2016-04-03 02:08:03 +02:00
|
|
|
|
#paket sunucuda varsa
|
|
|
|
|
wget -q --spider "$sunucu$cpaket"
|
|
|
|
|
#if wget -P /tmp -q "$sunucu$cpaket" > /dev/null; then
|
|
|
|
|
if [ $? -eq 0 ]; then
|
2016-05-27 01:30:25 +02:00
|
|
|
|
#wget -P "$paketdepo" "$sunucu$cpaket"
|
|
|
|
|
paket_indir "$2"
|
|
|
|
|
|
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-05-27 01:30:25 +02:00
|
|
|
|
else
|
|
|
|
|
ryaz 31 "paket sunucuda yok!"
|
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-06-02 03:35:58 +02:00
|
|
|
|
ryaz 32 "$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
|